Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp results screen statistics display #24153

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4f4c481
Fix timing distribution graph sometimes not displaying correctly
peppy Jul 12, 2023
e2b5abd
Split bar drawable creation into own method
peppy Jul 13, 2023
21f26f9
Fix graph breaking when resized vertically
peppy Jul 13, 2023
1d62a04
Fix animation restarting unexpectedly
peppy Jul 13, 2023
12e8ac0
Merge branch 'master' into fix-hit-distro-code-quality
peppy Jul 13, 2023
c5dec37
Ensure `PerformanceBreakdown` pieces cannot be null
peppy Jun 28, 2023
890d542
Change order and test population in `TestSceneStatisticsPanel` to giv…
peppy Jun 28, 2023
27fad54
Remove more `GridContainer` nonsense
peppy Jun 28, 2023
deb160c
Show online stats on `TestSceneStatisticsPanel`
peppy Jun 28, 2023
53eb09f
Refactor results screen to use a stable grid layout
peppy Jul 7, 2023
4b229dc
Add background to statistics items
peppy Jul 7, 2023
d27b66c
Switch back to two-column tabular display and readjust height
peppy Jul 7, 2023
2cfe179
Add missing header for statistics table
peppy Jul 7, 2023
07fbaa5
Rename `StatisticContainer` to `StatisticItemContainer`
peppy Jul 7, 2023
5de07b5
Adjust metrics of `OverallRanking`
peppy Jul 7, 2023
65de301
Adjust metrics of `PerformanceBreakdown`
peppy Jul 7, 2023
2ce76dd
Adjust item backgrounds to match close to the rest of the results screen
peppy Jul 7, 2023
b323ae5
Adjust metrics of `AccuracyHeatmap`
peppy Jul 7, 2023
48c1771
Centralise font size specification for statistic items (and reduce sl…
peppy Jul 7, 2023
3d30eee
Adjust metrics of `HitEventTimingDistributionGraph`
peppy Jul 13, 2023
169bd3d
Ensure content is centered in layout
peppy Jul 12, 2023
cf9c757
Add full statistics score to `TestSceneResultsScreen`
peppy Jul 12, 2023
96343c7
Fix test regression
peppy Jul 12, 2023
7021340
Reorder tests for testability
peppy Jul 12, 2023
e8fa872
Add actual statistics changes to better visualise layout
peppy Jul 12, 2023
661dc66
Adjust metrics of `OverallRanking` to fit better
peppy Jul 12, 2023
9fcc1da
Add more padding around header
peppy Jul 12, 2023
1d6ed3b
Reduce application of UI scale at results screen to make things fit b…
peppy Jul 13, 2023
8f21b1f
Split out constant for usable statistics item space
peppy Jul 13, 2023
4bea4be
Adjust metrics for larger display usage
peppy Jul 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions osu.Game.Rulesets.Catch/CatchRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Catch
{
Expand Down Expand Up @@ -218,5 +221,13 @@ public override LocalisableString GetDisplayNameForHitResult(HitResult result)
public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);

public override IBeatmapVerifier CreateBeatmapVerifier() => new CatchBeatmapVerifier();

public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
{
return new[]
{
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap), relativeSize: new Vector2(1, 0.25f)),
};
}
}
}
17 changes: 5 additions & 12 deletions osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Mania
{
Expand Down Expand Up @@ -402,21 +403,13 @@ public override LocalisableString GetDisplayNameForHitResult(HitResult result)

public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap) => new[]
{
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(score.HitEvents)
{
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem(string.Empty, () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap), relativeSize: new Vector2(1, 0.25f)),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(score.HitEvents), true, relativeSize: new Vector2(1, 0.2f)),
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(score.HitEvents),
new UnstableRate(score.HitEvents)
}), true)
}), true, new Vector2(1, 0.1f))
};

public override IRulesetFilterCriteria CreateRulesetFilterCriteria()
Expand Down
22 changes: 7 additions & 15 deletions osu.Game.Rulesets.Osu/OsuRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Osu
{
Expand Down Expand Up @@ -304,26 +305,17 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm

return new[]
{
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(timedHitEvents)
{
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap), relativeSize: new Vector2(1, 0.25f)),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(timedHitEvents), true, relativeSize: new Vector2(0.6f, 0.25f)),
new StatisticItem("Accuracy Heatmap", () => new AccuracyHeatmap(score, playableBeatmap)
{
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem(string.Empty, () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
RelativeSizeAxes = Axes.Both,
}, true, relativeSize: new Vector2(0.4f, 0.25f)),
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(timedHitEvents),
new UnstableRate(timedHitEvents)
}), true)
}), true, new Vector2(1, 0.1f))
};
}

