2020-08-16 05:38:35 +02:00
|
|
|
|
using Robust.Client.Console;
|
2019-05-14 15:19:41 +02:00
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
|
using Robust.Client.UserInterface.CustomControls;
|
2020-02-08 20:45:02 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2019-07-19 12:40:28 +02:00
|
|
|
|
using Robust.Shared.Localization;
|
2019-05-14 15:19:41 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.UserInterface
|
|
|
|
|
|
{
|
|
|
|
|
|
internal sealed class EscapeMenu : SS14Window
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IClientConsole _console;
|
|
|
|
|
|
|
2020-08-06 11:35:32 +00:00
|
|
|
|
private BaseButton DisconnectButton;
|
2019-05-14 15:19:41 +02:00
|
|
|
|
private BaseButton QuitButton;
|
|
|
|
|
|
private BaseButton OptionsButton;
|
|
|
|
|
|
private OptionsMenu optionsMenu;
|
|
|
|
|
|
|
2020-09-17 09:55:50 +12:00
|
|
|
|
public EscapeMenu(IClientConsole console)
|
2019-05-14 15:19:41 +02:00
|
|
|
|
{
|
|
|
|
|
|
_console = console;
|
|
|
|
|
|
|
2020-02-08 20:45:02 +01:00
|
|
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
|
|
|
2019-05-14 15:19:41 +02:00
|
|
|
|
PerformLayout();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void PerformLayout()
|
|
|
|
|
|
{
|
2020-09-07 12:23:10 +02:00
|
|
|
|
optionsMenu = new OptionsMenu();
|
2019-05-14 15:19:41 +02:00
|
|
|
|
|
|
|
|
|
|
Resizable = false;
|
|
|
|
|
|
|
2020-08-07 01:46:01 +00:00
|
|
|
|
Title = "Esc Menu";
|
2019-05-14 15:19:41 +02:00
|
|
|
|
|
2020-08-06 11:35:32 +00:00
|
|
|
|
var vBox = new VBoxContainer {SeparationOverride = 4};
|
2019-05-14 15:19:41 +02:00
|
|
|
|
Contents.AddChild(vBox);
|
|
|
|
|
|
|
2020-09-17 09:55:50 +12:00
|
|
|
|
OptionsButton = new Button {Text = Loc.GetString("Options")};
|
2019-05-14 15:19:41 +02:00
|
|
|
|
OptionsButton.OnPressed += OnOptionsButtonClicked;
|
|
|
|
|
|
vBox.AddChild(OptionsButton);
|
|
|
|
|
|
|
2020-09-17 09:55:50 +12:00
|
|
|
|
DisconnectButton = new Button {Text = Loc.GetString("Disconnect")};
|
2020-08-06 11:35:32 +00:00
|
|
|
|
DisconnectButton.OnPressed += OnDisconnectButtonClicked;
|
|
|
|
|
|
vBox.AddChild(DisconnectButton);
|
|
|
|
|
|
|
2020-09-17 09:55:50 +12:00
|
|
|
|
QuitButton = new Button {Text = Loc.GetString("Quit Game")};
|
2019-05-14 15:19:41 +02:00
|
|
|
|
QuitButton.OnPressed += OnQuitButtonClicked;
|
|
|
|
|
|
vBox.AddChild(QuitButton);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
|
2020-08-06 11:35:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
_console.ProcessCommand("quit");
|
|
|
|
|
|
Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnDisconnectButtonClicked(BaseButton.ButtonEventArgs args)
|
2019-05-14 15:19:41 +02:00
|
|
|
|
{
|
|
|
|
|
|
_console.ProcessCommand("disconnect");
|
|
|
|
|
|
Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnOptionsButtonClicked(BaseButton.ButtonEventArgs args)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionsMenu.OpenCentered();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
|
if (disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
optionsMenu.Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|