2021-06-09 22:19:39 +02:00
|
|
|
|
using Robust.Client.GameObjects;
|
2024-07-21 14:48:13 +10:00
|
|
|
|
using Robust.Client.UserInterface;
|
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-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
|
|
|
|
|
2024-07-21 14:48:13 +10:00
|
|
|
|
_menu = this.CreateWindow<SpaceVillainArcadeMenu>();
|
2024-07-26 13:30:49 -04:00
|
|
|
|
_menu.OnPlayerAction += SendAction;
|
2023-06-15 04:25:25 -07:00
|
|
|
|
}
|
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
|
|
|
|
}
|