Files
wwdpublic/Content.Client/Research/UI/TechnologyCardControl.xaml.cs
Simon a5d56e183a Fix some markup related obsolete warnings in research and anomaly related systems (#30072)
Fix some Markup related obsolete warnings in Research and Anomaly related systems

(cherry picked from commit b35539db4a800559926a6e998b7f38e5cfc9365e)
2026-02-11 20:00:27 +03:00

41 lines
1.7 KiB
C#

using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Research.UI;
[GenerateTypedNameReferences]
public sealed partial class TechnologyCardControl : Control
{
public Action? OnPressed;
public TechnologyCardControl(TechnologyPrototype technology, IPrototypeManager prototypeManager, SpriteSystem spriteSys, FormattedMessage description, int points, float softCapMultiplier, bool hasAccess) // WD EDIT
{
RobustXamlLoader.Load(this);
var discipline = prototypeManager.Index<TechDisciplinePrototype>(technology.Discipline);
Background.ModulateSelfOverride = discipline.Color;
DisciplineTexture.Texture = spriteSys.Frame0(discipline.Icon);
TechnologyNameLabel.Text = Loc.GetString(technology.Name);
var message = new FormattedMessage();
message.AddMarkupOrThrow(Loc.GetString("research-console-tier-discipline-info",
("tier", technology.Tier), ("color", discipline.Color), ("discipline", Loc.GetString(discipline.Name))));
TierLabel.SetMessage(message);
UnlocksLabel.SetMessage(description);
TechnologyTexture.Texture = spriteSys.Frame0(technology.Icon);
if (!hasAccess)
ResearchButton.ToolTip = Loc.GetString("research-console-no-access-popup");
ResearchButton.Disabled = points < technology.Cost * softCapMultiplier || !hasAccess; // WD EDIT
ResearchButton.OnPressed += _ => OnPressed?.Invoke();
}
}