Revert "Remove some BUI boilerplate" (#30214)
Revert "Remove some BUI boilerplate (#28399)"
This reverts commit cbf329a82d.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Client.NetworkConfigurator.Systems;
|
||||
using Content.Shared.DeviceNetwork;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.NetworkConfigurator;
|
||||
@@ -36,12 +35,14 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
||||
switch (UiKey)
|
||||
{
|
||||
case NetworkConfiguratorUiKey.List:
|
||||
_listMenu = this.CreateWindow<NetworkConfiguratorListMenu>();
|
||||
_listMenu = new NetworkConfiguratorListMenu(this);
|
||||
_listMenu.OnClose += Close;
|
||||
_listMenu.ClearButton.OnPressed += _ => OnClearButtonPressed();
|
||||
_listMenu.OnRemoveAddress += OnRemoveButtonPressed;
|
||||
_listMenu.OpenCenteredRight();
|
||||
break;
|
||||
case NetworkConfiguratorUiKey.Configure:
|
||||
_configurationMenu = this.CreateWindow<NetworkConfiguratorConfigurationMenu>();
|
||||
_configurationMenu = new NetworkConfiguratorConfigurationMenu();
|
||||
_configurationMenu.OnClose += Close;
|
||||
_configurationMenu.Set.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Set);
|
||||
_configurationMenu.Add.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Add);
|
||||
//_configurationMenu.Edit.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Edit);
|
||||
@@ -49,24 +50,12 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
||||
_configurationMenu.Copy.OnPressed += _ => OnConfigButtonPressed(NetworkConfiguratorButtonKey.Copy);
|
||||
_configurationMenu.Show.OnPressed += OnShowPressed;
|
||||
_configurationMenu.Show.Pressed = _netConfig.ConfiguredListIsTracked(Owner);
|
||||
_configurationMenu.OnRemoveAddress += OnRemoveButtonPressed;
|
||||
_configurationMenu.OpenCentered();
|
||||
break;
|
||||
case NetworkConfiguratorUiKey.Link:
|
||||
_linkMenu = this.CreateWindow<NetworkConfiguratorLinkMenu>();
|
||||
_linkMenu.OnLinkDefaults += args =>
|
||||
{
|
||||
SendMessage(new NetworkConfiguratorLinksSaveMessage(args));
|
||||
};
|
||||
|
||||
_linkMenu.OnToggleLink += (left, right) =>
|
||||
{
|
||||
SendMessage(new NetworkConfiguratorToggleLinkMessage(left, right));
|
||||
};
|
||||
|
||||
_linkMenu.OnClearLinks += () =>
|
||||
{
|
||||
SendMessage(new NetworkConfiguratorClearLinksMessage());
|
||||
};
|
||||
_linkMenu = new NetworkConfiguratorLinkMenu(this);
|
||||
_linkMenu.OnClose += Close;
|
||||
_linkMenu.OpenCentered();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -94,6 +83,16 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing) return;
|
||||
|
||||
_linkMenu?.Dispose();
|
||||
_listMenu?.Dispose();
|
||||
_configurationMenu?.Dispose();
|
||||
}
|
||||
|
||||
private void OnClearButtonPressed()
|
||||
{
|
||||
SendMessage(new NetworkConfiguratorClearDevicesMessage());
|
||||
|
||||
Reference in New Issue
Block a user