From 6979a63b1ede95b8487e00d731c22e4f0134b0be Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:02:31 +1100 Subject: [PATCH] Add CreateWindowCenteredRight method (#5666) --- .../UserInterface/BoundUserInterfaceExt.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Robust.Client/UserInterface/BoundUserInterfaceExt.cs b/Robust.Client/UserInterface/BoundUserInterfaceExt.cs index 54a2b635fe..9cea88e748 100644 --- a/Robust.Client/UserInterface/BoundUserInterfaceExt.cs +++ b/Robust.Client/UserInterface/BoundUserInterfaceExt.cs @@ -51,6 +51,22 @@ public static class BoundUserInterfaceExt return window; } + public static T CreateWindowCenteredRight(this BoundUserInterface bui) where T : BaseWindow, new() + { + var window = GetWindow(bui); + + if (bui.EntMan.System().TryGetPosition(bui.Owner, bui.UiKey, out var position)) + { + window.Open(position); + } + else + { + window.OpenCenteredRight(); + } + + return window; + } + /// /// Creates a control for this BUI that will be disposed when it is disposed. ///