diff --git a/Content.Client/Store/Ui/StoreMenu.xaml.cs b/Content.Client/Store/Ui/StoreMenu.xaml.cs index ae38be1115ad7e..260bcfe4f260fc 100644 --- a/Content.Client/Store/Ui/StoreMenu.xaml.cs +++ b/Content.Client/Store/Ui/StoreMenu.xaml.cs @@ -54,7 +54,7 @@ public void UpdateBalance(Dictionary, FixedPoint2> ba foreach (var ((_, amount), proto) in currency) { balanceStr += Loc.GetString("store-ui-balance-display", ("amount", amount), - ("currency", Loc.GetString(proto.DisplayName, ("amount", 1)))); + ("currency", Loc.GetString(proto.DisplayName, ("amount", 1)))) + "\n"; } BalanceInfo.SetMarkup(balanceStr.TrimEnd()); @@ -63,7 +63,10 @@ public void UpdateBalance(Dictionary, FixedPoint2> ba foreach (var type in currency) { if (type.Value.CanWithdraw && type.Value.Cash != null && type.Key.Item2 > 0) + { disabled = false; + break; + } } WithdrawButton.Disabled = disabled; diff --git a/Content.Client/Store/Ui/StoreWithdrawWindow.xaml.cs b/Content.Client/Store/Ui/StoreWithdrawWindow.xaml.cs index 793685575621b9..a8b93cd2b3a010 100644 --- a/Content.Client/Store/Ui/StoreWithdrawWindow.xaml.cs +++ b/Content.Client/Store/Ui/StoreWithdrawWindow.xaml.cs @@ -18,7 +18,7 @@ public sealed partial class StoreWithdrawWindow : DefaultWindow { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - private Dictionary _validCurrencies = new(); + private Dictionary _validCurrencies = new(); private HashSet _buttons = new(); public event Action? OnWithdrawAttempt; @@ -36,7 +36,7 @@ public void CreateCurrencyButtons(Dictionary, FixedPo if (!_prototypeManager.TryIndex(currency.Key, out var proto)) continue; - _validCurrencies.Add(currency.Value, proto); + _validCurrencies.Add(proto, currency.Value); } //this shouldn't ever happen but w/e @@ -47,14 +47,17 @@ public void CreateCurrencyButtons(Dictionary, FixedPo _buttons.Clear(); foreach (var currency in _validCurrencies) { + if (!currency.Key.CanWithdraw) + continue; + var button = new CurrencyWithdrawButton() { - Id = currency.Value.ID, - Amount = currency.Key, + Id = currency.Key.ID, + Amount = currency.Value, MinHeight = 20, - Text = Loc.GetString("store-withdraw-button-ui", ("currency",Loc.GetString(currency.Value.DisplayName, ("amount", currency.Key)))), + Text = Loc.GetString("store-withdraw-button-ui", ("currency",Loc.GetString(currency.Key.DisplayName, ("amount", currency.Value)))), + Disabled = false, }; - button.Disabled = false; button.OnPressed += args => { OnWithdrawAttempt?.Invoke(args, button.Id, WithdrawSlider.Value); @@ -65,7 +68,7 @@ public void CreateCurrencyButtons(Dictionary, FixedPo ButtonContainer.AddChild(button); } - var maxWithdrawAmount = _validCurrencies.Keys.Max().Int(); + var maxWithdrawAmount = _validCurrencies.Values.Max().Int(); // setup withdraw slider WithdrawSlider.MinValue = 1;