forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 161
/
Copy pathPlaytimeStatsEntry.cs
31 lines (25 loc) · 1.01 KB
/
PlaytimeStatsEntry.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Content.Shared.Localizations;
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Info.PlaytimeStats;
[GenerateTypedNameReferences]
public sealed partial class PlaytimeStatsEntry : ContainerButton
{
public TimeSpan Playtime { get; private set; } // new TimeSpan property
public PlaytimeStatsEntry(string role, TimeSpan playtime, StyleBox styleBox)
{
RobustXamlLoader.Load(this);
RoleLabel.Text = role;
Playtime = playtime; // store the TimeSpan value directly
PlaytimeLabel.Text = ContentLocalizationManager.FormatPlaytime(playtime); // convert to string for display
BackgroundColorPanel.PanelOverride = styleBox;
}
public void UpdateShading(StyleBoxFlat styleBox)
{
BackgroundColorPanel.PanelOverride = styleBox;
}
public string? PlaytimeText => PlaytimeLabel.Text;
public string? RoleText => RoleLabel.Text;
}