1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Add colour highlighting recent scores

This commit is contained in:
dekrain 2022-02-19 20:47:30 +01:00
parent 15ed9ec4fa
commit 0d83c5a39a
No known key found for this signature in database
GPG Key ID: E20077A4AB510334

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
@ -390,6 +390,9 @@ namespace osu.Game.Online.Leaderboards
private class DateLabel : DrawableDate
{
public static readonly Colour4 COLOUR_SATURATED = Colour4.Lime;
public static readonly Colour4 COLOUR_UNSATURATED = Colour4.White;
public DateLabel(DateTimeOffset date)
: base(date)
{
@ -398,6 +401,15 @@ namespace osu.Game.Online.Leaderboards
protected override string Format()
{
var now = DateTime.Now;
var difference = now - Date;
const double seconds_to_blank = 60*45;
const double tense_factor = 2.325;
double tf = Math.Pow(difference.TotalSeconds / seconds_to_blank, tense_factor);
Colour = Interpolation.ValueAt(tf, COLOUR_SATURATED, COLOUR_UNSATURATED, 0, 1);
return ScoreboardTimeUtils.FormatDate(Date, TimeSpan.FromSeconds(30));
}
}