From 11510927d66060ea079339afd93c785e4d8ccbcb Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 4 Jan 2022 21:12:34 +0100 Subject: [PATCH] work on adminpanel & submodule update --- Content.Client/Administration/BwoinkSystem.cs | 26 ++++++++++++++++--- .../Administration/UI/BwoinkWindow.xaml.cs | 22 ++++++++++------ .../CustomControls/PlayerListControl.xaml.cs | 5 +--- Content.Client/Commands/OpenAHelpCommand.cs | 4 +-- RobustToolbox | 2 +- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/Content.Client/Administration/BwoinkSystem.cs b/Content.Client/Administration/BwoinkSystem.cs index bf6ca9ca2f..9b83d8a27f 100644 --- a/Content.Client/Administration/BwoinkSystem.cs +++ b/Content.Client/Administration/BwoinkSystem.cs @@ -100,11 +100,29 @@ namespace Content.Client.Administration return EnsurePlain(channelId); } - public void EnsurePanelForLocalPlayer() + public void Open(NetUserId? channelId = null) { - var localPlayer = _playerManager.LocalPlayer; - if (localPlayer != null) - EnsurePanel(localPlayer.UserId); + if (channelId == null) + { + var localPlayer = _playerManager.LocalPlayer; + if (localPlayer != null) + Open(localPlayer.UserId); + return; + } + + if (_adminManager.HasFlag(AdminFlags.Adminhelp)) + { + SelectChannel(channelId.Value); + return; + } + + EnsurePlain(channelId.Value); + } + + private void SelectChannel(NetUserId uid) + { + _adminWindow ??= new BwoinkWindow(this); + _adminWindow.SelectChannel(uid); } public void Send(NetUserId channelId, string text) diff --git a/Content.Client/Administration/UI/BwoinkWindow.xaml.cs b/Content.Client/Administration/UI/BwoinkWindow.xaml.cs index 36a9847c8a..92bc73f09e 100644 --- a/Content.Client/Administration/UI/BwoinkWindow.xaml.cs +++ b/Content.Client/Administration/UI/BwoinkWindow.xaml.cs @@ -108,15 +108,20 @@ namespace Content.Client.Administration.UI if (!open) { - var pi = ChannelSelector - .PlayerItemList - .FirstOrDefault(i => ((PlayerInfo) i.Metadata!).SessionId == channel); - - if (pi is not null) - pi.Selected = true; + SelectChannel(channel); } } + public void SelectChannel(NetUserId channel) + { + var pi = ChannelSelector + .PlayerItemList + .FirstOrDefault(i => ((PlayerInfo) i.Metadata!).SessionId == channel); + + if (pi is not null) + pi.Selected = true; + } + private void FixButtons() { Ban.Visible = _adminManager.HasFlag(AdminFlags.Ban); @@ -157,11 +162,12 @@ namespace Content.Client.Administration.UI return sb.ToString(); } - public void SwitchToChannel(NetUserId ch) + private void SwitchToChannel(NetUserId ch) { foreach (var bw in BwoinkArea.Children) bw.Visible = false; - _bwoinkSystem.EnsurePanel(ch).Visible = true; + var panel = _bwoinkSystem.EnsurePanel(ch); + panel.Visible = true; } } } diff --git a/Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs b/Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs index 68863a386d..332994fdb5 100644 --- a/Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs +++ b/Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs @@ -25,16 +25,13 @@ namespace Content.Client.Administration.UI.CustomControls _adminSystem = EntitySystem.Get(); IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); - } - - protected override void EnteredTree() - { // Fill the Option data PopulateList(); PlayerItemList.OnItemSelected += PlayerItemListOnOnItemSelected; PlayerItemList.OnItemDeselected += PlayerItemListOnOnItemDeselected; FilterLineEdit.OnTextChanged += FilterLineEditOnOnTextEntered; _adminSystem.PlayerListChanged += PopulateList; + } private void FilterLineEditOnOnTextEntered(LineEdit.LineEditEventArgs obj) diff --git a/Content.Client/Commands/OpenAHelpCommand.cs b/Content.Client/Commands/OpenAHelpCommand.cs index 908e707f18..ddaf8121c4 100644 --- a/Content.Client/Commands/OpenAHelpCommand.cs +++ b/Content.Client/Commands/OpenAHelpCommand.cs @@ -23,13 +23,13 @@ namespace Content.Client.Commands } if (args.Length == 0) { - EntitySystem.Get().EnsurePanelForLocalPlayer(); + EntitySystem.Get().Open(); } else { if (Guid.TryParse(args[0], out var guid)) { - EntitySystem.Get().EnsurePanel(new NetUserId(guid)); + EntitySystem.Get().Open(new NetUserId(guid)); } else { diff --git a/RobustToolbox b/RobustToolbox index f49a29cfb3..18cc385c70 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit f49a29cfb3db2cb8474b514507f7cc6b1fc66370 +Subproject commit 18cc385c7073d88932bd80092a9d4620ff9439d2