59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using Content.Shared.Research.Prototypes;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Client.Research.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class MiniTechnologyCardControl : Control
|
|
{
|
|
/// The technology that this control represents
|
|
public readonly TechnologyPrototype Technology;
|
|
|
|
public MiniTechnologyCardControl(TechnologyPrototype technology, IPrototypeManager prototypeManager, SpriteSystem spriteSys, FormattedMessage description)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
var discipline = prototypeManager.Index(technology.Discipline);
|
|
Background.ModulateSelfOverride = discipline.Color;
|
|
|
|
// Frontier: Handle technology icon - prioritize EntityIcon for full sprite layers, matching technology squares
|
|
if (technology.EntityIcon.HasValue)
|
|
{
|
|
TechnologyDisplay.SetPrototype(technology.EntityIcon.Value); // Feontier: Use EntityPrototypeView to show all sprite layers, same as technology squares
|
|
}
|
|
else if (technology.Icon != null)
|
|
{
|
|
// For legacy Icon support with EntityPrototypeView
|
|
if (technology.Icon is SpriteSpecifier.EntityPrototype entityProtoSpec)
|
|
{
|
|
TechnologyDisplay.SetPrototype(entityProtoSpec.EntityPrototypeId);
|
|
}
|
|
else
|
|
{
|
|
// For other SpriteSpecifier types, we can't use EntityPrototypeView
|
|
// This maintains consistency with technology squares behavior
|
|
TechnologyDisplay.SetPrototype(null);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// No icon specified
|
|
TechnologyDisplay.SetPrototype(null);
|
|
}
|
|
// End Frontier: If neither is available, the texture will remain null/empty
|
|
|
|
NameLabel.SetMessage(Loc.GetString(technology.Name));
|
|
|
|
var tooltip = new Tooltip();
|
|
tooltip.SetMessage(description);
|
|
Main.TooltipSupplier = _ => tooltip;
|
|
Technology = technology;
|
|
}
|
|
}
|