Files
OldThink/Content.Client/Cargo/BUI/CargoShuttleConsoleBoundUserInterface.cs

51 lines
1.3 KiB
C#
Raw Permalink Normal View History

2022-06-23 14:36:47 +10:00
using Content.Client.Cargo.UI;
using Content.Shared.Cargo.BUI;
2023-03-23 16:10:49 +11:00
using JetBrains.Annotations;
2022-06-23 14:36:47 +10:00
using Robust.Client.GameObjects;
using Robust.Shared.Prototypes;
namespace Content.Client.Cargo.BUI;
2023-03-23 16:10:49 +11:00
[UsedImplicitly]
2022-06-23 14:36:47 +10:00
public sealed class CargoShuttleConsoleBoundUserInterface : BoundUserInterface
{
2023-07-08 09:02:17 -07:00
[ViewVariables]
2022-06-23 14:36:47 +10:00
private CargoShuttleMenu? _menu;
2023-07-08 09:02:17 -07:00
public CargoShuttleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
2022-06-23 14:36:47 +10:00
protected override void Open()
{
base.Open();
2022-10-04 14:24:19 +11:00
var collection = IoCManager.Instance;
2022-06-23 14:36:47 +10:00
2022-10-04 14:24:19 +11:00
if (collection == null)
return;
2023-03-23 16:10:49 +11:00
_menu = new CargoShuttleMenu(collection.Resolve<IPrototypeManager>(), collection.Resolve<IEntitySystemManager>().GetEntitySystem<SpriteSystem>());
2022-06-23 14:36:47 +10:00
_menu.OnClose += Close;
_menu.OpenCentered();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_menu?.Dispose();
}
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (state is not CargoShuttleConsoleBoundUserInterfaceState cargoState) return;
_menu?.SetAccountName(cargoState.AccountName);
_menu?.SetShuttleName(cargoState.ShuttleName);
_menu?.SetOrders(cargoState.Orders);
}
}