Files
sbox-public/engine/Sandbox.Engine/Systems/UI/Panel/Panel.SceneIndex.cs
Garry Newman 62feec4b64 Twitch Api (#5016)
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.
2026-06-06 21:46:13 +01:00

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&lt;T&gt;</c> / <c>Scene.RunEvent&lt;T&gt;</c> / <c>ISceneEvent&lt;T&gt;</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;
}
}