MiniTechnologyCardControl.xaml.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using Content.Shared.Research.Prototypes;
  2. using Robust.Client.AutoGenerated;
  3. using Robust.Client.GameObjects;
  4. using Robust.Client.UserInterface;
  5. using Robust.Client.UserInterface.CustomControls;
  6. using Robust.Client.UserInterface.XAML;
  7. using Robust.Shared.Prototypes;
  8. using Robust.Shared.Utility;
  9. namespace Content.Client.Research.UI;
  10. [GenerateTypedNameReferences]
  11. public sealed partial class MiniTechnologyCardControl : Control
  12. {
  13. /// The technology that this control represents
  14. public readonly TechnologyPrototype Technology;
  15. public MiniTechnologyCardControl(TechnologyPrototype technology, IPrototypeManager prototypeManager, SpriteSystem spriteSys, FormattedMessage description)
  16. {
  17. RobustXamlLoader.Load(this);
  18. var discipline = prototypeManager.Index(technology.Discipline);
  19. Background.ModulateSelfOverride = discipline.Color;
  20. Texture.Texture = spriteSys.Frame0(technology.Icon);
  21. NameLabel.SetMessage(Loc.GetString(technology.Name));
  22. var tooltip = new Tooltip();
  23. tooltip.SetMessage(description);
  24. Main.TooltipSupplier = _ => tooltip;
  25. Technology = technology;
  26. }
  27. }