Revert "Remove some BUI boilerplate" (#30214)

Revert "Remove some BUI boilerplate (#28399)"

This reverts commit cbf329a82d.
This commit is contained in:
Nemanja
2024-07-20 20:42:27 -04:00
committed by GitHub
parent 6d664c9157
commit cb0ba66be3
137 changed files with 1755 additions and 1096 deletions

View File

@@ -1,8 +1,5 @@
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
namespace Content.Client.Research.UI;
@@ -22,8 +19,7 @@ public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
var owner = Owner;
_consoleMenu = this.CreateWindow<ResearchConsoleMenu>();
_consoleMenu.SetEntity(owner);
_consoleMenu = new ResearchConsoleMenu(owner);
_consoleMenu.OnTechnologyCardPressed += id =>
{
@@ -34,20 +30,10 @@ public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
{
SendMessage(new ConsoleServerSelectionMessage());
};
}
public override void OnProtoReload(PrototypesReloadedEventArgs args)
{
base.OnProtoReload(args);
_consoleMenu.OnClose += Close;
if (!args.WasModified<TechnologyPrototype>())
return;
if (State is not ResearchConsoleBoundInterfaceState rState)
return;
_consoleMenu?.UpdatePanels(rState);
_consoleMenu?.UpdateInformationPanel(rState);
_consoleMenu.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -59,4 +45,12 @@ public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface
_consoleMenu?.UpdatePanels(castState);
_consoleMenu?.UpdateInformationPanel(castState);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_consoleMenu?.Dispose();
}
}