Reapply "Remove some BUI boilerplate" (#30214) (#30219)

* Reapply "Remove some BUI boilerplate" (#30214)

This reverts commit cb0ba66be3.

* Fix gas tank

* Fix PA

* Fix microwave

* Comms console underwrap

* Fix rcd

* log wehs
This commit is contained in:
metalgearsloth
2024-07-21 14:48:13 +10:00
committed by GitHub
parent 87e52e50b4
commit edb05e36bb
137 changed files with 1102 additions and 1757 deletions

View File

@@ -1,5 +1,6 @@
using System.Text.RegularExpressions;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Client.Configurable.UI
@@ -9,9 +10,6 @@ namespace Content.Client.Configurable.UI
[ViewVariables]
private ConfigurationMenu? _menu;
[ViewVariables]
public Regex? Validation { get; internal set; }
public ConfigurationBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
@@ -19,10 +17,8 @@ namespace Content.Client.Configurable.UI
protected override void Open()
{
base.Open();
_menu = new ConfigurationMenu(this);
_menu.OnClose += Close;
_menu.OpenCentered();
_menu = this.CreateWindow<ConfigurationMenu>();
_menu.OnConfiguration += SendConfiguration;
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -30,9 +26,7 @@ namespace Content.Client.Configurable.UI
base.UpdateState(state);
if (state is not ConfigurationBoundUserInterfaceState configurationState)
{
return;
}
_menu?.Populate(configurationState);
}
@@ -41,9 +35,12 @@ namespace Content.Client.Configurable.UI
{
base.ReceiveMessage(message);
if (_menu == null)
return;
if (message is ValidationUpdateMessage msg)
{
Validation = new Regex(msg.ValidationString, RegexOptions.Compiled);
_menu.Validation = new Regex(msg.ValidationString, RegexOptions.Compiled);
}
}
@@ -51,16 +48,5 @@ namespace Content.Client.Configurable.UI
{
SendMessage(new ConfigurationUpdatedMessage(config));
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing && _menu != null)
{
_menu.OnClose -= Close;
_menu.Close();
}
}
}
}