Merge more UI refactor stuff (#11277)
* Changelog+options ui controller * Sandbox UI controller * Escape menu UI controller
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using Content.Client.Options.UI;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.State;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
|
||||
namespace Content.Client.UserInterface.Systems.EscapeMenu;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class OptionsUIController : UIController
|
||||
{
|
||||
private OptionsMenu _optionsWindow = default!;
|
||||
|
||||
private void EnsureWindow()
|
||||
{
|
||||
if (_optionsWindow is { Disposed: false })
|
||||
return;
|
||||
|
||||
_optionsWindow = UIManager.CreateWindow<OptionsMenu>();
|
||||
}
|
||||
|
||||
public void OpenWindow()
|
||||
{
|
||||
EnsureWindow();
|
||||
|
||||
_optionsWindow.OpenCentered();
|
||||
_optionsWindow.MoveToFront();
|
||||
}
|
||||
|
||||
public void ToggleWindow()
|
||||
{
|
||||
EnsureWindow();
|
||||
|
||||
if (_optionsWindow.IsOpen)
|
||||
{
|
||||
_optionsWindow.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user