From 8ea888d8213df7d411dcf60f892986c895671695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Schr=C3=B6dinger?= <132720404+Schrodinger71@users.noreply.github.com> Date: Fri, 28 Feb 2025 23:51:30 +0300 Subject: [PATCH] [ADMIN] Minor Refactor AdminNameOverlay (#35520) * refactor(src): Minor refactor of Draw in "AdminNameOverlay. And new info about playtime player * fix(src): Add configure classic admin owerlay * fix * tweak(src): Use _antagLabelClassic and tweak style * tweak(src): Add config display overlay for startingJob and playTime * tweak(src): Vector2 is replaced by var * tweak(src): return to the end of the list --- .../Administration/AdminNameOverlay.cs | 35 +++++++++++++++---- Content.Shared/CCVar/CCVars.Interface.cs | 12 +++++++ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 86c9b595f6..8b5e59d6f7 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -50,6 +50,8 @@ internal sealed class AdminNameOverlay : Overlay //TODO make this adjustable via GUI var classic = _config.GetCVar(CCVars.AdminOverlayClassic); + var playTime = _config.GetCVar(CCVars.AdminOverlayPlaytime); + var startingJob = _config.GetCVar(CCVars.AdminOverlayStartingJob); foreach (var playerInfo in _system.PlayerList) { @@ -81,20 +83,39 @@ internal sealed class AdminNameOverlay : Overlay new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec( aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f); + var currentOffset = Vector2.Zero; + + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White); + currentOffset += lineoffset; + + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White); + currentOffset += lineoffset; + + if (!string.IsNullOrEmpty(playerInfo.PlaytimeString) && playTime) + { + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.PlaytimeString, uiScale, playerInfo.Connected ? Color.Orange : Color.White); + currentOffset += lineoffset; + } + + if (!string.IsNullOrEmpty(playerInfo.StartingJob) && startingJob) + { + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, Loc.GetString(playerInfo.StartingJob), uiScale, playerInfo.Connected ? Color.GreenYellow : Color.White); + currentOffset += lineoffset; + } + if (classic && playerInfo.Antag) { - args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), _antagLabelClassic, uiScale, _antagColorClassic); + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, _antagLabelClassic, uiScale, Color.OrangeRed); + currentOffset += lineoffset; } else if (!classic && _filter.Contains(playerInfo.RoleProto)) { - var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper(); - var color = playerInfo.RoleProto.Color; + var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper(); + var color = playerInfo.RoleProto.Color; - args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), label, uiScale, color); + args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, label, uiScale, color); + currentOffset += lineoffset; } - - args.ScreenHandle.DrawString(_font, screenCoordinates + lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White); - args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White); } } } diff --git a/Content.Shared/CCVar/CCVars.Interface.cs b/Content.Shared/CCVar/CCVars.Interface.cs index 569303f1cf..2c7cca55e5 100644 --- a/Content.Shared/CCVar/CCVars.Interface.cs +++ b/Content.Shared/CCVar/CCVars.Interface.cs @@ -42,4 +42,16 @@ public sealed partial class CCVars /// public static readonly CVarDef AdminOverlayClassic = CVarDef.Create("ui.admin_overlay_classic", false, CVar.CLIENTONLY | CVar.ARCHIVE); + + /// + /// If true, the admin overlay will display the total time of the players + /// + public static readonly CVarDef AdminOverlayPlaytime = + CVarDef.Create("ui.admin_overlay_playtime", false, CVar.CLIENTONLY | CVar.ARCHIVE); + + /// + /// If true, the admin overlay will display the players starting position. + /// + public static readonly CVarDef AdminOverlayStartingJob = + CVarDef.Create("ui.admin_overlay_starting_job", false, CVar.CLIENTONLY | CVar.ARCHIVE); } -- 2.51.2