* refactor(src): Minor refactor of Draw in "AdminNameOverlay. And new info about playtime player * fix(src): Add configure classic admin owerlay * fix * antag status indication rework * the cvars are free, you can just take them * update playerlist on cvar change * more overlay options * 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 * add new option checkboxes * passing ConfigurationManager through constructor, some format changes * made sorting values more futureproof * comments * labels * no point commenting this out when the overlay stack PR will uncomment it again anyway * sorting prototype * localize symbols because why not * symmetry * Revert "localize symbols because why not" This reverts commit 922d4030300285a45777d62fcfd9c74b25fe7a60. * layout and formatting stuff * fix errant space --------- Co-authored-by: Schrödinger <132720404+Schrodinger71@users.noreply.github.com>
106 lines
2.8 KiB
C#
106 lines
2.8 KiB
C#
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Input;
|
|
|
|
namespace Content.Client.Administration.UI.Tabs.PlayerTab;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class PlayerTabHeader : Control
|
|
{
|
|
public event Action<Header>? OnHeaderClicked;
|
|
|
|
public PlayerTabHeader()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
UsernameLabel.OnKeyBindDown += UsernameClicked;
|
|
CharacterLabel.OnKeyBindDown += CharacterClicked;
|
|
JobLabel.OnKeyBindDown += JobClicked;
|
|
RoleTypeLabel.OnKeyBindDown += RoleTypeClicked;
|
|
PlaytimeLabel.OnKeyBindDown += PlaytimeClicked;
|
|
}
|
|
|
|
public Label GetHeader(Header header)
|
|
{
|
|
return header switch
|
|
{
|
|
Header.Username => UsernameLabel,
|
|
Header.Character => CharacterLabel,
|
|
Header.Job => JobLabel,
|
|
Header.RoleType => RoleTypeLabel,
|
|
Header.Playtime => PlaytimeLabel,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(header), header, null)
|
|
};
|
|
}
|
|
|
|
public void ResetHeaderText()
|
|
{
|
|
UsernameLabel.Text = Loc.GetString("player-tab-username");
|
|
CharacterLabel.Text = Loc.GetString("player-tab-character");
|
|
JobLabel.Text = Loc.GetString("player-tab-job");
|
|
RoleTypeLabel.Text = Loc.GetString("player-tab-roletype");
|
|
PlaytimeLabel.Text = Loc.GetString("player-tab-playtime");
|
|
}
|
|
|
|
private void HeaderClicked(GUIBoundKeyEventArgs args, Header header)
|
|
{
|
|
if (args.Function != EngineKeyFunctions.UIClick)
|
|
{
|
|
return;
|
|
}
|
|
|
|
OnHeaderClicked?.Invoke(header);
|
|
args.Handle();
|
|
}
|
|
|
|
private void UsernameClicked(GUIBoundKeyEventArgs args)
|
|
{
|
|
HeaderClicked(args, Header.Username);
|
|
}
|
|
|
|
private void CharacterClicked(GUIBoundKeyEventArgs args)
|
|
{
|
|
HeaderClicked(args, Header.Character);
|
|
}
|
|
|
|
private void JobClicked(GUIBoundKeyEventArgs args)
|
|
{
|
|
HeaderClicked(args, Header.Job);
|
|
}
|
|
|
|
private void RoleTypeClicked(GUIBoundKeyEventArgs args)
|
|
{
|
|
HeaderClicked(args, Header.RoleType);
|
|
}
|
|
|
|
private void PlaytimeClicked(GUIBoundKeyEventArgs args)
|
|
{
|
|
HeaderClicked(args, Header.Playtime);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
if (disposing)
|
|
{
|
|
UsernameLabel.OnKeyBindDown -= UsernameClicked;
|
|
CharacterLabel.OnKeyBindDown -= CharacterClicked;
|
|
JobLabel.OnKeyBindDown -= JobClicked;
|
|
RoleTypeLabel.OnKeyBindDown -= RoleTypeClicked;
|
|
PlaytimeLabel.OnKeyBindDown -= PlaytimeClicked;
|
|
}
|
|
}
|
|
|
|
public enum Header
|
|
{
|
|
Username,
|
|
Character,
|
|
Job,
|
|
RoleType,
|
|
Playtime
|
|
}
|
|
}
|