Spellblade update (#346)
* - tweak: Don't close eui too quickly. * - add: Spellblade update. * - fix: Cult teleport spell.
This commit is contained in:
@@ -3,23 +3,19 @@ using Content.Client._White.Cult.UI.TeleportRunesList;
|
||||
using Content.Client.Eui;
|
||||
using Content.Shared.Eui;
|
||||
using Content.Shared._White.Cult.UI;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Client._White.Cult.UI.TeleportSpell;
|
||||
|
||||
public sealed class TeleportSpellEui : BaseEui
|
||||
[UsedImplicitly]
|
||||
public sealed class CultTeleportSpellEui : BaseEui
|
||||
{
|
||||
|
||||
private TeleportRunesListWindow _window;
|
||||
|
||||
public TeleportSpellEui()
|
||||
{
|
||||
_window = new TeleportRunesListWindow();
|
||||
}
|
||||
private readonly TeleportRunesListWindow _window = new();
|
||||
|
||||
public override void Opened()
|
||||
{
|
||||
_window.OpenCentered();
|
||||
_window.ItemSelected += (index, _) => SendMessage(new TeleportSpellTargetRuneSelected(){RuneUid = index});
|
||||
_window.ItemSelected += (index, _) => SendMessage(new TeleportSpellTargetRuneSelected {RuneUid = index});
|
||||
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
||||
|
||||
base.Opened();
|
||||
@@ -33,7 +29,8 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
|
||||
public override void HandleState(EuiStateBase state)
|
||||
{
|
||||
if(state is not TeleportSpellEuiState cast) return;
|
||||
if (state is not CultTeleportSpellEuiState cast)
|
||||
return;
|
||||
|
||||
_window.Clear();
|
||||
_window.PopulateList(cast.Runes.Keys.ToList(), cast.Runes.Values.ToList());
|
||||
57
Content.Client/_White/Wizard/SpellBlade/SpellBladeBUI.cs
Normal file
57
Content.Client/_White/Wizard/SpellBlade/SpellBladeBUI.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Content.Client._White.UserInterface.Radial;
|
||||
using Content.Shared._White.Wizard.SpellBlade;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client._White.Wizard.SpellBlade;
|
||||
|
||||
[UsedImplicitly]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class SpellBladeBUI(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private RadialContainer? _aspectSelector;
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
if (!_entityManager.TryGetComponent(Owner, out SpellBladeComponent? spellBlade) ||
|
||||
spellBlade.ChosenAspect != string.Empty)
|
||||
return;
|
||||
|
||||
var spriteSystem = _entityManager.System<SpriteSystem>();
|
||||
_aspectSelector = new RadialContainer();
|
||||
|
||||
_aspectSelector.Closed += Close;
|
||||
|
||||
foreach (var aspect in spellBlade.Aspects)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(aspect, out var proto))
|
||||
continue;
|
||||
|
||||
var button = _aspectSelector.AddButton(proto.Name,
|
||||
spriteSystem.GetPrototypeIcon(proto).Default);
|
||||
button.Tooltip = proto.Description;
|
||||
|
||||
button.Controller.OnPressed += _ =>
|
||||
{
|
||||
SendMessage(new SpellBladeSystemMessage(aspect));
|
||||
_aspectSelector.Close();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
_aspectSelector.OpenAttachedLocalPlayer();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
_aspectSelector?.Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Content.Shared._White.Wizard.SpellBlade;
|
||||
|
||||
namespace Content.Client._White.Wizard.SpellBlade;
|
||||
|
||||
public sealed class SpellBladeSystem : SharedSpellBladeSystem
|
||||
{
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using JetBrains.Annotations;
|
||||
namespace Content.Client._White.Wizard.TeleportSpell;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class TeleportSpellEui : BaseEui
|
||||
public sealed class WizardTeleportSpellEui : BaseEui
|
||||
{
|
||||
private readonly TeleportRunesListWindow _window = new();
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
|
||||
public override void HandleState(EuiStateBase state)
|
||||
{
|
||||
if (state is not TeleportSpellEuiState cast)
|
||||
if (state is not WizardTeleportSpellEuiState cast)
|
||||
return;
|
||||
|
||||
_window.Clear();
|
||||
Reference in New Issue
Block a user