Oldchat (#11913)
* attempt at moving MainViewport to UIWidget * oldchat (prototype) * separate oldchat and default ss14 HUD into their own files * restores original default game screen logic and adds that logic into separated chat game screen * hand reloading, several tweaks to port oldchat to main ss14 branch oldchat is currently not selectable * screen type cvar, gameplay state screen reloading/loading * reload screen on ui layout cvar change * fixes up basic reloading (HUD switching is still very bad) * some UI widget reloading for main UI screen switching * alert sync on screen change * inventory reload * hotbar margin fix * chat bubbles above viewport * whoops * fixes ordering of speech bubble root * should fix the chat focus issue (at least in-game, not lobby yet) * should fix up the lobby/game chat focus * fixes chat for lobby, turns lobby into a UI state * viewport UI controller * viewport ratio selection * whoops * adds the /tg/ widescreen ratio * removes warning from inventory UI controller, adds background to separated chat game screen's chat portion * menu button reload * unload menu buttons only from gameplay state shutdown * bugfix * character button fix * adds config options for viewport width/UI layout * variable naming changes, get or null instead of get to avoid exceptions * moves entity system get into controller
This commit is contained in:
@@ -43,13 +43,11 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
||||
private TileSpawningUIController TileSpawningController => UIManager.GetUIController<TileSpawningUIController>();
|
||||
private DecalPlacerUIController DecalPlacerController => UIManager.GetUIController<DecalPlacerUIController>();
|
||||
|
||||
private MenuButton? _sandboxButton;
|
||||
private MenuButton? SandboxButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.SandboxButton;
|
||||
|
||||
public void OnStateEntered(GameplayState state)
|
||||
{
|
||||
DebugTools.Assert(_window == null);
|
||||
_sandboxButton = UIManager.GetActiveUIWidget<MenuBar.Widgets.GameTopMenuBar>().SandboxButton;
|
||||
_sandboxButton.OnPressed += SandboxButtonPressed;
|
||||
EnsureWindow();
|
||||
|
||||
CheckSandboxVisibility();
|
||||
@@ -68,13 +66,33 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
||||
.Register<SandboxSystem>();
|
||||
}
|
||||
|
||||
public void UnloadButton()
|
||||
{
|
||||
if (SandboxButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SandboxButton.OnPressed -= SandboxButtonPressed;
|
||||
}
|
||||
|
||||
public void LoadButton()
|
||||
{
|
||||
if (SandboxButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SandboxButton.OnPressed += SandboxButtonPressed;
|
||||
}
|
||||
|
||||
private void EnsureWindow()
|
||||
{
|
||||
if(_window is { Disposed: false })
|
||||
return;
|
||||
_window = UIManager.CreateWindow<SandboxWindow>();
|
||||
_window.OnOpen += () => { _sandboxButton!.Pressed = true; };
|
||||
_window.OnClose += () => { _sandboxButton!.Pressed = false; };
|
||||
_window.OnOpen += () => { SandboxButton!.Pressed = true; };
|
||||
_window.OnClose += () => { SandboxButton!.Pressed = false; };
|
||||
_window.ToggleLightButton.Pressed = !_light.Enabled;
|
||||
_window.ToggleFovButton.Pressed = !_eye.CurrentEye.DrawFov;
|
||||
_window.ToggleShadowsButton.Pressed = !_light.DrawShadows;
|
||||
@@ -100,10 +118,10 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
||||
|
||||
private void CheckSandboxVisibility()
|
||||
{
|
||||
if (_sandboxButton == null)
|
||||
if (SandboxButton == null)
|
||||
return;
|
||||
|
||||
_sandboxButton.Visible = _sandbox.SandboxAllowed;
|
||||
SandboxButton.Visible = _sandbox.SandboxAllowed;
|
||||
}
|
||||
|
||||
public void OnStateExited(GameplayState state)
|
||||
@@ -114,13 +132,6 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
||||
_window = null;
|
||||
}
|
||||
|
||||
if (_sandboxButton != null)
|
||||
{
|
||||
_sandboxButton.Pressed = false;
|
||||
_sandboxButton.OnPressed -= SandboxButtonPressed;
|
||||
_sandboxButton = null;
|
||||
}
|
||||
|
||||
CommandBinds.Unregister<SandboxSystem>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user