Avoid emptying and recreating all UI cards on every update (#21990)
By making the UI elements persistent, it allows tooltips to remain on-screen when other elements are updated - in particular, the number of research points, which is updated regularly. Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -12,6 +12,9 @@ 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);
|
||||
@@ -24,5 +27,6 @@ public sealed partial class MiniTechnologyCardControl : Control
|
||||
var tooltip = new Tooltip();
|
||||
tooltip.SetMessage(description);
|
||||
Main.TooltipSupplier = _ => tooltip;
|
||||
Technology = technology;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user