This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,808 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Content.Client.Bank.UI; | ||
using Content.Shared.Bank.BUI; | ||
using Content.Shared.Bank.Events; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Cargo.BUI; | ||
|
||
public sealed class BankATMMenuBoundUserInterface : BoundUserInterface | ||
{ | ||
private BankATMMenu? _menu; | ||
|
||
public BankATMMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new BankATMMenu(); | ||
_menu.WithdrawRequest += OnWithdraw; | ||
_menu.DepositRequest += OnDeposit; | ||
_menu.OnClose += Close; | ||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (disposing) | ||
{ | ||
_menu?.Dispose(); | ||
} | ||
} | ||
|
||
private void OnWithdraw() | ||
{ | ||
if (_menu?.Amount is not int amount) | ||
return; | ||
|
||
SendMessage(new BankWithdrawMessage(amount)); | ||
} | ||
|
||
private void OnDeposit() | ||
{ | ||
SendMessage(new BankDepositMessage()); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not BankATMMenuInterfaceState bankState) | ||
return; | ||
|
||
_menu?.SetEnabled(bankState.Enabled); | ||
_menu?.SetBalance(bankState.Balance); | ||
_menu?.SetDeposit(bankState.Deposit); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
Content.Client/Bank/BUI/StationBankATMMenuBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Content.Client.Bank.UI; | ||
using Content.Shared.Bank.BUI; | ||
using Content.Shared.Bank.Events; | ||
using Robust.Client.GameObjects; | ||
using Content.Shared.Access.Systems; | ||
|
||
namespace Content.Client.Cargo.BUI; | ||
|
||
public sealed class StationBankATMMenuBoundUserInterface : BoundUserInterface | ||
{ | ||
private StationBankATMMenu? _menu; | ||
|
||
public StationBankATMMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new StationBankATMMenu(); | ||
_menu.WithdrawRequest += OnWithdraw; | ||
_menu.DepositRequest += OnDeposit; | ||
_menu.OnClose += Close; | ||
_menu.PopulateReasons(); | ||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (disposing) | ||
{ | ||
_menu?.Dispose(); | ||
} | ||
} | ||
|
||
private void OnWithdraw() | ||
{ | ||
if (_menu?.Amount is not int amount) | ||
return; | ||
|
||
SendMessage(new StationBankWithdrawMessage(amount, _menu.Reason, _menu.Description)); | ||
} | ||
|
||
private void OnDeposit() | ||
{ | ||
if (_menu?.Amount is not int amount) | ||
return; | ||
|
||
SendMessage(new StationBankDepositMessage(amount, _menu.Reason, _menu.Description)); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not StationBankATMMenuInterfaceState bankState) | ||
return; | ||
|
||
_menu?.SetEnabled(bankState.Enabled); | ||
_menu?.SetBalance(bankState.Balance); | ||
_menu?.SetDeposit(bankState.Deposit); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
Content.Client/Bank/BUI/WithdrawlBankATMMenuBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Content.Client.Bank.UI; | ||
using Content.Shared.Bank.BUI; | ||
using Content.Shared.Bank.Events; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.Cargo.BUI; | ||
|
||
public sealed class WithdrawBankATMMenuBoundUserInterface : BoundUserInterface | ||
{ | ||
private WithdrawBankATMMenu? _menu; | ||
|
||
public WithdrawBankATMMenuBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new WithdrawBankATMMenu(); | ||
_menu.WithdrawRequest += OnWithdraw; | ||
_menu.OnClose += Close; | ||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (disposing) | ||
{ | ||
_menu?.Dispose(); | ||
} | ||
} | ||
|
||
private void OnWithdraw() | ||
{ | ||
if (_menu?.Amount is not int amount) | ||
return; | ||
|
||
SendMessage(new BankWithdrawMessage(amount)); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not BankATMMenuInterfaceState bankState) | ||
return; | ||
|
||
_menu?.SetEnabled(bankState.Enabled); | ||
_menu?.SetBalance(bankState.Balance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
SetSize="300 176" | ||
MinSize="300 176"> | ||
<BoxContainer Margin="10 2 10 2" Orientation="Vertical"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-menu-balance-label'}" | ||
StyleClasses="LabelKeyText" /> | ||
<Label Name="BalanceLabel" | ||
Text="{Loc 'bank-atm-menu-no-bank'}" /> | ||
</BoxContainer> | ||
<LineEdit Name="WithdrawEdit" MinSize="80 0" /> | ||
<Button Name="WithdrawButton" | ||
Text="{Loc 'bank-atm-menu-withdraw-button'}"/> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-menu-deposit-label'}" | ||
StyleClasses="LabelKeyText" /> | ||
<Label Name="DepositLabel" | ||
Text="{Loc 'bank-atm-menu-no-deposit'}" /> | ||
</BoxContainer> | ||
<Button Name="DepositButton" | ||
Text="{Loc 'bank-atm-menu-deposit-button'}"/> | ||
<TextureButton VerticalExpand="True" /> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.Bank.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class BankATMMenu : FancyWindow | ||
{ | ||
public Action? WithdrawRequest; | ||
public Action? DepositRequest; | ||
public int Amount; | ||
public BankATMMenu() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
WithdrawButton.OnPressed += OnWithdrawPressed; | ||
DepositButton.OnPressed += OnDepositPressed; | ||
Title = Loc.GetString("bank-atm-menu-title"); | ||
WithdrawEdit.OnTextChanged += OnAmountChanged; | ||
} | ||
|
||
public void SetBalance(int amount) | ||
{ | ||
BalanceLabel.Text = Loc.GetString("cargo-console-menu-points-amount", ("amount", amount.ToString())); | ||
} | ||
|
||
public void SetDeposit(int amount) | ||
{ | ||
DepositButton.Disabled = amount <= 0; | ||
DepositLabel.Text = Loc.GetString("cargo-console-menu-points-amount", ("amount", amount.ToString())); | ||
} | ||
|
||
public void SetEnabled(bool enabled) | ||
{ | ||
WithdrawButton.Disabled = !enabled; | ||
} | ||
|
||
private void OnWithdrawPressed(BaseButton.ButtonEventArgs obj) | ||
{ | ||
WithdrawRequest?.Invoke(); | ||
} | ||
|
||
private void OnDepositPressed(BaseButton.ButtonEventArgs obj) | ||
{ | ||
DepositRequest?.Invoke(); | ||
} | ||
|
||
private void OnAmountChanged(LineEdit.LineEditEventArgs args) | ||
{ | ||
if (int.TryParse(args.Text, out var amount)) | ||
{ | ||
Amount = amount; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
SetSize="480 230" | ||
MinSize="360 230"> | ||
<BoxContainer Margin="10 2 10 2" Orientation="Vertical"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-menu-balance-label'}" | ||
StyleClasses="LabelKeyText" /> | ||
<Label Name="BalanceLabel" | ||
Text="{Loc 'bank-atm-menu-no-bank'}" /> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-menu-amount-label'}" | ||
StyleClasses="LabelKeyText" | ||
MinSize="100 0" /> | ||
<LineEdit Name="WithdrawEdit" SetSize="120 30" HorizontalAlignment="Right"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-reason-label'}" | ||
StyleClasses="LabelKeyText" | ||
MinSize="100 0" /> | ||
<OptionButton Name="Reasons" | ||
HorizontalExpand="True"/> | ||
</BoxContainer> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-description-label'}" | ||
StyleClasses="LabelKeyText" | ||
MinSize="100 0" /> | ||
<LineEdit Name="AmountDescription" MinSize="120 0" HorizontalExpand="True"/> | ||
</BoxContainer> | ||
<Button Name="WithdrawButton" | ||
Text="{Loc 'bank-atm-menu-withdraw-button'}"/> | ||
<TextureButton VerticalExpand="True" /> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Text="{Loc 'bank-atm-menu-deposit-label'}" | ||
StyleClasses="LabelKeyText" /> | ||
<Label Name="DepositLabel" | ||
Text="{Loc 'bank-atm-menu-no-deposit'}" /> | ||
</BoxContainer> | ||
<Button Name="DepositButton" | ||
Text="{Loc 'bank-atm-menu-deposit-button'}"/> | ||
<TextureButton VerticalExpand="True" /> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
Oops, something went wrong.