2024-06-09 16:26:27 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using Content.Client._White.Cult.UI.TeleportRunesList;
|
|
|
|
|
|
using Content.Client.Eui;
|
|
|
|
|
|
using Content.Shared._White.Wizard.Teleport;
|
|
|
|
|
|
using Content.Shared.Eui;
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client._White.Wizard.TeleportSpell;
|
|
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
2024-06-11 20:07:47 +00:00
|
|
|
|
public sealed class WizardTeleportSpellEui : BaseEui
|
2024-06-09 16:26:27 +00:00
|
|
|
|
{
|
|
|
|
|
|
private readonly TeleportRunesListWindow _window = new();
|
|
|
|
|
|
|
|
|
|
|
|
public override void Opened()
|
|
|
|
|
|
{
|
|
|
|
|
|
_window.OpenCentered();
|
|
|
|
|
|
_window.ItemSelected +=
|
|
|
|
|
|
(index, _) => SendMessage(new TeleportSpellTargetLocationSelected {LocationUid = index});
|
|
|
|
|
|
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
|
|
|
|
|
|
|
|
|
|
|
base.Opened();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Closed()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Closed();
|
|
|
|
|
|
_window.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void HandleState(EuiStateBase state)
|
|
|
|
|
|
{
|
2024-06-11 20:07:47 +00:00
|
|
|
|
if (state is not WizardTeleportSpellEuiState cast)
|
2024-06-09 16:26:27 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
_window.Clear();
|
|
|
|
|
|
_window.PopulateList(cast.Locations.Keys.ToList(), cast.Locations.Values.ToList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|