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:
@@ -30,14 +30,13 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
|
||||
[UISystemDependency] private readonly VerbSystem _verbs = default!;
|
||||
|
||||
private AdminMenuWindow? _window;
|
||||
private MenuButton? _adminButton;
|
||||
private MenuButton? AdminButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.AdminButton;
|
||||
|
||||
public void OnStateEntered(GameplayState state)
|
||||
{
|
||||
DebugTools.Assert(_window == null);
|
||||
|
||||
_window = UIManager.CreateWindow<AdminMenuWindow>();
|
||||
_adminButton = UIManager.GetActiveUIWidget<MenuBar.Widgets.GameTopMenuBar>().AdminButton;
|
||||
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.Center);
|
||||
|
||||
_window.PlayerTabControl.OnEntryPressed += PlayerTabEntryPressed;
|
||||
@@ -45,7 +44,6 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
|
||||
_window.OnOpen += OnWindowOpen;
|
||||
_window.OnClose += OnWindowClosed;
|
||||
_admin.AdminStatusUpdated += AdminStatusUpdated;
|
||||
_adminButton.OnPressed += AdminButtonPressed;
|
||||
|
||||
_input.SetInputCommand(ContentKeyFunctions.OpenAdminMenu,
|
||||
InputCmdHandler.FromDelegate(_ => Toggle()));
|
||||
@@ -53,16 +51,36 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
|
||||
AdminStatusUpdated();
|
||||
}
|
||||
|
||||
public void UnloadButton()
|
||||
{
|
||||
if (AdminButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdminButton.OnPressed -= AdminButtonPressed;
|
||||
}
|
||||
|
||||
public void LoadButton()
|
||||
{
|
||||
if (AdminButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AdminButton.OnPressed += AdminButtonPressed;
|
||||
}
|
||||
|
||||
private void OnWindowOpen()
|
||||
{
|
||||
if (_adminButton != null)
|
||||
_adminButton.Pressed = true;
|
||||
if (AdminButton != null)
|
||||
AdminButton.Pressed = true;
|
||||
}
|
||||
|
||||
private void OnWindowClosed()
|
||||
{
|
||||
if (_adminButton != null)
|
||||
_adminButton.Pressed = false;
|
||||
if (AdminButton != null)
|
||||
AdminButton.Pressed = false;
|
||||
}
|
||||
|
||||
public void OnStateExited(GameplayState state)
|
||||
@@ -80,19 +98,12 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
|
||||
|
||||
_admin.AdminStatusUpdated -= AdminStatusUpdated;
|
||||
|
||||
if (_adminButton != null)
|
||||
{
|
||||
_adminButton.Pressed = false;
|
||||
_adminButton.OnPressed -= AdminButtonPressed;
|
||||
_adminButton = null;
|
||||
}
|
||||
|
||||
CommandBinds.Unregister<AdminUIController>();
|
||||
}
|
||||
|
||||
private void AdminStatusUpdated()
|
||||
{
|
||||
_adminButton!.Visible = _conGroups.CanAdminMenu();
|
||||
AdminButton!.Visible = _conGroups.CanAdminMenu();
|
||||
}
|
||||
|
||||
private void AdminButtonPressed(ButtonEventArgs args)
|
||||
|
||||
Reference in New Issue
Block a user