diff --git a/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml b/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml
new file mode 100644
index 0000000000..4d7fb1893f
--- /dev/null
+++ b/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
diff --git a/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml.cs b/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml.cs
new file mode 100644
index 0000000000..a1c7791626
--- /dev/null
+++ b/Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml.cs
@@ -0,0 +1,28 @@
+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.ADT.Research.UI;
+
+[GenerateTypedNameReferences]
+public sealed partial class MiniRecipeCardControl : Control
+{
+ public MiniRecipeCardControl(TechnologyPrototype technology, string name, IPrototypeManager prototypeManager)
+ {
+ RobustXamlLoader.Load(this);
+
+ var discipline = prototypeManager.Index(technology.Discipline);
+ Background.ModulateSelfOverride = discipline.Color;
+ NameLabel.SetMessage(Loc.GetString(technology.Name));
+
+ // var tooltip = new Tooltip();
+ // tooltip.SetMessage(description);
+ // Main.TooltipSupplier = _ => tooltip;
+ // Technology = technology;
+ }
+}
diff --git a/Content.Client/ADT/Research/UI/ResearchConsoleItem.xaml.cs b/Content.Client/ADT/Research/UI/ResearchConsoleItem.xaml.cs
index 8de000d268..dabb265445 100644
--- a/Content.Client/ADT/Research/UI/ResearchConsoleItem.xaml.cs
+++ b/Content.Client/ADT/Research/UI/ResearchConsoleItem.xaml.cs
@@ -27,8 +27,18 @@ public ResearchConsoleItem(TechnologyPrototype proto, SpriteSystem sprite)
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Prototype = proto;
- Buy.OnPressed += _ => BuyAction?.Invoke(Prototype);
+ Buy.OnPressed += Selected;
ResearchDisplay.Texture = sprite.Frame0(proto.Icon);
}
+ protected override void Dispose(bool disposing)
+ {
+ Buy.OnPressed -= Selected;
+ base.Dispose(disposing);
+ }
+
+ private void Selected(BaseButton.ButtonEventArgs args)
+ {
+ BuyAction?.Invoke(Prototype);
+ }
}
diff --git a/Content.Client/ADT/Research/UI/ResearchConsoleMenu.xaml.cs b/Content.Client/ADT/Research/UI/ResearchConsoleMenu.xaml.cs
index 7faf6f5b40..b15d237b23 100644
--- a/Content.Client/ADT/Research/UI/ResearchConsoleMenu.xaml.cs
+++ b/Content.Client/ADT/Research/UI/ResearchConsoleMenu.xaml.cs
@@ -65,8 +65,8 @@ public void SetEntity(EntityUid entity)
public void UpdatePanels(ResearchConsoleBoundInterfaceState state)
{
- DragContainer.Children.Clear();
- DisciplinesContainer.Children.Clear();
+ DragContainer.DisposeAllChildren();
+ DisciplinesContainer.DisposeAllChildren();
List = state.AllowedPrototypes;
foreach (var proto in _prototype.EnumeratePrototypes())
@@ -141,7 +141,7 @@ public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
("name", disciplineText), ("color", disciplineColor)));
MainDisciplineLabel.SetMessage(msg);
- TierDisplayContainer.Children.Clear();
+ TierDisplayContainer.DisposeAllChildren();
foreach (var disciplineId in database.SupportedDisciplines)
{
var discipline = _prototype.Index(disciplineId);
@@ -217,7 +217,7 @@ protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
public void Select(TechnologyPrototype proto)
{
- InfoContainer.Children.Clear();
+ InfoContainer.DisposeAllChildren();
if (!_player.LocalEntity.HasValue)
return;
@@ -238,10 +238,14 @@ public void Recenter()
public override void Close()
{
- DragContainer.Children.Clear();
- InfoContainer.Children.Clear();
- DisciplinesContainer.Children.Clear();
base.Close();
}
+
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+
+
+ }
}
diff --git a/Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml b/Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml
index a9aadce904..e331efa4b6 100644
--- a/Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml
+++ b/Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml
@@ -2,7 +2,6 @@
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Margin="5"
- Orientation="Vertical"
VerticalExpand="True">
(proto.Discipline).Icon);
TechnologyTexture.Texture = sprite.Frame0(proto.Icon);
+ UnlocksContainer.DisposeAllChildren();
+ foreach (var item in proto.RecipeUnlocks)
+ {
+ var control = new MiniRecipeCardControl(proto, Loc.GetString(proto.Name), _proto);
+ UnlocksContainer.AddChild(control);
+ }
if (!hasAccess)
ResearchButton.ToolTip = Loc.GetString("research-console-no-access-popup");
ResearchButton.Disabled = points < proto.Cost || !hasAccess;
- ResearchButton.OnPressed += _ => BuyAction?.Invoke(Prototype);
+ ResearchButton.OnPressed += Bought;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ ResearchButton.OnPressed -= Bought;
+ base.Dispose(disposing);
+ }
+ private void Bought(BaseButton.ButtonEventArgs args)
+ {
+ BuyAction?.Invoke(Prototype);
}
}