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,5 +1,4 @@
using JetBrains.Annotations;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Utility;
using static Content.Shared.Paper.SharedPaperComponent;
@@ -20,13 +19,16 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
{
base.Open();
_window = this.CreateWindow<PaperWindow>();
_window.OnSaved += InputOnTextEntered;
_window = new PaperWindow();
_window.OnClose += Close;
_window.OnSaved += Input_OnTextEntered;
if (EntMan.TryGetComponent<PaperVisualsComponent>(Owner, out var visuals))
{
_window.InitVisuals(Owner, visuals);
}
_window.OpenCentered();
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -35,7 +37,7 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
_window?.Populate((PaperBoundUserInterfaceState) state);
}
private void InputOnTextEntered(string text)
private void Input_OnTextEntered(string text)
{
SendMessage(new PaperInputTextMessage(text));
@@ -45,4 +47,11 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
_window.Input.CursorPosition = new TextEdit.CursorPos(0, TextEdit.LineBreakBias.Top);
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
_window?.Dispose();
}
}