* Initial Commit * Unfinished * Continuing, more abilities * Remove necromicon healing * oops * Continuing * Continuing * Checkpoint incase i need to undo something * Rewrite to use event per power, working passives * refactor fixes * so many fixes * some fixes * some fixes * new textures, status icon * vampire antag role, mind role * проверку на дауна вызывали?(если Null, у сервера ступор головного фатала) * fix 1 * fix 2 * fix fatal, fix build * breafing audio * fix icons style, store in action * clear store things, add gamerule, mid round game rule * some rework * clear any store systems * clear x2 * if you have 150 Blood Essence, you get mutation * upd * some changes * simple mutation menu * я вот сижу, в 12 ночи, пишу какую-то очередную хуйню, вместо приятного сна... * upd * normal mutations menu * actions translate * None type, base actions list * passive abilities * ability earning * fix * translate vampire preset * translate vampire mutations menu * mutations menu textures * disable some * ДРАНЫЙ БРИФ ФАТАЛКУ ПО ПРИКОЛУ БЕЕМ * game preset * mutation can infinity changed * fix * fully rework abilities update system * gargantua info * update ignore list * fix gargantua passives * vampire objectives * new icons * balance * fix * upd objectives * fix metabolizer type, balance 2 * fix metabolizer type 2 * fix syntax * clear translation * xd * update * round end info * fix * drain objective fix * fix * fix syntax * fix * clear --------- Co-authored-by: Rainfey <rainfey0+github@gmail.com>
92 lines
No EOL
3.4 KiB
C#
92 lines
No EOL
3.4 KiB
C#
using System.Numerics;
|
|
using Content.Client.Stylesheets;
|
|
using Content.Shared.Vampire;
|
|
using Content.Shared.Vampire.Components;
|
|
using Content.Client.Resources;
|
|
using Robust.Client.ResourceManagement;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Vampire;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class VampireMutationMenu : DefaultWindow
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
private IResourceCache _resourceCache;
|
|
private readonly SpriteSystem _sprite;
|
|
public event Action<VampireMutationsType>? OnIdSelected;
|
|
|
|
private HashSet<VampireMutationsType> _possibleMutations = new();
|
|
private VampireMutationsType _selectedId;
|
|
|
|
public VampireMutationMenu()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
_sprite = _entityManager.System<SpriteSystem>();
|
|
_resourceCache = IoCManager.Resolve<IResourceCache>();
|
|
}
|
|
|
|
public void UpdateState(HashSet<VampireMutationsType> mutationList, VampireMutationsType selectedMutation)
|
|
{
|
|
_possibleMutations = mutationList;
|
|
_selectedId = selectedMutation;
|
|
UpdateGrid();
|
|
}
|
|
|
|
private void UpdateGrid()
|
|
{
|
|
ClearGrid();
|
|
|
|
var group = new ButtonGroup();
|
|
|
|
foreach (var Mutation in _possibleMutations)
|
|
{
|
|
//if (!_prototypeManager.TryIndex("NormalBlobTile", out EntityPrototype? proto))
|
|
// continue;
|
|
|
|
string texturePath = Mutation switch
|
|
{
|
|
VampireMutationsType.None => "/Textures/Interface/Actions/actions_vampire.rsi/deathsembrace.png",
|
|
VampireMutationsType.Hemomancer => "/Textures/Interface/Actions/actions_vampire.rsi/hemomancer.png",
|
|
VampireMutationsType.Umbrae => "/Textures/Interface/Actions/actions_vampire.rsi/umbrae.png",
|
|
VampireMutationsType.Gargantua => "/Textures/Interface/Actions/actions_vampire.rsi/gargantua.png",
|
|
VampireMutationsType.Dantalion => "/Textures/Interface/Actions/actions_vampire.rsi/dantalion.png",
|
|
VampireMutationsType.Bestia => "/Textures/Interface/Actions/actions_vampire.rsi/bestia.png",
|
|
_ => "/Textures/Interface/Actions/actions_vampire.rsi/deathsembrace.png"
|
|
};
|
|
|
|
var button = new Button
|
|
{
|
|
MinSize = new Vector2(64, 64),
|
|
HorizontalExpand = true,
|
|
Group = group,
|
|
StyleClasses = {StyleBase.ButtonSquare},
|
|
ToggleMode = true,
|
|
Pressed = _selectedId == Mutation,
|
|
ToolTip = Loc.GetString($"vampire-mutation-{Mutation.ToString().ToLower()}-info"),
|
|
TooltipDelay = 0.01f,
|
|
};
|
|
button.OnPressed += _ => OnIdSelected?.Invoke(Mutation);
|
|
Grid.AddChild(button);
|
|
|
|
var texture = _resourceCache.GetTexture(texturePath);
|
|
button.AddChild(new TextureRect
|
|
{
|
|
Stretch = TextureRect.StretchMode.KeepAspectCentered,
|
|
Texture = texture,
|
|
});
|
|
}
|
|
}
|
|
|
|
private void ClearGrid()
|
|
{
|
|
Grid.RemoveAllChildren();
|
|
}
|
|
} |