Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Added sorting and NO BALANCE label
Browse files Browse the repository at this point in the history
  • Loading branch information
desuwatch committed May 7, 2024
1 parent 24037d2 commit 4652460
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Content.Client/Administration/AdminNameOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ protected override void Draw(in OverlayDrawArgs args)
var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center +
new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec(
aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f);
var balance_str = playerInfo.Balance == int.MinValue ? "NO BALANCE" : playerInfo.Balance.ToString();
if (playerInfo.Antag)
{
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), "ANTAG", Color.OrangeRed);
}
args.ScreenHandle.DrawString(_font, screenCoordinates + lineoffset, playerInfo.Username, playerInfo.Connected ? Color.Yellow : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, playerInfo.Connected ? Color.Aquamarine : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates + 3 * lineoffset, $"balance: {playerInfo.Balance}", playerInfo.Connected ? Color.Aquamarine : Color.White);
args.ScreenHandle.DrawString(_font, screenCoordinates + 3 * lineoffset, $"balance: {balance_str}", playerInfo.Connected ? Color.Aquamarine : Color.White);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected,
player.PlaytimeString,
player.Balance);
player.Balance == int.MinValue ? "NO BALANCE" : player.Balance.ToString());
entry.PlayerEntity = player.NetEntity;
entry.OnKeyBindDown += args => OnEntryKeyBindDown?.Invoke(entry, args);
entry.ToolTip = Loc.GetString("player-tab-entry-tooltip");
Expand Down Expand Up @@ -152,8 +152,9 @@ private int Compare(PlayerInfo x, PlayerInfo y)
Header.Job => Compare(x.StartingJob, y.StartingJob),
Header.Antagonist => x.Antag.CompareTo(y.Antag),
Header.Playtime => TimeSpan.Compare(x.OverallPlaytime ?? default, y.OverallPlaytime ?? default),
Header.Balance => x.Balance.CompareTo(y.Balance),
_ => 1
};
}; ;
}

private int Compare(string x, string y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class PlayerTabEntry : ContainerButton
{
public NetEntity? PlayerEntity;

public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime, int balance)
public PlayerTabEntry(string username, string character, string identity, string job, string antagonist, StyleBox styleBox, bool connected, string overallPlaytime, string balance)
{
RobustXamlLoader.Load(this);

Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Administration/Systems/AdminSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
var name = data.UserName;
var entityName = string.Empty;
var identityName = string.Empty;
var balance = 0;
int balance = 0;

if (session?.AttachedEntity != null)
{
Expand All @@ -231,6 +231,10 @@ private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
{
balance = comp.Balance;
}
else
{
balance = int.MinValue; // Эквивалент отсутствующего баланса
}
}

var antag = false;
Expand Down

0 comments on commit 4652460

Please sign in to comment.