Remove some BUI boilerplate (#28399)
* Remove some BUI boilerplate - The disposals overrides got removed due to the helper method handling it. - Replace window creation with CreateWindow helper. - Fixed some stinky code which would cause exceptions. * More * moar * weh * done * More BUIs * More updates * weh * moar * look who it is * weh * merge * weh * fixes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Utility;
|
||||
using static Content.Shared.Paper.SharedPaperComponent;
|
||||
@@ -19,16 +20,13 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new PaperWindow();
|
||||
_window.OnClose += Close;
|
||||
_window.OnSaved += Input_OnTextEntered;
|
||||
_window = this.CreateWindow<PaperWindow>();
|
||||
_window.OnSaved += InputOnTextEntered;
|
||||
|
||||
if (EntMan.TryGetComponent<PaperVisualsComponent>(Owner, out var visuals))
|
||||
{
|
||||
_window.InitVisuals(Owner, visuals);
|
||||
}
|
||||
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
@@ -37,7 +35,7 @@ public sealed class PaperBoundUserInterface : BoundUserInterface
|
||||
_window?.Populate((PaperBoundUserInterfaceState) state);
|
||||
}
|
||||
|
||||
private void Input_OnTextEntered(string text)
|
||||
private void InputOnTextEntered(string text)
|
||||
{
|
||||
SendMessage(new PaperInputTextMessage(text));
|
||||
|
||||
@@ -47,11 +45,4 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user