]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[ADMIN] Minor Refactor AdminNameOverlay (#35520)
authorSchrödinger <132720404+Schrodinger71@users.noreply.github.com>
Fri, 28 Feb 2025 20:51:30 +0000 (23:51 +0300)
committerGitHub <noreply@github.com>
Fri, 28 Feb 2025 20:51:30 +0000 (21:51 +0100)
* 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

Content.Client/Administration/AdminNameOverlay.cs
Content.Shared/CCVar/CCVars.Interface.cs

index 86c9b595f6a8b78ce18dfeb2228b83b7bb41c863..8b5e59d6f7e46704ab06eb7b78f06f5c98a361fd 100644 (file)
@@ -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);
         }
     }
 }
index 569303f1cff1f25b3d266f6b2b8176ffd45be392..2c7cca55e53db1596148edf5f9c46b7e3c4751f7 100644 (file)
@@ -42,4 +42,16 @@ public sealed partial class CCVars
     /// </summary>
     public static readonly CVarDef<bool> AdminOverlayClassic =
         CVarDef.Create("ui.admin_overlay_classic", false, CVar.CLIENTONLY | CVar.ARCHIVE);
+
+    /// <summary>
+    /// If true, the admin overlay will display the total time of the players
+    /// </summary>
+    public static readonly CVarDef<bool> AdminOverlayPlaytime =
+        CVarDef.Create("ui.admin_overlay_playtime", false, CVar.CLIENTONLY | CVar.ARCHIVE);
+
+    /// <summary>
+    /// If true, the admin overlay will display the players starting position.
+    /// </summary>
+    public static readonly CVarDef<bool> AdminOverlayStartingJob =
+        CVarDef.Create("ui.admin_overlay_starting_job", false, CVar.CLIENTONLY | CVar.ARCHIVE);
 }