2021-06-09 22:19:39 +02:00
|
|
|
|
using Robust.Client.GameObjects;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-09-23 14:30:31 +02:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent;
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
namespace Content.Client.Arcade.UI;
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
public sealed class SpaceVillainArcadeBoundUserInterface : BoundUserInterface
|
|
|
|
|
|
{
|
|
|
|
|
|
[ViewVariables] private SpaceVillainArcadeMenu? _menu;
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
//public SharedSpaceVillainArcadeComponent SpaceVillainArcade;
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
|
public SpaceVillainArcadeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2023-06-15 04:25:25 -07:00
|
|
|
|
{
|
|
|
|
|
|
SendAction(PlayerAction.RequestData);
|
|
|
|
|
|
}
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
public void SendAction(PlayerAction action)
|
|
|
|
|
|
{
|
|
|
|
|
|
SendMessage(new SpaceVillainArcadePlayerActionMessage(action));
|
|
|
|
|
|
}
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
protected override void Open()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Open();
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
_menu = new SpaceVillainArcadeMenu(this);
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
_menu.OnClose += Close;
|
|
|
|
|
|
_menu.OpenCentered();
|
|
|
|
|
|
}
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (message is SpaceVillainArcadeDataUpdateMessage msg)
|
|
|
|
|
|
_menu?.UpdateInfo(msg);
|
|
|
|
|
|
}
|
2020-09-23 14:30:31 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Dispose(disposing);
|
2020-10-06 10:16:42 +02:00
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
|
if (disposing)
|
|
|
|
|
|
_menu?.Dispose();
|
2020-09-23 14:30:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|