Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jabak
2024-06-13 09:07:23 +03:00
87 changed files with 1794 additions and 416 deletions

View 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();
}
}

View File

@@ -0,0 +1,7 @@
using Content.Shared._White.Wizard.SpellBlade;
namespace Content.Client._White.Wizard.SpellBlade;
public sealed class SpellBladeSystem : SharedSpellBladeSystem
{
}

View File

@@ -0,0 +1,39 @@
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]
public sealed class WizardTeleportSpellEui : BaseEui
{
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)
{
if (state is not WizardTeleportSpellEuiState cast)
return;
_window.Clear();
_window.PopulateList(cast.Locations.Keys.ToList(), cast.Locations.Values.ToList());
}
}