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, FormattedMessage itemList, int points, bool hasAccess, bool haveAllTargets) { RobustXamlLoader.Load(this); var discipline = prototypeManager.Index(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), // Horizon code design edit starts ("color", discipline.Color), ("discipline", Loc.GetString(discipline.Name)))); // Horizon code design edit ends TierLabel.SetMessage(message); UnlocksLabel.SetMessage(description); TargetLabel.SetMessage(itemList); // Horizon // Frontier: Handle technology icon - prioritize EntityIcon, fall back to Icon if (technology.EntityIcon.HasValue) { TechnologyTexture.Texture = spriteSys.GetPrototypeIcon(technology.EntityIcon.Value).Default; } else if (technology.Icon != null) { TechnologyTexture.Texture = spriteSys.Frame0(technology.Icon); } // End Frontier: If neither is available, the texture will remain null/empty if (!hasAccess) ResearchButton.ToolTip = Loc.GetString("research-console-no-access-popup"); ResearchButton.Disabled = points < technology.Cost || !hasAccess || !haveAllTargets; // Horizon ResearchButton.OnPressed += _ => OnPressed?.Invoke(); } }