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

55 lines
1.5 KiB
C#
Raw Normal View History

using Content.Shared.Ame.Components;
using JetBrains.Annotations;
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();
2023-06-28 05:02:06 -07:00
_window = new AmeWindow(this);
_window.OnClose += Close;
_window.OpenCentered();
}
/// <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));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_window?.Dispose();
}
}
}
}