Screen load event for GameplayState (#14316)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Ghost;
|
||||
using Content.Client.UserInterface.Systems.Gameplay;
|
||||
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
||||
using Content.Shared.Ghost;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -16,6 +17,25 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
|
||||
private GhostGui? Gui => UIManager.GetActiveUIWidgetOrNull<GhostGui>();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var gameplayStateLoad = UIManager.GetUIController<GameplayStateLoadController>();
|
||||
gameplayStateLoad.OnScreenLoad += OnScreenLoad;
|
||||
gameplayStateLoad.OnScreenUnload += OnScreenUnload;
|
||||
}
|
||||
|
||||
private void OnScreenLoad()
|
||||
{
|
||||
LoadGui();
|
||||
}
|
||||
|
||||
private void OnScreenUnload()
|
||||
{
|
||||
UnloadGui();
|
||||
}
|
||||
|
||||
public void OnSystemLoaded(GhostSystem system)
|
||||
{
|
||||
system.PlayerRemoved += OnPlayerRemoved;
|
||||
|
||||
Reference in New Issue
Block a user