* Added a toggle fullscreen button (default F11) * Removed un-needed comments * Review Requested Changes * Fixed Acidental Spacing Change * bwoink, removed extraneous code * nothing, litterally
70 lines
1.6 KiB
C#
70 lines
1.6 KiB
C#
using Content.Client.Options.UI;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.UserInterface.Controllers;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Client.UserInterface.Systems.EscapeMenu;
|
|
|
|
[UsedImplicitly]
|
|
public sealed class OptionsUIController : UIController
|
|
{
|
|
[Dependency] private readonly IConsoleHost _con = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
_con.RegisterCommand("options", Loc.GetString("cmd-options-desc"), Loc.GetString("cmd-options-help"), OptionsCommand);
|
|
}
|
|
|
|
private void OptionsCommand(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length == 0)
|
|
{
|
|
ToggleWindow();
|
|
return;
|
|
}
|
|
OpenWindow();
|
|
|
|
if (!int.TryParse(args[0], out var tab))
|
|
{
|
|
shell.WriteError(Loc.GetString("cmd-parse-failure-int", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
_optionsWindow.Tabs.CurrentTab = tab;
|
|
}
|
|
|
|
private OptionsMenu _optionsWindow = default!;
|
|
|
|
private void EnsureWindow()
|
|
{
|
|
if (_optionsWindow is { Disposed: false })
|
|
return;
|
|
|
|
_optionsWindow = UIManager.CreateWindow<OptionsMenu>();
|
|
}
|
|
|
|
public void OpenWindow()
|
|
{
|
|
EnsureWindow();
|
|
|
|
_optionsWindow.UpdateTabs();
|
|
|
|
_optionsWindow.OpenCentered();
|
|
_optionsWindow.MoveToFront();
|
|
}
|
|
|
|
public void ToggleWindow()
|
|
{
|
|
EnsureWindow();
|
|
|
|
if (_optionsWindow.IsOpen)
|
|
{
|
|
_optionsWindow.Close();
|
|
}
|
|
else
|
|
{
|
|
OpenWindow();
|
|
}
|
|
}
|
|
}
|