mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 00:08:05 -04:00
Engine: reworks Twitch IRC parsing/client + Streamer event surface (viewers roster, chat/sub/gift/raid messages) and removes older/broken Twitch API features. Menu/Editor: adds service linking/stream-connect UI (new Services modal; pause/game modal + editor title button) gated by a project setting. Services/utilities: introduces helper APIs for linking/listing services; adds unit tests for the IRC parser and subscription tier parsing.
43 lines
959 B
C#
43 lines
959 B
C#
using Sandbox.Engine;
|
|
using Sandbox.Modals;
|
|
|
|
namespace Sandbox;
|
|
|
|
public static partial class MenuUtility
|
|
{
|
|
public static class Streaming
|
|
{
|
|
/// <summary>
|
|
/// Returns true if the stream is active
|
|
/// </summary>
|
|
public static bool IsActive => Sandbox.Engine.Streamer.IsActive;
|
|
|
|
/// <summary>
|
|
/// Init a stream service
|
|
/// </summary>
|
|
public static async Task<bool> Connect( string serviceName )
|
|
{
|
|
return await Sandbox.Engine.Streamer.Init( serviceName );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disconnect from streaming service
|
|
/// </summary>
|
|
public static void Disconnect( string serviceName )
|
|
{
|
|
Sandbox.Engine.Streamer.Shutdown( serviceName );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Open the service connector modal, which allows the player to link/unlink third-party services like Twitch.
|
|
/// </summary>
|
|
public static void OpenModal()
|
|
{
|
|
using ( IMenuDll.Current.PushScope() )
|
|
{
|
|
IModalSystem.Current.ServiceConnector();
|
|
}
|
|
}
|
|
}
|
|
}
|