2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Client.GameObjects;
|
2021-12-03 14:17:01 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
2019-11-25 00:11:47 +01:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Instruments.UI
|
2019-11-25 00:11:47 +01:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class InstrumentBoundUserInterface : BoundUserInterface
|
2019-11-25 00:11:47 +01:00
|
|
|
{
|
|
|
|
|
[ViewVariables]
|
2021-03-10 14:48:29 +01:00
|
|
|
private InstrumentMenu? _instrumentMenu;
|
2019-11-25 00:11:47 +01:00
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
public InstrumentComponent? Instrument { get; set; }
|
2019-11-25 00:11:47 +01:00
|
|
|
|
2022-08-21 05:38:30 +12:00
|
|
|
public InstrumentBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
2019-11-25 00:11:47 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<InstrumentComponent?>(Owner.Owner, out var instrument)) return;
|
2019-11-25 00:11:47 +01:00
|
|
|
|
|
|
|
|
Instrument = instrument;
|
|
|
|
|
_instrumentMenu = new InstrumentMenu(this);
|
|
|
|
|
_instrumentMenu.OnClose += Close;
|
|
|
|
|
|
|
|
|
|
_instrumentMenu.OpenCentered();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
base.Dispose(disposing);
|
|
|
|
|
if (!disposing) return;
|
|
|
|
|
_instrumentMenu?.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|