Files
Delta-v/Content.Client/Info/PlaytimeStats/PlaytimeStatsEntry.cs
T
Milonandstalengd 1c46732b19 fix playtime formatting (#32974) (#2038)
Fixed playtime formatting

Co-authored-by: stalengd <p.zamorskiy@yandex.ru>
2024-10-25 00:15:01 +00:00

32 lines
1.0 KiB
C#

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;
}