diff --git a/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleBoundUserInterface.cs b/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleBoundUserInterface.cs new file mode 100644 index 00000000000..d416ff6e036 --- /dev/null +++ b/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleBoundUserInterface.cs @@ -0,0 +1,67 @@ +using Content.Client.UserInterface.Controls; +using Content.Shared._WF.SafetyDepositBox.BUI; +using Content.Shared._WF.SafetyDepositBox.Events; +using Robust.Client.UserInterface; +using Robust.Shared.Prototypes; + +namespace Content.Client._WF.SafetyDepositBox; + +public sealed class SafetyDepositConsoleBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private SafetyDepositConsoleWindow? _window; + + public SafetyDepositConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _window = this.CreateWindow(); + _window.Title = Loc.GetString("safety-deposit-console-title"); + _window.OnPurchasePressed += OnPurchasePressed; + _window.OnDepositPressed += OnDepositPressed; + _window.OnWithdrawPressed += OnWithdrawPressed; + _window.OnReclaimPressed += OnReclaimPressed; + } + + private void OnPurchasePressed(EntProtoId boxSize) + { + SendMessage(new SafetyDepositPurchaseMessage(boxSize)); + } + + private void OnDepositPressed() + { + SendMessage(new SafetyDepositDepositMessage()); + } + + private void OnWithdrawPressed(Guid boxId) + { + SendMessage(new SafetyDepositWithdrawMessage(boxId)); + } + + private void OnReclaimPressed(Guid boxId) + { + SendMessage(new SafetyDepositReclaimMessage(boxId)); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (state is not SafetyDepositConsoleState castState) + return; + + _window?.UpdateState(castState); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + _window?.Dispose(); + } +} diff --git a/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleWindow.xaml b/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleWindow.xaml new file mode 100644 index 00000000000..4f0fe88f292 --- /dev/null +++ b/Content.Client/_WF/SafetyDepositBox/SafetyDepositConsoleWindow.xaml @@ -0,0 +1,83 @@ + + + +