Class Scene
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public abstract class Scene : IDisposable
Properties
|
Edit this page
View Source
CommandHandler
Optional command sink for PGPSCN action side effects
(scene_transition, play_sound). Runtime wires this to
SceneManager/SoundPlayer; the editor's SceneBridge passes a no-op
implementation so previewed scenes do not navigate away or play
audio. Null falls back to the legacy Instance
dispatch in ExecuteCommand(CommandDefinition).
Declaration
public ISceneCommandHandler? CommandHandler { get; set; }
Property Value
|
Edit this page
View Source
DynamicBindings
Declaration
protected List<DynamicBinding> DynamicBindings { get; }
Property Value
|
Edit this page
View Source
HidesOsCursor
When true, the OS cursor stays hidden for the life of this scene
(splash logos, etc.). Game applies it via
FrameInput.ForceHideOsCursor each frame.
Declaration
public virtual bool HidesOsCursor { get; }
Property Value
|
Edit this page
View Source
HierarchyManager
Declaration
public UIHierarchyManager? HierarchyManager { get; set; }
Property Value
|
Edit this page
View Source
Host
Host providing the rendering/asset/input context the scene needs to
load. Set by the runtime (Game passes itself before
calling Load()) or by an editor host (SceneBridge).
When null, Load() falls back to Instance
so unmigrated game subclasses keep working unchanged.
Declaration
public ISceneHost? Host { get; set; }
Property Value
|
Edit this page
View Source
IsLoaded
Declaration
public bool IsLoaded { get; set; }
Property Value
|
Edit this page
View Source
SceneData
Declaration
protected SceneData? SceneData { get; }
Property Value
|
Edit this page
View Source
SceneFileElements
Declaration
protected Dictionary<string, object>? SceneFileElements { get; set; }
Property Value
|
Edit this page
View Source
SceneInputContext
Declaration
protected InputContext SceneInputContext { get; }
Property Value
|
Edit this page
View Source
SceneLoader
Declaration
protected SceneLoader? SceneLoader { get; }
Property Value
Methods
|
Edit this page
View Source
AddBinding(DynamicBinding)
Declaration
public void AddBinding(DynamicBinding binding)
Parameters
|
Edit this page
View Source
Declaration
protected virtual void ConfigureInputBindings()
|
Edit this page
View Source
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
|
Edit this page
View Source
GetElementOrNull<T>(string)
Gets a UI element of the specified type by its ID from the scene file, returning null if not found.
This method allows for graceful handling of optional UI elements.
Declaration
protected T? GetElementOrNull<T>(string elementId) where T : class
Parameters
| Type |
Name |
Description |
| string |
elementId |
The ID of the element as defined in the .pgpscn file
|
Returns
| Type |
Description |
| T |
The UI element cast to the specified type, or null if not found
|
Type Parameters
| Name |
Description |
| T |
The type of UI element to retrieve
|
|
Edit this page
View Source
GetElement<T>(string)
Gets a UI element of the specified type by its ID from the scene file.
This method is used by generated properties to provide strongly-typed access to UI elements.
Declaration
protected T GetElement<T>(string elementId) where T : class
Parameters
| Type |
Name |
Description |
| string |
elementId |
The ID of the element as defined in the .pgpscn file
|
Returns
| Type |
Description |
| T |
The UI element cast to the specified type
|
Type Parameters
| Name |
Description |
| T |
The type of UI element to retrieve
|
Exceptions
|
Edit this page
View Source
GetSceneFilePath()
Resolves the PGPSCN file the scene loads from. Default convention is
scenes/{TypeName}.pgpscn, matching the runtime path where
game scenes are subclasses pinned by type. Editor preview hosts
override this to point at an arbitrary file the user picked — the
scene type is generic and the filename is data, not code.
Declaration
protected virtual string GetSceneFilePath()
Returns
|
Edit this page
View Source
Load()
Declaration
public virtual void Load()
|
Edit this page
View Source
OnLoad()
Declaration
protected virtual void OnLoad()
|
Edit this page
View Source
OnUnload()
Declaration
protected virtual void OnUnload()
|
Edit this page
View Source
Render(int, int)
Declaration
public virtual void Render(int width, int height)
Parameters
| Type |
Name |
Description |
| int |
width |
|
| int |
height |
|
|
Edit this page
View Source
ResolveBindingSource(BindingSource, object)
Declaration
protected object ResolveBindingSource(BindingSource source, object fallback)
Parameters
Returns
|
Edit this page
View Source
ResolveHost()
Service-access helper. Prefers an explicitly set Host;
falls back to Instance so existing game scenes
that never assign a host continue to resolve services the legacy
way. Returns null only when neither is available (test scenarios
that intentionally exercise the no-host edge case).
Declaration
protected ISceneHost? ResolveHost()
Returns
|
Edit this page
View Source
SetSceneData(SceneData)
Declaration
public void SetSceneData(SceneData sceneData)
Parameters
|
Edit this page
View Source
Unload()
Declaration
public virtual void Unload()
|
Edit this page
View Source
Update(double)
Declaration
public virtual void Update(double deltaTime)
Parameters
| Type |
Name |
Description |
| double |
deltaTime |
|
|
Edit this page
View Source
UpdateBindings()
Declaration
protected void UpdateBindings()
Implements