mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 04:12:55 +08:00
Merge branch 'master' into spotlights-on-top
This commit is contained in:
commit
d71e511413
@ -36,9 +36,9 @@ namespace osu.Game.Tests.Rulesets.Scoring
|
|||||||
[TestCase(ScoringMode.Standardised, HitResult.Meh, 750_000)]
|
[TestCase(ScoringMode.Standardised, HitResult.Meh, 750_000)]
|
||||||
[TestCase(ScoringMode.Standardised, HitResult.Ok, 800_000)]
|
[TestCase(ScoringMode.Standardised, HitResult.Ok, 800_000)]
|
||||||
[TestCase(ScoringMode.Standardised, HitResult.Great, 1_000_000)]
|
[TestCase(ScoringMode.Standardised, HitResult.Great, 1_000_000)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Meh, 41)]
|
[TestCase(ScoringMode.Classic, HitResult.Meh, 20)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Ok, 46)]
|
[TestCase(ScoringMode.Classic, HitResult.Ok, 23)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Great, 72)]
|
[TestCase(ScoringMode.Classic, HitResult.Great, 36)]
|
||||||
public void TestSingleOsuHit(ScoringMode scoringMode, HitResult hitResult, int expectedScore)
|
public void TestSingleOsuHit(ScoringMode scoringMode, HitResult hitResult, int expectedScore)
|
||||||
{
|
{
|
||||||
scoreProcessor.Mode.Value = scoringMode;
|
scoreProcessor.Mode.Value = scoringMode;
|
||||||
@ -86,17 +86,17 @@ namespace osu.Game.Tests.Rulesets.Scoring
|
|||||||
[TestCase(ScoringMode.Standardised, HitResult.SmallBonus, HitResult.SmallBonus, 1_000_030)] // 1 * 300_000 + 700_000 (max combo 0) + 3 * 10 (bonus points)
|
[TestCase(ScoringMode.Standardised, HitResult.SmallBonus, HitResult.SmallBonus, 1_000_030)] // 1 * 300_000 + 700_000 (max combo 0) + 3 * 10 (bonus points)
|
||||||
[TestCase(ScoringMode.Standardised, HitResult.LargeBonus, HitResult.LargeBonus, 1_000_150)] // 1 * 300_000 + 700_000 (max combo 0) + 3 * 50 (bonus points)
|
[TestCase(ScoringMode.Standardised, HitResult.LargeBonus, HitResult.LargeBonus, 1_000_150)] // 1 * 300_000 + 700_000 (max combo 0) + 3 * 50 (bonus points)
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Miss, HitResult.Great, 0)]
|
[TestCase(ScoringMode.Classic, HitResult.Miss, HitResult.Great, 0)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Meh, HitResult.Great, 68)]
|
[TestCase(ScoringMode.Classic, HitResult.Meh, HitResult.Great, 86)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Ok, HitResult.Great, 81)]
|
[TestCase(ScoringMode.Classic, HitResult.Ok, HitResult.Great, 104)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Good, HitResult.Perfect, 109)]
|
[TestCase(ScoringMode.Classic, HitResult.Good, HitResult.Perfect, 140)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Great, HitResult.Great, 149)]
|
[TestCase(ScoringMode.Classic, HitResult.Great, HitResult.Great, 190)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.Perfect, HitResult.Perfect, 149)]
|
[TestCase(ScoringMode.Classic, HitResult.Perfect, HitResult.Perfect, 190)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.SmallTickMiss, HitResult.SmallTickHit, 9)]
|
[TestCase(ScoringMode.Classic, HitResult.SmallTickMiss, HitResult.SmallTickHit, 18)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.SmallTickHit, HitResult.SmallTickHit, 15)]
|
[TestCase(ScoringMode.Classic, HitResult.SmallTickHit, HitResult.SmallTickHit, 31)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.LargeTickMiss, HitResult.LargeTickHit, 0)]
|
[TestCase(ScoringMode.Classic, HitResult.LargeTickMiss, HitResult.LargeTickHit, 0)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.LargeTickHit, HitResult.LargeTickHit, 149)]
|
[TestCase(ScoringMode.Classic, HitResult.LargeTickHit, HitResult.LargeTickHit, 12)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.SmallBonus, HitResult.SmallBonus, 18)]
|
[TestCase(ScoringMode.Classic, HitResult.SmallBonus, HitResult.SmallBonus, 36)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.LargeBonus, HitResult.LargeBonus, 18)]
|
[TestCase(ScoringMode.Classic, HitResult.LargeBonus, HitResult.LargeBonus, 36)]
|
||||||
public void TestFourVariousResultsOneMiss(ScoringMode scoringMode, HitResult hitResult, HitResult maxResult, int expectedScore)
|
public void TestFourVariousResultsOneMiss(ScoringMode scoringMode, HitResult hitResult, HitResult maxResult, int expectedScore)
|
||||||
{
|
{
|
||||||
var minResult = new TestJudgement(hitResult).MinResult;
|
var minResult = new TestJudgement(hitResult).MinResult;
|
||||||
@ -128,8 +128,8 @@ namespace osu.Game.Tests.Rulesets.Scoring
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
[TestCase(ScoringMode.Standardised, HitResult.SmallTickHit, 978_571)] // (3 * 10 + 100) / (4 * 10 + 100) * 300_000 + (1 / 1) * 700_000
|
[TestCase(ScoringMode.Standardised, HitResult.SmallTickHit, 978_571)] // (3 * 10 + 100) / (4 * 10 + 100) * 300_000 + (1 / 1) * 700_000
|
||||||
[TestCase(ScoringMode.Standardised, HitResult.SmallTickMiss, 914_286)] // (3 * 0 + 100) / (4 * 10 + 100) * 300_000 + (1 / 1) * 700_000
|
[TestCase(ScoringMode.Standardised, HitResult.SmallTickMiss, 914_286)] // (3 * 0 + 100) / (4 * 10 + 100) * 300_000 + (1 / 1) * 700_000
|
||||||
[TestCase(ScoringMode.Classic, HitResult.SmallTickHit, 69)] // (((3 * 10 + 100) / (4 * 10 + 100)) * 1 * 300) * (1 + 0 / 25)
|
[TestCase(ScoringMode.Classic, HitResult.SmallTickHit, 34)]
|
||||||
[TestCase(ScoringMode.Classic, HitResult.SmallTickMiss, 60)] // (((3 * 0 + 100) / (4 * 10 + 100)) * 1 * 300) * (1 + 0 / 25)
|
[TestCase(ScoringMode.Classic, HitResult.SmallTickMiss, 30)]
|
||||||
public void TestSmallTicksAccuracy(ScoringMode scoringMode, HitResult hitResult, int expectedScore)
|
public void TestSmallTicksAccuracy(ScoringMode scoringMode, HitResult hitResult, int expectedScore)
|
||||||
{
|
{
|
||||||
IEnumerable<HitObject> hitObjects = Enumerable
|
IEnumerable<HitObject> hitObjects = Enumerable
|
||||||
|
@ -197,6 +197,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new OsuModHidden(),
|
new OsuModHidden(),
|
||||||
@ -234,6 +235,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddSeconds(-30),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -254,6 +256,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddSeconds(-70),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -275,6 +278,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddMinutes(-40),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -296,6 +300,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddHours(-2),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -317,6 +322,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 0.9826,
|
Accuracy = 0.9826,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddHours(-25),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -338,6 +344,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 0.9654,
|
Accuracy = 0.9654,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddHours(-50),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -359,6 +366,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 0.6025,
|
Accuracy = 0.6025,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddHours(-72),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -380,6 +388,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 0.5140,
|
Accuracy = 0.5140,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddMonths(-3),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
@ -401,6 +410,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Accuracy = 0.4222,
|
Accuracy = 0.4222,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
|
Date = DateTime.Now.AddYears(-2),
|
||||||
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Extensions
|
namespace osu.Game.Extensions
|
||||||
{
|
{
|
||||||
@ -47,5 +49,57 @@ namespace osu.Game.Extensions
|
|||||||
|
|
||||||
return new LocalisableFormattableString(timeSpan, @"mm\:ss");
|
return new LocalisableFormattableString(timeSpan, @"mm\:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Formats a provided date to a short relative string version for compact display.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The time to be displayed.</param>
|
||||||
|
/// <param name="lowerCutoff">A timespan denoting the time length beneath which "now" should be displayed.</param>
|
||||||
|
/// <returns>A short relative string representing the input time.</returns>
|
||||||
|
public static string ToShortRelativeTime(this DateTimeOffset time, TimeSpan lowerCutoff)
|
||||||
|
{
|
||||||
|
if (time == default)
|
||||||
|
return "-";
|
||||||
|
|
||||||
|
var now = DateTime.Now;
|
||||||
|
var difference = now - time;
|
||||||
|
|
||||||
|
// 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 < lowerCutoff)
|
||||||
|
return CommonStrings.TimeNow.ToString();
|
||||||
|
|
||||||
|
if (difference.TotalMinutes < 1)
|
||||||
|
return "sec".ToQuantity((int)difference.TotalSeconds);
|
||||||
|
if (difference.TotalHours < 1)
|
||||||
|
return "min".ToQuantity((int)difference.TotalMinutes);
|
||||||
|
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 (time > now.AddMonths(-1))
|
||||||
|
return difference.TotalDays < 2 ? "1dy" : $"{(int)difference.TotalDays}dys";
|
||||||
|
|
||||||
|
for (int months = 1; months <= 11; ++months)
|
||||||
|
{
|
||||||
|
if (time > now.AddMonths(-(months + 1)))
|
||||||
|
return months == 1 ? "1mo" : $"{months}mos";
|
||||||
|
}
|
||||||
|
|
||||||
|
int years = 1;
|
||||||
|
while (time <= now.AddYears(-(years + 1)))
|
||||||
|
years += 1;
|
||||||
|
return years == 1 ? "1yr" : $"{years}yrs";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -16,6 +17,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -56,7 +58,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
public GlowingSpriteText ScoreText { get; private set; }
|
public GlowingSpriteText ScoreText { get; private set; }
|
||||||
|
|
||||||
private Container flagBadgeContainer;
|
private FillFlowContainer flagBadgeAndDateContainer;
|
||||||
private FillFlowContainer<ModIcon> modsContainer;
|
private FillFlowContainer<ModIcon> modsContainer;
|
||||||
|
|
||||||
private List<ScoreComponentLabel> statisticsLabels;
|
private List<ScoreComponentLabel> statisticsLabels;
|
||||||
@ -103,7 +105,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Left = rank_width, },
|
Padding = new MarginPadding { Left = rank_width },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -158,32 +160,41 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(10f, 0f),
|
Spacing = new Vector2(10f, 0f),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
flagBadgeContainer = new Container
|
flagBadgeAndDateContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Size = new Vector2(87f, 20f),
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5f, 0f),
|
||||||
|
Width = 87f,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new UpdateableFlag(user.Country)
|
new UpdateableFlag(user.Country)
|
||||||
{
|
{
|
||||||
Width = 30,
|
Anchor = Anchor.CentreLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
Origin = Anchor.CentreLeft,
|
||||||
|
Size = new Vector2(30f, 20f),
|
||||||
|
},
|
||||||
|
new DateLabel(Score.Date)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Margin = new MarginPadding { Left = edge_margin },
|
Margin = new MarginPadding { Left = edge_margin },
|
||||||
@ -243,7 +254,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
{
|
{
|
||||||
foreach (var d in new[] { avatar, nameLabel, ScoreText, scoreRank, flagBadgeContainer, modsContainer }.Concat(statisticsLabels))
|
foreach (var d in new[] { avatar, nameLabel, ScoreText, scoreRank, flagBadgeAndDateContainer, modsContainer }.Concat(statisticsLabels))
|
||||||
d.FadeOut();
|
d.FadeOut();
|
||||||
|
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
@ -270,7 +281,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
using (BeginDelayedSequence(50))
|
using (BeginDelayedSequence(50))
|
||||||
{
|
{
|
||||||
var drawables = new Drawable[] { flagBadgeContainer, modsContainer }.Concat(statisticsLabels).ToArray();
|
var drawables = new Drawable[] { flagBadgeAndDateContainer, modsContainer }.Concat(statisticsLabels).ToArray();
|
||||||
for (int i = 0; i < drawables.Length; i++)
|
for (int i = 0; i < drawables.Length; i++)
|
||||||
drawables[i].FadeIn(100 + i * 50);
|
drawables[i].FadeIn(100 + i * 50);
|
||||||
}
|
}
|
||||||
@ -377,6 +388,17 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
public LocalisableString TooltipText { get; }
|
public LocalisableString TooltipText { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DateLabel : DrawableDate
|
||||||
|
{
|
||||||
|
public DateLabel(DateTimeOffset date)
|
||||||
|
: base(date)
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 17, weight: FontWeight.Bold, italics: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Format() => Date.ToShortRelativeTime(TimeSpan.FromSeconds(30));
|
||||||
|
}
|
||||||
|
|
||||||
public class LeaderboardScoreStatistic
|
public class LeaderboardScoreStatistic
|
||||||
{
|
{
|
||||||
public IconUsage Icon;
|
public IconUsage Icon;
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Humanizer;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||||
{
|
{
|
||||||
@ -16,41 +15,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override string Format()
|
protected override string Format()
|
||||||
{
|
=> Date.ToShortRelativeTime(TimeSpan.FromHours(1));
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
private double getScore(ScoringMode mode)
|
private double getScore(ScoringMode mode)
|
||||||
{
|
{
|
||||||
return GetScore(mode, maxAchievableCombo,
|
return GetScore(mode,
|
||||||
calculateAccuracyRatio(baseScore),
|
calculateAccuracyRatio(baseScore),
|
||||||
calculateComboRatio(HighestCombo.Value),
|
calculateComboRatio(HighestCombo.Value),
|
||||||
scoreResultCounts);
|
scoreResultCounts);
|
||||||
@ -222,12 +222,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// Computes the total score.
|
/// Computes the total score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
|
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
|
||||||
/// <param name="maxCombo">The maximum combo achievable in the beatmap.</param>
|
|
||||||
/// <param name="accuracyRatio">The accuracy percentage achieved by the player.</param>
|
/// <param name="accuracyRatio">The accuracy percentage achieved by the player.</param>
|
||||||
/// <param name="comboRatio">The proportion of <paramref name="maxCombo"/> achieved by the player.</param>
|
/// <param name="comboRatio">The proportion of the max combo achieved by the player.</param>
|
||||||
/// <param name="statistics">Any statistics to be factored in.</param>
|
/// <param name="statistics">Any statistics to be factored in.</param>
|
||||||
/// <returns>The total score.</returns>
|
/// <returns>The total score.</returns>
|
||||||
public double GetScore(ScoringMode mode, int maxCombo, double accuracyRatio, double comboRatio, Dictionary<HitResult, int> statistics)
|
public double GetScore(ScoringMode mode, double accuracyRatio, double comboRatio, Dictionary<HitResult, int> statistics)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
@ -238,10 +237,16 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
return (max_score * (accuracyScore + comboScore) + getBonusScore(statistics)) * scoreMultiplier;
|
return (max_score * (accuracyScore + comboScore) + getBonusScore(statistics)) * scoreMultiplier;
|
||||||
|
|
||||||
case ScoringMode.Classic:
|
case ScoringMode.Classic:
|
||||||
|
int totalHitObjects = statistics.Where(k => k.Key >= HitResult.Miss && k.Key <= HitResult.Perfect).Sum(k => k.Value);
|
||||||
|
|
||||||
|
// If there are no hitobjects then the beatmap can be composed of only ticks or spinners, so ensure we don't multiply by 0 at all times.
|
||||||
|
if (totalHitObjects == 0)
|
||||||
|
totalHitObjects = 1;
|
||||||
|
|
||||||
// This gives a similar feeling to osu!stable scoring (ScoreV1) while keeping classic scoring as only a constant multiple of standardised scoring.
|
// This gives a similar feeling to osu!stable scoring (ScoreV1) while keeping classic scoring as only a constant multiple of standardised scoring.
|
||||||
// The invariant is important to ensure that scores don't get re-ordered on leaderboards between the two scoring modes.
|
// The invariant is important to ensure that scores don't get re-ordered on leaderboards between the two scoring modes.
|
||||||
double scaledStandardised = GetScore(ScoringMode.Standardised, maxCombo, accuracyRatio, comboRatio, statistics) / max_score;
|
double scaledStandardised = GetScore(ScoringMode.Standardised, accuracyRatio, comboRatio, statistics) / max_score;
|
||||||
return Math.Pow(scaledStandardised * (maxCombo + 1), 2) * 18;
|
return Math.Pow(scaledStandardised * totalHitObjects, 2) * 36;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +270,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
|
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetScore(mode, maxAchievableCombo, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), statistics);
|
return GetScore(mode, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -184,7 +184,7 @@ namespace osu.Game.Scoring
|
|||||||
var scoreProcessor = ruleset.CreateScoreProcessor();
|
var scoreProcessor = ruleset.CreateScoreProcessor();
|
||||||
scoreProcessor.Mods.Value = score.Mods;
|
scoreProcessor.Mods.Value = score.Mods;
|
||||||
|
|
||||||
return (long)Math.Round(scoreProcessor.GetScore(mode, beatmapMaxCombo, accuracy, (double)score.MaxCombo / beatmapMaxCombo, score.Statistics));
|
return (long)Math.Round(scoreProcessor.GetScore(mode, accuracy, (double)score.MaxCombo / beatmapMaxCombo, score.Statistics));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -71,6 +72,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private readonly Func<OsuScreen> createNextScreen;
|
private readonly Func<OsuScreen> createNextScreen;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
|
/// Whether the <see cref="Track"/> is provided by osu! resources, rather than a user beatmap.
|
||||||
/// Only valid during or after <see cref="LogoArriving"/>.
|
/// Only valid during or after <see cref="LogoArriving"/>.
|
||||||
@ -117,7 +121,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
// we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
|
// we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
|
||||||
if (initialBeatmap == null)
|
if (initialBeatmap == null)
|
||||||
{
|
{
|
||||||
if (!loadThemedIntro())
|
// Intro beatmaps are generally made using the osu! ruleset.
|
||||||
|
// It might not be present in test projects for other rulesets.
|
||||||
|
bool osuRulesetPresent = rulesets.GetRuleset(0) != null;
|
||||||
|
|
||||||
|
if (!loadThemedIntro() && osuRulesetPresent)
|
||||||
{
|
{
|
||||||
// if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
|
// if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
|
||||||
// this could happen if a user has nuked their files store. for now, reimport to repair this.
|
// this could happen if a user has nuked their files store. for now, reimport to repair this.
|
||||||
|
Loading…
Reference in New Issue
Block a user