1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 10:17:19 +08:00

Merge branch 'fix-timelineZoom-zero' of https://github.com/Drison64/osu into fix-timelineZoom-zero

This commit is contained in:
Drison64 2022-09-17 18:57:36 +02:00
commit 88e6ce575a

View File

@ -15,6 +15,8 @@ using osu.Framework.Localisation;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Framework.Bindables;
using osu.Game.Configuration;
namespace osu.Game.Online.Leaderboards namespace osu.Game.Online.Leaderboards
{ {
@ -24,6 +26,7 @@ namespace osu.Game.Online.Leaderboards
private FillFlowContainer<HitResultCell> topScoreStatistics = null!; private FillFlowContainer<HitResultCell> topScoreStatistics = null!;
private FillFlowContainer<HitResultCell> bottomScoreStatistics = null!; private FillFlowContainer<HitResultCell> bottomScoreStatistics = null!;
private FillFlowContainer<ModCell> modStatistics = null!; private FillFlowContainer<ModCell> modStatistics = null!;
private readonly Bindable<bool> prefer24HourTime = new Bindable<bool>();
public LeaderboardScoreTooltip() public LeaderboardScoreTooltip()
{ {
@ -36,8 +39,9 @@ namespace osu.Game.Online.Leaderboards
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours, OsuConfigManager configManager)
{ {
configManager.BindWith(OsuSetting.Prefer24HourTime, prefer24HourTime);
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box new Box
@ -92,6 +96,13 @@ namespace osu.Game.Online.Leaderboards
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
prefer24HourTime.BindValueChanged(_ => updateTimestampLabel(), true);
}
private ScoreInfo? displayedScore; private ScoreInfo? displayedScore;
public void SetContent(ScoreInfo score) public void SetContent(ScoreInfo score)
@ -101,7 +112,7 @@ namespace osu.Game.Online.Leaderboards
displayedScore = score; displayedScore = score;
timestampLabel.Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}"; updateTimestampLabel();
modStatistics.Clear(); modStatistics.Clear();
topScoreStatistics.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 PopIn() => this.FadeIn(20, Easing.OutQuint);
protected override void PopOut() => this.FadeOut(80, Easing.OutQuint); protected override void PopOut() => this.FadeOut(80, Easing.OutQuint);