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:
@@ -52,7 +52,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
private ActionsWindow? _window;
|
||||
|
||||
private ActionsBar? _actionsBar;
|
||||
private MenuButton? _actionButton;
|
||||
private MenuButton? ActionButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.ActionButton;
|
||||
private ActionPage CurrentPage => _pages[_currentPageIndex];
|
||||
|
||||
public bool IsDragging => _menuDragHelper.IsDragging;
|
||||
@@ -88,7 +88,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
DebugTools.Assert(_window == null);
|
||||
|
||||
_window = UIManager.CreateWindow<ActionsWindow>();
|
||||
_actionButton = UIManager.GetActiveUIWidget<MenuBar.Widgets.GameTopMenuBar>().ActionButton;
|
||||
_actionsBar = UIManager.GetActiveUIWidget<ActionsBar>();
|
||||
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
||||
|
||||
@@ -97,7 +96,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
_window.ClearButton.OnPressed += OnClearPressed;
|
||||
_window.SearchBar.OnTextChanged += OnSearchChanged;
|
||||
_window.FilterButton.OnItemSelected += OnFilterSelected;
|
||||
_actionButton.OnPressed += ActionButtonPressed;
|
||||
_actionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed;
|
||||
_actionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
|
||||
|
||||
@@ -146,16 +144,36 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
.Register<ActionUIController>();
|
||||
}
|
||||
|
||||
public void UnloadButton()
|
||||
{
|
||||
if (ActionButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ActionButton.OnPressed -= ActionButtonPressed;
|
||||
}
|
||||
|
||||
public void LoadButton()
|
||||
{
|
||||
if (ActionButton == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ActionButton.OnPressed += ActionButtonPressed;
|
||||
}
|
||||
|
||||
private void OnWindowOpened()
|
||||
{
|
||||
if (_actionButton != null)
|
||||
_actionButton.Pressed = true;
|
||||
if (ActionButton != null)
|
||||
ActionButton.Pressed = true;
|
||||
}
|
||||
|
||||
private void OnWindowClosed()
|
||||
{
|
||||
if (_actionButton != null)
|
||||
_actionButton.Pressed = false;
|
||||
if (ActionButton != null)
|
||||
ActionButton.Pressed = false;
|
||||
}
|
||||
|
||||
public void OnStateExited(GameplayState state)
|
||||
@@ -186,12 +204,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
_actionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
|
||||
}
|
||||
|
||||
if (_actionButton != null)
|
||||
{
|
||||
_actionButton.OnPressed -= ActionButtonPressed;
|
||||
_actionButton.Pressed = false;
|
||||
}
|
||||
|
||||
CommandBinds.Unregister<ActionUIController>();
|
||||
}
|
||||
|
||||
@@ -607,12 +619,37 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
_dragShadow.Visible = false;
|
||||
}
|
||||
|
||||
public void ReloadActionContainer()
|
||||
{
|
||||
RegisterActionContainer();
|
||||
}
|
||||
|
||||
public void RegisterActionContainer()
|
||||
{
|
||||
if (UIManager.ActiveScreen == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var widget = UIManager.ActiveScreen.GetWidget<ActionsBar>();
|
||||
if (widget == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_actionsSystem?.UnlinkAllActions();
|
||||
|
||||
RegisterActionContainer(widget.ActionsContainer);
|
||||
|
||||
_actionsSystem?.LinkAllActions();
|
||||
}
|
||||
|
||||
public void RegisterActionContainer(ActionButtonContainer container)
|
||||
{
|
||||
if (_container != null)
|
||||
{
|
||||
Logger.Warning("Action container already defined for UI controller");
|
||||
return;
|
||||
_container.ActionPressed -= OnActionPressed;
|
||||
_container.ActionUnpressed -= OnActionPressed;
|
||||
}
|
||||
|
||||
_container = container;
|
||||
|
||||
Reference in New Issue
Block a user