Ahelp popout button (#13547)
This commit is contained in:
25
Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Normal file
25
Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<Control
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client">
|
||||
<PanelContainer>
|
||||
<PanelContainer.PanelOverride>
|
||||
<gfx:StyleBoxFlat BackgroundColor="#25252A"/>
|
||||
</PanelContainer.PanelOverride>
|
||||
<SplitContainer Orientation="Horizontal" VerticalExpand="True">
|
||||
<cc:PlayerListControl Access="Public" Name="ChannelSelector" HorizontalExpand="True" SizeFlagsStretchRatio="1" />
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
|
||||
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
|
||||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Margin="0 0 10 0" Visible="True" Name="PopOut" Access="Public" Text="{Loc 'admin-logs-pop-out'}"/>
|
||||
<Button Visible="False" Name="Bans" Text="{Loc 'admin-player-actions-bans'}" />
|
||||
<Button Visible="False" Name="Notes" Text="{Loc 'admin-player-actions-notes'}" />
|
||||
<Button Visible="False" Name="Kick" Text="{Loc 'admin-player-actions-kick'}" />
|
||||
<Button Visible="False" Name="Ban" Text="{Loc 'admin-player-actions-ban'}" />
|
||||
<Button Visible="False" Name="Respawn" Text="{Loc 'admin-player-actions-respawn'}" />
|
||||
<Button Visible="False" Name="Teleport" Text="{Loc 'admin-player-actions-teleport'}" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</SplitContainer>
|
||||
</PanelContainer>
|
||||
</Control>
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Text;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Client.Administration.UI.CustomControls;
|
||||
@@ -16,27 +16,33 @@ using Robust.Shared.Network;
|
||||
using Robust.Shared.Utility;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
namespace Content.Client.Administration.UI
|
||||
namespace Content.Client.Administration.UI.Bwoink
|
||||
{
|
||||
/// <summary>
|
||||
/// This window connects to a BwoinkSystem channel. BwoinkSystem manages the rest.
|
||||
/// </summary>
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BwoinkWindow : DefaultWindow
|
||||
public sealed partial class BwoinkControl : Control
|
||||
{
|
||||
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _console = default!;
|
||||
private readonly AdminAHelpUIHandler _adminAHelpHelper;
|
||||
[Dependency] private readonly IUserInterfaceManager _ui = default!;
|
||||
public AdminAHelpUIHandler AHelpHelper = default!;
|
||||
|
||||
//private readonly BwoinkSystem _bwoinkSystem;
|
||||
private PlayerInfo? _currentPlayer = default;
|
||||
|
||||
public BwoinkWindow(AdminAHelpUIHandler adminAHelpHelper)
|
||||
public BwoinkControl()
|
||||
{
|
||||
_adminAHelpHelper = adminAHelpHelper;
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
var uiController = _ui.GetUIController<AHelpUIController>();
|
||||
if (uiController.UIHelper is not AdminAHelpUIHandler helper)
|
||||
return;
|
||||
|
||||
AHelpHelper = helper;
|
||||
|
||||
_adminManager.AdminStatusUpdated += FixButtons;
|
||||
FixButtons();
|
||||
|
||||
@@ -46,7 +52,6 @@ namespace Content.Client.Administration.UI
|
||||
if (sel is not null)
|
||||
{
|
||||
SwitchToChannel(sel.SessionId);
|
||||
Title = $"{sel.CharacterName} / {sel.Username}";
|
||||
}
|
||||
|
||||
ChannelSelector.PlayerListContainer.DirtyList();
|
||||
@@ -62,7 +67,7 @@ namespace Content.Client.Administration.UI
|
||||
sb.Append(info.ActiveThisRound ? '○' : '·');
|
||||
|
||||
sb.Append(' ');
|
||||
if (_adminAHelpHelper.TryGetChannel(info.SessionId, out var panel) && panel.Unread > 0)
|
||||
if (AHelpHelper.TryGetChannel(info.SessionId, out var panel) && panel.Unread > 0)
|
||||
{
|
||||
if (panel.Unread < 11)
|
||||
sb.Append(new Rune('➀' + (panel.Unread-1)));
|
||||
@@ -81,8 +86,8 @@ namespace Content.Client.Administration.UI
|
||||
|
||||
ChannelSelector.Comparison = (a, b) =>
|
||||
{
|
||||
var ach = _adminAHelpHelper.EnsurePanel(a.SessionId);
|
||||
var bch = _adminAHelpHelper.EnsurePanel(b.SessionId);
|
||||
var ach = AHelpHelper.EnsurePanel(a.SessionId);
|
||||
var bch = AHelpHelper.EnsurePanel(b.SessionId);
|
||||
|
||||
// First, sort by unread. Any chat with unread messages appears first. We just sort based on unread
|
||||
// status, not number of unread messages, so that more recent unread messages take priority.
|
||||
@@ -153,7 +158,10 @@ namespace Content.Client.Administration.UI
|
||||
_console.ExecuteCommand($"respawn \"{_currentPlayer.Username}\"");
|
||||
};
|
||||
|
||||
OnOpen += () => ChannelSelector.PopulateList();
|
||||
PopOut.OnPressed += _ =>
|
||||
{
|
||||
uiController.PopOut();
|
||||
};
|
||||
}
|
||||
|
||||
private Dictionary<Control, (CancellationTokenSource cancellation, string? originalText)> Confirmations { get; } = new();
|
||||
@@ -199,7 +207,7 @@ namespace Content.Client.Administration.UI
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(pl.Connected ? '●' : '○');
|
||||
sb.Append(' ');
|
||||
if (_adminAHelpHelper.TryGetChannel(pl.SessionId, out var panel) && panel.Unread > 0)
|
||||
if (AHelpHelper.TryGetChannel(pl.SessionId, out var panel) && panel.Unread > 0)
|
||||
{
|
||||
if (panel.Unread < 11)
|
||||
sb.Append(new Rune('➀' + (panel.Unread-1)));
|
||||
@@ -225,7 +233,7 @@ namespace Content.Client.Administration.UI
|
||||
{
|
||||
foreach (var bw in BwoinkArea.Children)
|
||||
bw.Visible = false;
|
||||
var panel = _adminAHelpHelper.EnsurePanel(ch);
|
||||
var panel = AHelpHelper.EnsurePanel(ch);
|
||||
panel.Visible = true;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Client.Administration.Systems;
|
||||
using Content.Client.UserInterface.Systems.Bwoink;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Client.Administration.UI.CustomControls;
|
||||
|
||||
namespace Content.Client.Administration.UI.CustomControls
|
||||
namespace Content.Client.Administration.UI.Bwoink
|
||||
{
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BwoinkPanel : BoxContainer
|
||||
@@ -0,0 +1,8 @@
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.Bwoink"
|
||||
SetSize="900 500"
|
||||
HeaderClass="windowHeaderAlert"
|
||||
TitleClass="windowTitleAlert"
|
||||
Title="{Loc 'bwoink-user-title'}" >
|
||||
<cc:BwoinkControl Name="Bwoink" Access="Public"/>
|
||||
</DefaultWindow>
|
||||
42
Content.Client/Administration/UI/Bwoink/BwoinkWindow.xaml.cs
Normal file
42
Content.Client/Administration/UI/Bwoink/BwoinkWindow.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Client.Administration.UI.CustomControls;
|
||||
using Content.Client.Administration.UI.Tabs.AdminTab;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Client.UserInterface.Systems.Bwoink;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Utility;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
namespace Content.Client.Administration.UI.Bwoink
|
||||
{
|
||||
/// <summary>
|
||||
/// This window connects to a BwoinkSystem channel. BwoinkSystem manages the rest.
|
||||
/// </summary>
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BwoinkWindow : DefaultWindow
|
||||
{
|
||||
public BwoinkWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
Bwoink.ChannelSelector.OnSelectionChanged += sel =>
|
||||
{
|
||||
if (sel is not null)
|
||||
{
|
||||
Title = $"{sel.CharacterName} / {sel.Username}";
|
||||
}
|
||||
};
|
||||
|
||||
OnOpen += () => Bwoink.ChannelSelector.PopulateList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<DefaultWindow
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
SetSize="900 500"
|
||||
HeaderClass="windowHeaderAlert"
|
||||
TitleClass="windowTitleAlert"
|
||||
Title="{Loc 'bwoink-user-title'}" >
|
||||
<SplitContainer Orientation="Horizontal">
|
||||
<cc:PlayerListControl Access="Public" Name="ChannelSelector" HorizontalExpand="True" SizeFlagsStretchRatio="1" />
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
|
||||
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
|
||||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Visible="False" Name="Bans" Text="{Loc 'admin-player-actions-bans'}" />
|
||||
<Button Visible="False" Name="Notes" Text="{Loc 'admin-player-actions-notes'}" />
|
||||
<Button Visible="False" Name="Kick" Text="{Loc 'admin-player-actions-kick'}" />
|
||||
<Button Visible="False" Name="Ban" Text="{Loc 'admin-player-actions-ban'}" />
|
||||
<Button Visible="False" Name="Respawn" Text="{Loc 'admin-player-actions-respawn'}" />
|
||||
<Button Visible="False" Name="Teleport" Text="{Loc 'admin-player-actions-teleport'}" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</SplitContainer>
|
||||
</DefaultWindow>
|
||||
Reference in New Issue
Block a user