2024-02-29 22:44:28 +01:00
|
|
|
using Content.Shared.Ame.Components;
|
2020-12-08 11:56:10 +01:00
|
|
|
using JetBrains.Annotations;
|
2024-07-21 14:48:13 +10:00
|
|
|
using Robust.Client.UserInterface;
|
2020-08-29 06:05:44 -05:00
|
|
|
|
2023-06-28 05:02:06 -07:00
|
|
|
namespace Content.Client.Ame.UI
|
2020-08-29 06:05:44 -05:00
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
[UsedImplicitly]
|
2023-06-28 05:02:06 -07:00
|
|
|
public sealed class AmeControllerBoundUserInterface : BoundUserInterface
|
2020-08-29 06:05:44 -05:00
|
|
|
{
|
2023-06-28 05:02:06 -07:00
|
|
|
private AmeWindow? _window;
|
2020-08-29 06:05:44 -05:00
|
|
|
|
2023-07-08 09:02:17 -07:00
|
|
|
public AmeControllerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
2020-08-29 06:05:44 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Open()
|
|
|
|
|
{
|
|
|
|
|
base.Open();
|
|
|
|
|
|
2024-07-21 14:48:13 +10:00
|
|
|
_window = this.CreateWindow<AmeWindow>();
|
|
|
|
|
_window.OnAmeButton += ButtonPressed;
|
2020-08-29 06:05:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update the ui each time new state data is sent from the server.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="state">
|
|
|
|
|
/// Data of the <see cref="SharedReagentDispenserComponent"/> that this ui represents.
|
|
|
|
|
/// Sent from the server.
|
|
|
|
|
/// </param>
|
|
|
|
|
protected override void UpdateState(BoundUserInterfaceState state)
|
|
|
|
|
{
|
|
|
|
|
base.UpdateState(state);
|
|
|
|
|
|
2023-06-28 05:02:06 -07:00
|
|
|
var castState = (AmeControllerBoundUserInterfaceState) state;
|
2020-08-29 06:05:44 -05:00
|
|
|
_window?.UpdateState(castState); //Update window state
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-28 05:02:06 -07:00
|
|
|
public void ButtonPressed(UiButton button)
|
2020-08-29 06:05:44 -05:00
|
|
|
{
|
|
|
|
|
SendMessage(new UiButtonPressedMessage(button));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|