mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Content.Client.UserInterface.Systems.Info;
|
|
using Content.Shared.Input;
|
|
using JetBrains.Annotations;
|
|
using Robust.Client.Input;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controllers;
|
|
using Robust.Shared.Input;
|
|
using Robust.Shared.Input.Binding;
|
|
|
|
namespace Content.Client.UserInterface.Systems.EscapeMenu;
|
|
|
|
[UsedImplicitly]
|
|
public sealed partial class EscapeContextUIController : UIController
|
|
{
|
|
[Dependency] private IInputManager _inputManager = default!;
|
|
|
|
[Dependency] private CloseRecentWindowUIController _closeRecentWindowUIController = default!;
|
|
[Dependency] private EscapeUIController _escapeUIController = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
_inputManager.SetInputCommand(ContentKeyFunctions.EscapeContext,
|
|
InputCmdHandler.FromDelegate(_ => CloseWindowOrOpenGameMenu()));
|
|
}
|
|
|
|
private void CloseWindowOrOpenGameMenu()
|
|
{
|
|
if (_closeRecentWindowUIController.HasClosableWindow())
|
|
{
|
|
_closeRecentWindowUIController.CloseMostRecentWindow();
|
|
}
|
|
else
|
|
{
|
|
_escapeUIController.ToggleWindow();
|
|
}
|
|
}
|
|
}
|