Expand Down
13 changes: 9 additions & 4 deletions osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Scoring;
Expand Down Expand Up @@ -120,18 +121,22 @@ private void load()
new OsuSpriteText
{
Text = "Overshoot",
Font = OsuFont.GetFont(size: 12),
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
Padding = new MarginPadding(3),
Origin = Anchor.BottomLeft,
Padding = new MarginPadding(2),
Rotation = -rotation,
RelativePositionAxes = Axes.Both,
Y = -(inner_portion + line_extension) / 2,
},
new OsuSpriteText
{
Text = "Undershoot",
Font = OsuFont.GetFont(size: 12),
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(3),
Origin = Anchor.TopRight,
Rotation = -rotation,
Padding = new MarginPadding(2),
RelativePositionAxes = Axes.Both,
Y = (inner_portion + line_extension) / 2,
},
Expand Down
17 changes: 5 additions & 12 deletions osu.Game.Rulesets.Taiko/TaikoRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using osu.Game.Rulesets.Configuration;
using osu.Game.Configuration;
using osu.Game.Rulesets.Taiko.Configuration;
using osuTK;

namespace osu.Game.Rulesets.Taiko
{
Expand Down Expand Up @@ -246,21 +247,13 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm

return new[]
{
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(timedHitEvents)
{
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem(string.Empty, () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
new StatisticItem("Performance Breakdown", () => new PerformanceBreakdownChart(score, playableBeatmap), relativeSize: new Vector2(1, 0.25f)),
new StatisticItem("Timing Distribution", () => new HitEventTimingDistributionGraph(timedHitEvents), true, relativeSize: new Vector2(1, 0.2f)),
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(timedHitEvents),
new UnstableRate(timedHitEvents)
}), true)
}), true, new Vector2(1, 0.1f))
};
}
}
Expand Down
53 changes: 29 additions & 24 deletions osu.Game.Tests/Visual/Ranking/TestSceneResultsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ public void TestScaling()
}));
}

[TestCase(1, ScoreRank.X)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(0.975, ScoreRank.S)]
[TestCase(0.925, ScoreRank.A)]
[TestCase(0.85, ScoreRank.B)]
[TestCase(0.75, ScoreRank.C)]
[TestCase(0.5, ScoreRank.D)]
[TestCase(0.2, ScoreRank.D)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{
TestResultsScreen screen = null;

var score = TestResources.CreateTestScoreInfo();

score.OnlineID = 1234;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy;
score.Rank = rank;

loadResultsScreen(() => screen = createResultsScreen(score));
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}

[Test]
public void TestResultsWithoutPlayer()
{
Expand All @@ -82,34 +106,14 @@ public void TestResultsWithoutPlayer()
RelativeSizeAxes = Axes.Both
};

stack.Push(screen = createResultsScreen());
var score = TestResources.CreateTestScoreInfo();

stack.Push(screen = createResultsScreen(score));
});
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay not present", () => screen.RetryOverlay == null);
}

[TestCase(0.2, ScoreRank.D)]
[TestCase(0.5, ScoreRank.D)]
[TestCase(0.75, ScoreRank.C)]
[TestCase(0.85, ScoreRank.B)]
[TestCase(0.925, ScoreRank.A)]
[TestCase(0.975, ScoreRank.S)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(1, ScoreRank.X)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{
TestResultsScreen screen = null;

var score = TestResources.CreateTestScoreInfo();

score.Accuracy = accuracy;
score.Rank = rank;

loadResultsScreen(() => screen = createResultsScreen(score));
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}

[Test]
public void TestResultsForUnranked()
{
Expand Down Expand Up @@ -328,13 +332,14 @@ public TestResultsContainer(IScreen screen)
}
}

private partial class TestResultsScreen : ResultsScreen
private partial class TestResultsScreen : SoloResultsScreen
{
public HotkeyRetryOverlay RetryOverlay;

public TestResultsScreen(ScoreInfo score)
: base(score, true)
{
ShowUserStatistics = true;
}

protected override void LoadComplete()
Expand Down
Loading
Loading