Add CreateWindowCenteredRight method (#5666)

This commit is contained in:
metalgearsloth
2025-02-11 15:02:31 +11:00
committed by GitHub
parent ae7725aafe
commit 6979a63b1e
@@ -51,6 +51,22 @@ public static class BoundUserInterfaceExt
return window;
}
public static T CreateWindowCenteredRight<T>(this BoundUserInterface bui) where T : BaseWindow, new()
{
var window = GetWindow<T>(bui);
if (bui.EntMan.System<UserInterfaceSystem>().TryGetPosition(bui.Owner, bui.UiKey, out var position))
{
window.Open(position);
}
else
{
window.OpenCenteredRight();
}
return window;
}
/// <summary>
/// Creates a control for this BUI that will be disposed when it is disposed.
/// </summary>