diff --git a/Content.Client/_Sunrise/CodeConsole/CodeConsoleBoundUserInterface.cs b/Content.Client/_Sunrise/CodeConsole/CodeConsoleBoundUserInterface.cs new file mode 100644 index 0000000000..978f0b25f8 --- /dev/null +++ b/Content.Client/_Sunrise/CodeConsole/CodeConsoleBoundUserInterface.cs @@ -0,0 +1,62 @@ +using Content.Shared._Sunrise.CodeConsole; +using JetBrains.Annotations; +using Robust.Client.UserInterface; + +namespace Content.Client._Sunrise.CodeConsole; + +[UsedImplicitly] +public sealed class CodeConsoleBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private CodeConsoleMenu? _menu; + + public CodeConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _menu = this.CreateWindow(); + + _menu.OnKeypadButtonPressed += i => + { + SendMessage(new CodeConsoleKeypadMessage(i)); + }; + _menu.OnEnterButtonPressed += () => + { + SendMessage(new CodeConsoleKeypadEnterMessage()); + }; + _menu.OnClearButtonPressed += () => + { + SendMessage(new CodeConsoleKeypadClearMessage()); + }; + + _menu.ActivateButton.OnPressed += _ => + { + SendMessage(new CodeConsoleActivateButtonMessage()); + }; + _menu.LockButton.OnPressed += _ => + { + SendMessage(new CodeConsoleLockButtonMessage()); + }; + + _menu.OnClose += Close; + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (_menu == null) + return; + + switch (state) + { + case CodeConsoleUiState msg: + _menu.UpdateState(msg); + break; + } + } +} diff --git a/Content.Client/_Sunrise/CodeConsole/CodeConsoleMenu.xaml b/Content.Client/_Sunrise/CodeConsole/CodeConsoleMenu.xaml new file mode 100644 index 0000000000..22aa3a0391 --- /dev/null +++ b/Content.Client/_Sunrise/CodeConsole/CodeConsoleMenu.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + +