* Fix some bugs in stations and do a little cleanup. * Begin backporting the guidebook. * wow that's a lot of work. * More work, gives the monkey some more interactions. * disco monkye. * monky * jobs entry. * more writing. * disco * im being harassed * fix spacing. * i hate writing. * Update Resources/Prototypes/Entities/Mobs/NPCs/animals.yml Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> * builds again * a * pilfer changes from AL * fix and remove unused code * pilfer actual guide changes from AL * localization * more error logs & safety checks * replace controls button with command * add test * todos * pidgin parsing * remove old parser * Move files and change tree sorting * add localization and public methods. * Add help component/verb * rename ITag to IDocumentTag * Fix yml and tweak tooltips * autoclose tooltip * Split container * Fancier-tree * Hover color * txt to xml * oops * Curse you hidden merge conflicts * Rename parsing manager * Stricter arg parsing tag args must now be of the form key="value" * Change default args * Moar tests * nullable enable * Even fancier tree * extremely fancy trees * better indent icons * stricter xml and subheadings * tweak embed margin * Fix parsing bugs * quick fixes. * spain. * ogh * hn bmvdsyc Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
68 lines
1.5 KiB
C#
68 lines
1.5 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.OpenCentered();
|
|
_optionsWindow.MoveToFront();
|
|
}
|
|
|
|
public void ToggleWindow()
|
|
{
|
|
EnsureWindow();
|
|
|
|
if (_optionsWindow.IsOpen)
|
|
{
|
|
_optionsWindow.Close();
|
|
}
|
|
else
|
|
{
|
|
OpenWindow();
|
|
}
|
|
}
|
|
}
|