Misc replay related changes (#17102)

This commit is contained in:
Leon Friedrich
2023-06-05 16:33:49 +12:00
committed by GitHub
parent 7d178555e1
commit a8eee5878a
14 changed files with 132 additions and 75 deletions

View File

@@ -108,18 +108,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_window == null);
_window = UIManager.CreateWindow<ActionsWindow>();
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
_window.OnOpen += OnWindowOpened;
_window.OnClose += OnWindowClosed;
_window.ClearButton.OnPressed += OnClearPressed;
_window.SearchBar.OnTextChanged += OnSearchChanged;
_window.FilterButton.OnItemSelected += OnFilterSelected;
if (_actionsSystem != null)
{
_actionsSystem.ActionAdded += OnActionAdded;
@@ -328,18 +316,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
_actionsSystem.ActionsUpdated -= OnActionsUpdated;
}
if (_window != null)
{
_window.OnOpen -= OnWindowOpened;
_window.OnClose -= OnWindowClosed;
_window.ClearButton.OnPressed -= OnClearPressed;
_window.SearchBar.OnTextChanged -= OnSearchChanged;
_window.FilterButton.OnItemSelected -= OnFilterSelected;
_window.Dispose();
_window = null;
}
CommandBinds.Unregister<ActionUIController>();
}
@@ -779,10 +755,32 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
ActionsBar.PageButtons.LeftArrow.OnPressed -= OnLeftArrowPressed;
ActionsBar.PageButtons.RightArrow.OnPressed -= OnRightArrowPressed;
if (_window != null)
{
_window.OnOpen -= OnWindowOpened;
_window.OnClose -= OnWindowClosed;
_window.ClearButton.OnPressed -= OnClearPressed;
_window.SearchBar.OnTextChanged -= OnSearchChanged;
_window.FilterButton.OnItemSelected -= OnFilterSelected;
_window.Dispose();
_window = null;
}
}
private void LoadGui()
{
DebugTools.Assert(_window == null);
_window = UIManager.CreateWindow<ActionsWindow>();
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
_window.OnOpen += OnWindowOpened;
_window.OnClose += OnWindowClosed;
_window.ClearButton.OnPressed += OnClearPressed;
_window.SearchBar.OnTextChanged += OnSearchChanged;
_window.FilterButton.OnItemSelected += OnFilterSelected;
if (ActionsBar == null)
{
return;
@@ -791,7 +789,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
ActionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed;
ActionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
RegisterActionContainer(ActionsBar.ActionsContainer);
_actionsSystem?.LinkAllActions();