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.Shared.Humanoid.Markings;
|
||||
using Content.Shared.MagicMirror;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
namespace Content.Client.MagicMirror;
|
||||
|
||||
@@ -18,7 +17,7 @@ public sealed class MagicMirrorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = this.CreateWindow<MagicMirrorWindow>();
|
||||
_window = new();
|
||||
|
||||
_window.OnHairSelected += tuple => SelectHair(MagicMirrorCategory.Hair, tuple.id, tuple.slot);
|
||||
_window.OnHairColorChanged += args => ChangeColor(MagicMirrorCategory.Hair, args.marking, args.slot);
|
||||
@@ -30,6 +29,9 @@ public sealed class MagicMirrorBoundUserInterface : BoundUserInterface
|
||||
args => ChangeColor(MagicMirrorCategory.FacialHair, args.marking, args.slot);
|
||||
_window.OnFacialHairSlotAdded += delegate () { AddSlot(MagicMirrorCategory.FacialHair); };
|
||||
_window.OnFacialHairSlotRemoved += args => RemoveSlot(MagicMirrorCategory.FacialHair, args);
|
||||
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
private void SelectHair(MagicMirrorCategory category, string marking, int slot)
|
||||
@@ -63,5 +65,14 @@ public sealed class MagicMirrorBoundUserInterface : BoundUserInterface
|
||||
|
||||
_window.UpdateState(data);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (!disposing)
|
||||
return;
|
||||
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user