mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 16:28:36 -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.
36 lines
966 B
C#
36 lines
966 B
C#
namespace Sandbox.UI;
|
|
|
|
public partial class Panel
|
|
{
|
|
// The scene we're currently registered in (if any), so we know what to remove ourselves from.
|
|
Scene _indexedScene;
|
|
|
|
/// <summary>
|
|
/// Keep this panel registered in its scene's object index, so it can be found by
|
|
/// <c>Scene.GetAll<T></c> / <c>Scene.RunEvent<T></c> / <c>ISceneEvent<T></c> exactly
|
|
/// like a component. Idempotent and cheap - a no-op while our scene hasn't changed.
|
|
/// </summary>
|
|
void UpdateSceneIndex()
|
|
{
|
|
var scene = Scene;
|
|
if ( scene == _indexedScene )
|
|
return;
|
|
|
|
_indexedScene?.RemoveObjectFromDirectory( this );
|
|
_indexedScene = scene;
|
|
_indexedScene?.AddObjectToDirectory( this );
|
|
}
|
|
|
|
/// <summary>
|
|
/// Drop ourselves from the scene object index. Called when the panel is deleted.
|
|
/// </summary>
|
|
void RemoveFromSceneIndex()
|
|
{
|
|
if ( _indexedScene is null )
|
|
return;
|
|
|
|
_indexedScene.RemoveObjectFromDirectory( this );
|
|
_indexedScene = null;
|
|
}
|
|
}
|