Files
crystall-punk-14/Content.Client/Ame/UI/AmeControllerBoundUserInterface.cs

45 lines
1.3 KiB
C#
Raw Permalink Normal View History

using Content.Shared.Ame.Components;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
2023-06-28 05:02:06 -07:00
namespace Content.Client.Ame.UI
{
[UsedImplicitly]
2023-06-28 05:02:06 -07:00
public sealed class AmeControllerBoundUserInterface : BoundUserInterface
{
2023-06-28 05:02:06 -07:00
private AmeWindow? _window;
2023-07-08 09:02:17 -07:00
public AmeControllerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_window = this.CreateWindow<AmeWindow>();
_window.OnAmeButton += ButtonPressed;
}
/// <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;
_window?.UpdateState(castState); //Update window state
}
2023-06-28 05:02:06 -07:00
public void ButtonPressed(UiButton button)
{
SendMessage(new UiButtonPressedMessage(button));
}
}
}