Files
crystall-punk-14/Content.Client/Cargo/BUI/CargoPalletConsoleBoundUserInterface.cs

49 lines
1.2 KiB
C#
Raw Permalink Normal View History

2023-03-13 16:36:35 -04:00
using Content.Client.Cargo.UI;
using Content.Shared.Cargo.BUI;
using Content.Shared.Cargo.Events;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
2023-03-13 16:36:35 -04:00
namespace Content.Client.Cargo.BUI;
public sealed class CargoPalletConsoleBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
2023-03-13 16:36:35 -04:00
private CargoPalletMenu? _menu;
2023-07-08 09:02:17 -07:00
public CargoPalletConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
2023-03-13 16:36:35 -04:00
protected override void Open()
{
base.Open();
_menu = this.CreateWindow<CargoPalletMenu>();
2023-03-13 16:36:35 -04:00
_menu.AppraiseRequested += OnAppraisal;
_menu.SellRequested += OnSell;
}
private void OnAppraisal()
{
SendMessage(new CargoPalletAppraiseMessage());
}
private void OnSell()
{
SendMessage(new CargoPalletSellMessage());
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not CargoPalletConsoleInterfaceState palletState)
return;
_menu?.SetEnabled(palletState.Enabled);
_menu?.SetAppraisal(palletState.Appraisal);
_menu?.SetCount(palletState.Count);
}
}