* delete skill trees
* Revert "delete skill trees"
This reverts commit 9d7fae73c4.
* learning refactor
* UI tweaks
* sword mastery skill
* telegraphy
* rapier mastery
* research table ui
* finish studing
* polish UI researching
* pyrokinetic
* more skill tree working
* heat adapt
* alchemist and metamagic update
* skill multiple effects support + metamagic bugg manapool
* impossible 😢
* skimitar gaming
* skimidi
* blacksmithing branch
* remove research restrictions
* remove species magic buff
* fix loc
* Update thaumaturgy.yml
* pip
* Delete skill_tree.yml
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
/*
|
|
* This file is sublicensed under MIT License
|
|
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
|
|
*/
|
|
|
|
using Content.Shared._CP14.Workbench;
|
|
using Content.Shared._CP14.Workbench.Prototypes;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client._CP14.Workbench;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CP14WorkbenchRecipeControl : Control
|
|
{
|
|
[Dependency] private readonly IEntityManager _entity = default!;
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
public event Action<CP14WorkbenchUiRecipesEntry, CP14WorkbenchRecipePrototype>? OnSelect;
|
|
|
|
private readonly SpriteSystem _sprite;
|
|
|
|
private readonly CP14WorkbenchRecipePrototype _recipePrototype;
|
|
private readonly bool _craftable;
|
|
|
|
public CP14WorkbenchRecipeControl(CP14WorkbenchUiRecipesEntry entry)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
_sprite = _entity.System<SpriteSystem>();
|
|
|
|
_recipePrototype = _prototype.Index(entry.ProtoId);
|
|
_craftable = entry.Craftable;
|
|
|
|
Button.OnPressed += _ => OnSelect?.Invoke(entry, _recipePrototype);
|
|
|
|
UpdateColor();
|
|
UpdateName();
|
|
UpdateView();
|
|
}
|
|
|
|
private void UpdateColor()
|
|
{
|
|
if (_craftable)
|
|
return;
|
|
|
|
Button.ModulateSelfOverride = Color.FromHex("#302622");
|
|
}
|
|
|
|
private void UpdateName()
|
|
{
|
|
var result = _prototype.Index(_recipePrototype.Result);
|
|
var counter = _recipePrototype.ResultCount > 1 ? $" x{_recipePrototype.ResultCount}" : "";
|
|
Name.Text = $"{Loc.GetString(result.Name)} {counter}" ;
|
|
}
|
|
|
|
private void UpdateView()
|
|
{
|
|
View.SetPrototype(_recipePrototype.Result);
|
|
}
|
|
}
|