mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 01:07:25 +08:00
Merge pull request #20349 from vegguid/master
Fixed Leaderboard tooltip not following time format setting
This commit is contained in:
commit
ea0a995cc9
@ -15,6 +15,8 @@ using osu.Framework.Localisation;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
@ -24,6 +26,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
private FillFlowContainer<HitResultCell> topScoreStatistics = null!;
|
||||
private FillFlowContainer<HitResultCell> bottomScoreStatistics = null!;
|
||||
private FillFlowContainer<ModCell> modStatistics = null!;
|
||||
private readonly Bindable<bool> prefer24HourTime = new Bindable<bool>();
|
||||
|
||||
public LeaderboardScoreTooltip()
|
||||
{
|
||||
@ -36,8 +39,9 @@ namespace osu.Game.Online.Leaderboards
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, OsuConfigManager configManager)
|
||||
{
|
||||
configManager.BindWith(OsuSetting.Prefer24HourTime, prefer24HourTime);
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -92,6 +96,13 @@ namespace osu.Game.Online.Leaderboards
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
prefer24HourTime.BindValueChanged(_ => updateTimestampLabel(), true);
|
||||
}
|
||||
|
||||
private ScoreInfo? displayedScore;
|
||||
|
||||
public void SetContent(ScoreInfo score)
|
||||
@ -101,7 +112,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
displayedScore = score;
|
||||
|
||||
timestampLabel.Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}";
|
||||
updateTimestampLabel();
|
||||
|
||||
modStatistics.Clear();
|
||||
topScoreStatistics.Clear();
|
||||
@ -121,6 +132,16 @@ namespace osu.Game.Online.Leaderboards
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTimestampLabel()
|
||||
{
|
||||
if (displayedScore != null)
|
||||
{
|
||||
timestampLabel.Text = prefer24HourTime.Value
|
||||
? $"Played on {displayedScore.Date.ToLocalTime():d MMMM yyyy HH:mm}"
|
||||
: $"Played on {displayedScore.Date.ToLocalTime():d MMMM yyyy h:mm tt}";
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(20, Easing.OutQuint);
|
||||
protected override void PopOut() => this.FadeOut(80, Easing.OutQuint);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user