mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge branch 'master' into startup-protocol-handling
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -33,7 +35,10 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
}
|
||||
|
||||
protected override Color4 GetStateColour() => OverlayColourProvider.Orange.Colour1;
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
protected override Color4 GetStateColour() => colours.Orange1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,14 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
});
|
||||
|
||||
Enabled.Value = true;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
updateState();
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
|
||||
Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(),
|
||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
||||
Colour = OverlayColourProvider.Orange.Colour2,
|
||||
Colour = colours.Orange2
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
|
||||
Text = BeatmapsetsStrings.FeaturedArtistBadgeLabel.ToUpper(),
|
||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
||||
Colour = OverlayColourProvider.Blue.Colour1,
|
||||
Colour = colours.Blue1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -2,9 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using Humanizer;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
@ -16,41 +15,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
}
|
||||
|
||||
protected override string Format()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var difference = now - Date;
|
||||
|
||||
// web uses momentjs's custom locales to format the date for the purposes of the scoreboard.
|
||||
// this is intended to be a best-effort, more legible approximation of that.
|
||||
// compare:
|
||||
// * https://github.com/ppy/osu-web/blob/a8f5a68fb435cb19a4faa4c7c4bce08c4f096933/resources/assets/lib/scoreboard-time.tsx
|
||||
// * https://momentjs.com/docs/#/customization/ (reference for the customisation format)
|
||||
|
||||
// TODO: support localisation (probably via `CommonStrings.CountHours()` etc.)
|
||||
// requires pluralisable string support framework-side
|
||||
|
||||
if (difference.TotalHours < 1)
|
||||
return CommonStrings.TimeNow.ToString();
|
||||
if (difference.TotalDays < 1)
|
||||
return "hr".ToQuantity((int)difference.TotalHours);
|
||||
|
||||
// this is where this gets more complicated because of how the calendar works.
|
||||
// since there's no `TotalMonths` / `TotalYears`, we have to iteratively add months/years
|
||||
// and test against cutoff dates to determine how many months/years to show.
|
||||
|
||||
if (Date > now.AddMonths(-1))
|
||||
return difference.TotalDays < 2 ? "1dy" : $"{(int)difference.TotalDays}dys";
|
||||
|
||||
for (int months = 1; months <= 11; ++months)
|
||||
{
|
||||
if (Date > now.AddMonths(-(months + 1)))
|
||||
return months == 1 ? "1mo" : $"{months}mos";
|
||||
}
|
||||
|
||||
int years = 1;
|
||||
while (Date <= now.AddYears(-(years + 1)))
|
||||
years += 1;
|
||||
return years == 1 ? "1yr" : $"{years}yrs";
|
||||
}
|
||||
=> Date.ToShortRelativeTime(TimeSpan.FromHours(1));
|
||||
}
|
||||
}
|
||||
|
@ -11,20 +11,16 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
private readonly OverlayColourScheme colourScheme;
|
||||
|
||||
public static OverlayColourProvider Red { get; } = new OverlayColourProvider(OverlayColourScheme.Red);
|
||||
public static OverlayColourProvider Pink { get; } = new OverlayColourProvider(OverlayColourScheme.Pink);
|
||||
public static OverlayColourProvider Orange { get; } = new OverlayColourProvider(OverlayColourScheme.Orange);
|
||||
public static OverlayColourProvider Lime { get; } = new OverlayColourProvider(OverlayColourScheme.Lime);
|
||||
public static OverlayColourProvider Green { get; } = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
public static OverlayColourProvider Purple { get; } = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
public static OverlayColourProvider Blue { get; } = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
public static OverlayColourProvider Plum { get; } = new OverlayColourProvider(OverlayColourScheme.Plum);
|
||||
|
||||
public OverlayColourProvider(OverlayColourScheme colourScheme)
|
||||
{
|
||||
this.colourScheme = colourScheme;
|
||||
}
|
||||
|
||||
// Note that the following five colours are also defined in `OsuColour` as `{colourScheme}{0,1,2,3,4}`.
|
||||
// The difference as to which should be used where comes down to context.
|
||||
// If the colour in question is supposed to always match the view in which it is displayed theme-wise, use `OverlayColourProvider`.
|
||||
// If the colour usage is special and in general differs from the surrounding view in choice of hue, use the `OsuColour` constants.
|
||||
public Color4 Colour0 => getColour(1, 0.8f);
|
||||
public Color4 Colour1 => getColour(1, 0.7f);
|
||||
public Color4 Colour2 => getColour(0.8f, 0.6f);
|
||||
public Color4 Colour3 => getColour(0.6f, 0.5f);
|
||||
|
Reference in New Issue
Block a user