Files

53 lines
1.5 KiB
C#
Raw Permalink Normal View History

2024-02-20 14:28:01 +03:00
using Content.Client.Eui;
2024-02-23 18:52:03 +03:00
using Content.Shared._Amour.InteractionPanel;
2024-02-20 14:28:01 +03:00
using Content.Shared.Eui;
namespace Content.Client._Amour.InteractionPanel;
public sealed class InteractionPanelEui : BaseEui
{
2024-02-23 18:52:03 +03:00
private readonly IEntityManager _entityManager;
private UI.InteractionPanelWindow _interactionPanelWindow;
private InteractionState _interactionState = default!;
2024-02-20 14:28:01 +03:00
public InteractionPanelEui()
{
2024-02-23 18:52:03 +03:00
IoCManager.InjectDependencies(this);
_entityManager = IoCManager.Resolve<IEntityManager>();
_interactionPanelWindow = new UI.InteractionPanelWindow();
2024-02-20 14:28:01 +03:00
_interactionPanelWindow.OnClose += () => SendMessage(new CloseEuiMessage());
2024-02-23 18:52:03 +03:00
_interactionPanelWindow.OnInteraction += InteractionPanelWindowOnInteraction;
2024-02-26 21:43:11 +03:00
_interactionPanelWindow.OnUpdateRequired += () => SendMessage(new InteractionUpdateMessage());
2024-02-23 18:52:03 +03:00
}
private void InteractionPanelWindowOnInteraction(string id)
{
SendMessage(new InteractionSelectedMessage(id));
}
public override void HandleState(EuiStateBase state)
{
base.HandleState(state);
if(state is not InteractionState interactionState)
2024-02-23 18:52:03 +03:00
return;
_interactionState = interactionState;
_interactionPanelWindow.Update(_interactionState);
2024-02-20 14:28:01 +03:00
}
public override void Closed()
{
base.Closed();
_interactionPanelWindow.Close();
}
public override void Opened()
{
base.Opened();
_interactionPanelWindow.OpenCentered();
}
}