Make admin ahelp window remember its last position (#14209)
This commit is contained in:
@@ -2,12 +2,9 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.Administration.Managers;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Administration.Systems;
|
using Content.Client.Administration.Systems;
|
||||||
using Content.Client.Administration.UI;
|
|
||||||
using Content.Client.Administration.UI.Bwoink;
|
using Content.Client.Administration.UI.Bwoink;
|
||||||
using Content.Client.Administration.UI.CustomControls;
|
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
using Content.Client.UserInterface.Controls;
|
using Content.Client.UserInterface.Controls;
|
||||||
using Content.Client.UserInterface.Systems.Info;
|
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -22,7 +19,6 @@ using Robust.Shared.Input.Binding;
|
|||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using BwoinkPanel = Content.Client.Administration.UI.Bwoink.BwoinkPanel;
|
|
||||||
|
|
||||||
namespace Content.Client.UserInterface.Systems.Bwoink;
|
namespace Content.Client.UserInterface.Systems.Bwoink;
|
||||||
|
|
||||||
@@ -196,6 +192,7 @@ public sealed class AHelpUIController: UIController, IOnStateChanged<GameplaySta
|
|||||||
helper.Control.Orphan();
|
helper.Control.Orphan();
|
||||||
helper.Window.Dispose();
|
helper.Window.Dispose();
|
||||||
helper.Window = null;
|
helper.Window = null;
|
||||||
|
helper.EverOpened = false;
|
||||||
|
|
||||||
var monitor = _clyde.EnumerateMonitors().First();
|
var monitor = _clyde.EnumerateMonitors().First();
|
||||||
|
|
||||||
@@ -242,6 +239,7 @@ public sealed class AdminAHelpUIHandler : IAHelpUIHandler
|
|||||||
private readonly Dictionary<NetUserId, BwoinkPanel> _activePanelMap = new();
|
private readonly Dictionary<NetUserId, BwoinkPanel> _activePanelMap = new();
|
||||||
public bool IsAdmin => true;
|
public bool IsAdmin => true;
|
||||||
public bool IsOpen => Window is { Disposed: false, IsOpen: true } || ClydeWindow is { IsDisposed: false };
|
public bool IsOpen => Window is { Disposed: false, IsOpen: true } || ClydeWindow is { IsDisposed: false };
|
||||||
|
public bool EverOpened;
|
||||||
|
|
||||||
public BwoinkWindow? Window;
|
public BwoinkWindow? Window;
|
||||||
public WindowRoot? WindowRoot;
|
public WindowRoot? WindowRoot;
|
||||||
@@ -282,13 +280,19 @@ public sealed class AdminAHelpUIHandler : IAHelpUIHandler
|
|||||||
public void ToggleWindow()
|
public void ToggleWindow()
|
||||||
{
|
{
|
||||||
EnsurePanel(_ownerId);
|
EnsurePanel(_ownerId);
|
||||||
|
|
||||||
if (IsOpen)
|
if (IsOpen)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (EverOpened)
|
||||||
|
Window!.Open();
|
||||||
|
else
|
||||||
Window!.OpenCentered();
|
Window!.OpenCentered();
|
||||||
|
|
||||||
|
EverOpened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +319,11 @@ public sealed class AdminAHelpUIHandler : IAHelpUIHandler
|
|||||||
Window = new BwoinkWindow();
|
Window = new BwoinkWindow();
|
||||||
Control = Window.Bwoink;
|
Control = Window.Bwoink;
|
||||||
Window.OnClose += () => { OnClose?.Invoke(); };
|
Window.OnClose += () => { OnClose?.Invoke(); };
|
||||||
Window.OnOpen += () => { OnOpen?.Invoke(); };
|
Window.OnOpen += () =>
|
||||||
|
{
|
||||||
|
OnOpen?.Invoke();
|
||||||
|
EverOpened = true;
|
||||||
|
};
|
||||||
|
|
||||||
// need to readd any unattached panels..
|
// need to readd any unattached panels..
|
||||||
foreach (var (_, panel) in _activePanelMap)
|
foreach (var (_, panel) in _activePanelMap)
|
||||||
@@ -356,8 +364,10 @@ public sealed class AdminAHelpUIHandler : IAHelpUIHandler
|
|||||||
Window = null;
|
Window = null;
|
||||||
Control = null;
|
Control = null;
|
||||||
_activePanelMap.Clear();
|
_activePanelMap.Clear();
|
||||||
|
EverOpened = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class UserAHelpUIHandler : IAHelpUIHandler
|
public sealed class UserAHelpUIHandler : IAHelpUIHandler
|
||||||
{
|
{
|
||||||
private readonly NetUserId _ownerId;
|
private readonly NetUserId _ownerId;
|
||||||
|
|||||||
Reference in New Issue
Block a user