Fix context menu for admin menu (#20030)
This commit is contained in:
@@ -121,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
|||||||
player.Antag ? "YES" : "NO",
|
player.Antag ? "YES" : "NO",
|
||||||
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
|
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
|
||||||
player.Connected);
|
player.Connected);
|
||||||
entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
|
entry.PlayerEntity = player.NetEntity;
|
||||||
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
|
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
|
||||||
PlayerList.AddChild(entry);
|
PlayerList.AddChild(entry);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab;
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class PlayerTabEntry : ContainerButton
|
public sealed partial class PlayerTabEntry : ContainerButton
|
||||||
{
|
{
|
||||||
public EntityUid? PlayerUid;
|
public NetEntity? PlayerEntity;
|
||||||
|
|
||||||
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected)
|
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -154,16 +154,16 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
|
|||||||
private void PlayerTabEntryPressed(ButtonEventArgs args)
|
private void PlayerTabEntryPressed(ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Button is not PlayerTabEntry button
|
if (args.Button is not PlayerTabEntry button
|
||||||
|| button.PlayerUid == null)
|
|| button.PlayerEntity == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var uid = button.PlayerUid.Value;
|
var entity = button.PlayerEntity.Value;
|
||||||
var function = args.Event.Function;
|
var function = args.Event.Function;
|
||||||
|
|
||||||
if (function == EngineKeyFunctions.UIClick)
|
if (function == EngineKeyFunctions.UIClick)
|
||||||
_conHost.ExecuteCommand($"vv {uid}");
|
_conHost.ExecuteCommand($"vv {entity}");
|
||||||
else if (function == EngineKeyFunctions.UseSecondary)
|
else if (function == EngineKeyFunctions.UseSecondary)
|
||||||
_verb.OpenVerbMenu(uid, true);
|
_verb.OpenVerbMenu(EntityManager.GetEntity(entity), true);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user