69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared._NF.Bank;
|
|
using Content.Shared._NF.Contraband.Components;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client._NF.Contraband.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class ContrabandPalletMenu : FancyWindow
|
|
{
|
|
public Action? SellRequested;
|
|
public Action? AppraiseRequested;
|
|
|
|
private string _locPrefix = string.Empty;
|
|
|
|
public ContrabandPalletMenu()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
SellButton.OnPressed += OnSellPressed;
|
|
AppraiseButton.OnPressed += OnAppraisePressed;
|
|
|
|
}
|
|
|
|
public void SetWindowText(string locPrefix)
|
|
{
|
|
_locPrefix = locPrefix ?? string.Empty;
|
|
|
|
Title = Loc.GetString($"{_locPrefix}contraband-pallet-console-menu-title");
|
|
|
|
if (!string.IsNullOrEmpty(_locPrefix))
|
|
{
|
|
AppraisalLabelLeft.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-appraisal-label");
|
|
AppraisalLabel.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-no-goods-text");
|
|
CountLabelLeft.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-count-label");
|
|
CountLabel.Text = Loc.GetString($"{_locPrefix}contraband-pallet-menu-no-goods-text");
|
|
AppraiseButton.Text = Loc.GetString($"{_locPrefix}contraband-pallet-appraise-button");
|
|
SellButton.Text = Loc.GetString($"{_locPrefix}contraband-pallet-sell-button");
|
|
}
|
|
}
|
|
|
|
public void SetAppraisal(int amount)
|
|
{
|
|
// TODO: switch currency function by currency in component
|
|
AppraisalLabel.Text = Loc.GetString($"{_locPrefix}contraband-console-menu-points-amount", ("amount", BankSystemExtensions.ToIndependentString(amount)));
|
|
}
|
|
|
|
public void SetCount(int count)
|
|
{
|
|
CountLabel.Text = count.ToString();
|
|
}
|
|
public void SetEnabled(bool enabled)
|
|
{
|
|
AppraiseButton.Disabled = !enabled;
|
|
SellButton.Disabled = !enabled;
|
|
}
|
|
|
|
private void OnSellPressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
SellRequested?.Invoke();
|
|
}
|
|
|
|
private void OnAppraisePressed(BaseButton.ButtonEventArgs obj)
|
|
{
|
|
AppraiseRequested?.Invoke();
|
|
}
|
|
}
|