XAML PlayerTab (#5897)
* XAML PlayerTab entries * Move command execution to PlayerTab * Move command logic to the AdminSystem * Clean up * Add IClientConsoleHost dependency
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Client.Administration.UI;
|
||||
using Content.Client.Administration.UI.Tabs.PlayerTab;
|
||||
using Content.Client.HUD;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input.Binding;
|
||||
@@ -26,6 +28,7 @@ namespace Content.Client.Administration
|
||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IEntityLookup _entityLookup = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _clientConsoleHost = default!;
|
||||
|
||||
private AdminMenuWindow? _window;
|
||||
private readonly List<SS14Window> _commandWindows = new();
|
||||
@@ -88,6 +91,7 @@ namespace Content.Client.Administration
|
||||
public void Open()
|
||||
{
|
||||
_window ??= new AdminMenuWindow();
|
||||
_window.PlayerTabControl.OnEntryPressed += PlayerTabEntryPressed;
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
@@ -129,5 +133,14 @@ namespace Content.Client.Administration
|
||||
TryOpen();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayerTabEntryPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
if (args.Button is not PlayerTabEntry button
|
||||
|| button.PlayerUid == null)
|
||||
return;
|
||||
|
||||
_clientConsoleHost.ExecuteCommand($"vv {button.PlayerUid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user