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

New leaderboard score card design implementation #22237

Merged
merged 64 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c907751
Set up test scene and basic LeaderBoardScoreV2.cs shape
mk56-spn Jan 16, 2023
b7584b4
Add grid container with sections, add background colours and hover logic
mk56-spn Jan 16, 2023
9ea1515
setup up rank and score logic flow
mk56-spn Jan 16, 2023
9178e3f
Add right side content
mk56-spn Jan 16, 2023
cfbf667
Add flag and user name
mk56-spn Jan 16, 2023
6b889c2
add score component label and animate component
mk56-spn Jan 16, 2023
5a68b30
add statistics to main content
mk56-spn Jan 16, 2023
83b10d6
Adjust widths in statistic labels
mk56-spn Jan 16, 2023
6c30ba2
Add shading to mod pills
mk56-spn Jan 16, 2023
3ccecc2
Add back tooltip
mk56-spn Jan 16, 2023
1df0492
Add tooltip to new mod pills
mk56-spn Jan 16, 2023
7c550e5
fix capitalisation issue in class name
mk56-spn Jan 16, 2023
d73ce1d
Actually fix issue with naming of LeaderboardScoreV2.cs class
mk56-spn Jan 16, 2023
c44891d
clean up linQ result formatting. Replace numbers with hitresult displ…
mk56-spn Jan 17, 2023
4623c04
Add mania score to leaderboard test scene
mk56-spn Jan 23, 2023
70b16d7
Merge remote-tracking branch 'upstream/master' into pr/22237
Joehuu Sep 22, 2023
6ed1685
Fix/update score exporting method
Joehuu Sep 22, 2023
9f9f7eb
Nuke hit results display
Joehuu Sep 22, 2023
2287314
Add relative width slider to test
Joehuu Sep 22, 2023
2bd28e6
Move drawable init properties to constructor
Joehuu Sep 22, 2023
f7f3901
Add user covers to centre content
Joehuu Sep 22, 2023
236352a
Add shadow to centre content
Joehuu Sep 23, 2023
5bea541
Remove weird yellow background override on mods
Joehuu Sep 23, 2023
c0b8b35
Populate dates and add show animation on test
Joehuu Sep 23, 2023
dad0377
Fix leaderboard score caching colour provider
Joehuu Sep 24, 2023
668e083
Use `AutoSizeAxes` instead of hardcoded `Size`
Joehuu Sep 26, 2023
39b008b
Move test scores to a method and add `TestResources.CreateTestScoreIn…
Joehuu Oct 10, 2023
43c8d51
Add draw width statistic to test
Joehuu Oct 10, 2023
6087c12
Use grid container for centre content
Joehuu Oct 11, 2023
bb3f426
Truncate name label and clean up positioning code
Joehuu Oct 11, 2023
837437a
Rename `createRightSideContent()` to `createRightContent()`
Joehuu Oct 11, 2023
e0c6c1b
Fix rank label tooltip area
Joehuu Oct 11, 2023
3ad5a7c
Reduce indents of private container methods
Joehuu Oct 11, 2023
3c1d15d
Fix user cover having shear
Joehuu Oct 11, 2023
e049a07
Update right content to latest design
Joehuu Oct 11, 2023
e4f1eab
Add experimental collapse content logic based on width
Joehuu Oct 11, 2023
ba62498
Add set up steps to reinit drawables with a different relative width
Joehuu Oct 11, 2023
f2aff62
Fix statistics container showing for a brief moment on lower widths
Joehuu Oct 11, 2023
e32be36
Move invalidation issue todo to tests
Joehuu Oct 11, 2023
42d41ad
Remove unused field
Joehuu Oct 11, 2023
f674151
Remove alternative total score display (colour gradient) for now
Joehuu Oct 11, 2023
52be580
Fix date not aligning with flag
Joehuu Oct 11, 2023
6a9f17d
Merge remote-tracking branch 'upstream/master' into pr/22237
Joehuu Oct 11, 2023
f17aa6d
Revert changes to `ModSwitchTiny`
Joehuu Oct 11, 2023
418549b
Modify some half time mods on test
Joehuu Oct 11, 2023
c900c0c
Merge branch 'master' into LeaderBoardScore_clean
peppy Apr 28, 2024
4c4621e
Fix compile errors
Joehuu Apr 29, 2024
32df699
Remove dark border and update cover gradient
Joehuu Apr 29, 2024
2d4f224
Remove total score border gradient
Joehuu May 3, 2024
d0c8b55
Fix fluidity desync by not autosizing right (total score) content
Joehuu May 6, 2024
8a474f7
Fix broken avatar masking when hiding
Joehuu May 6, 2024
e8967ff
Lower username font size a bit
Joehuu May 10, 2024
736e15a
Improve fluidity states
Joehuu May 13, 2024
9b84d8a
Apply missed changes from old leaderboard score
Joehuu May 13, 2024
1f01293
Make scores slanted in test scene
frenzibyte May 25, 2024
35af518
Remove expanded/contracted states and limit to 5 mods
frenzibyte May 25, 2024
5955378
Replace "X mods" text with a pill indicator
frenzibyte May 25, 2024
d395c85
Adjust right content width based on scoring mode
frenzibyte May 25, 2024
2c18c10
Move to `SelectV2` namespace
frenzibyte May 25, 2024
91fb5ed
Move toggle step to `SetUpSteps`
frenzibyte May 25, 2024
8e14c24
Follow slanted flow logic precedent in test
Joehuu May 26, 2024
740a337
Merge branch 'master' into LeaderBoardScore_clean
peppy May 27, 2024
6f729be
Merge branch 'master' into LeaderBoardScore_clean
frenzibyte Jun 7, 2024
5f8f6ca
Use `OsuGame.SHEAR`
frenzibyte Jun 7, 2024
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
184 changes: 184 additions & 0 deletions osu.Game.Tests/Visual/SongSelect/TestSceneLeaderboardScoreV2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
// 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;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.SelectV2.Leaderboards;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using osuTK;

namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneLeaderboardScoreV2 : OsuTestScene
{
[Cached]
private OverlayColourProvider colourProvider { get; set; } = new OverlayColourProvider(OverlayColourScheme.Aquamarine);

[Resolved]
private OsuConfigManager config { get; set; } = null!;

private FillFlowContainer? fillFlow;
private OsuSpriteText? drawWidthText;
private float relativeWidth;

[BackgroundDependencyLoader]
private void load()
{
// TODO: invalidation seems to be one-off when clicking slider to a certain value, so drag for now
// doesn't seem to happen in-game (when toggling window mode)
AddSliderStep("change relative width", 0, 1f, 0.6f, v =>
{
relativeWidth = v;
if (fillFlow != null) fillFlow.Width = v;
});
}

[SetUp]
public void Setup() => Schedule(() =>
{
Children = new Drawable[]
{
fillFlow = new FillFlowContainer
{
Width = relativeWidth,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0f, 2f),
Shear = new Vector2(OsuGame.SHEAR, 0)
},
drawWidthText = new OsuSpriteText(),
};

foreach (var scoreInfo in getTestScores())
{
fillFlow.Add(new LeaderboardScoreV2(scoreInfo, scoreInfo.Position, scoreInfo.User.Id == 2)
{
Shear = Vector2.Zero,
});
}

foreach (var score in fillFlow.Children)
score.Show();
});

[SetUpSteps]
public void SetUpSteps()
{
AddToggleStep("toggle scoring mode", v => config.SetValue(OsuSetting.ScoreDisplayMode, v ? ScoringMode.Classic : ScoringMode.Standardised));
}

protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

if (drawWidthText != null) drawWidthText.Text = $"DrawWidth: {fillFlow?.DrawWidth}";
}

private static ScoreInfo[] getTestScores()
{
var scores = new[]
{
new ScoreInfo
{
Position = 999,
Rank = ScoreRank.X,
Accuracy = 1,
MaxCombo = 244,
TotalScore = RNG.Next(1_800_000, 2_000_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new OsuRuleset().RulesetInfo,
User = new APIUser
{
Id = 6602580,
Username = @"waaiiru",
CountryCode = CountryCode.ES,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
},
Date = DateTimeOffset.Now.AddYears(-2),
},
new ScoreInfo
{
Position = 22333,
Rank = ScoreRank.S,
Accuracy = 0.1f,
MaxCombo = 32040,
TotalScore = RNG.Next(1_200_000, 1_500_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new OsuRuleset().RulesetInfo,
User = new APIUser
{
Id = 1541390,
Username = @"Toukai",
CountryCode = CountryCode.CA,
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg",
},
Date = DateTimeOffset.Now.AddMonths(-6),
},
TestResources.CreateTestScoreInfo(),
new ScoreInfo
{
Position = 110000,
Rank = ScoreRank.B,
Accuracy = 1,
MaxCombo = 244,
TotalScore = RNG.Next(1_000_000, 1_200_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new ManiaRuleset().RulesetInfo,
User = new APIUser
{
Username = @"No cover",
CountryCode = CountryCode.BR,
},
Date = DateTimeOffset.Now,
},
new ScoreInfo
{
Position = 110000,
Rank = ScoreRank.D,
Accuracy = 1,
MaxCombo = 244,
TotalScore = RNG.Next(500_000, 1_000_000),
MaximumStatistics = { { HitResult.Great, 3000 } },
Ruleset = new ManiaRuleset().RulesetInfo,
User = new APIUser
{
Id = 226597,
Username = @"WWWWWWWWWWWWWWWWWWWW",
CountryCode = CountryCode.US,
},
Date = DateTimeOffset.Now,
},
};

scores[2].Rank = ScoreRank.A;
scores[2].TotalScore = RNG.Next(120_000, 400_000);
scores[2].MaximumStatistics[HitResult.Great] = 3000;

scores[1].Mods = new Mod[] { new OsuModHidden(), new OsuModDoubleTime(), new OsuModHardRock(), new OsuModFlashlight() };
scores[2].Mods = new Mod[] { new OsuModHidden(), new OsuModDoubleTime(), new OsuModHardRock(), new OsuModFlashlight(), new OsuModClassic() };
scores[3].Mods = new Mod[] { new OsuModHidden(), new OsuModDoubleTime(), new OsuModHardRock(), new OsuModFlashlight(), new OsuModClassic(), new OsuModDifficultyAdjust() };
scores[4].Mods = new ManiaRuleset().CreateAllMods().ToArray();

return scores;
}
}
}
8 changes: 2 additions & 6 deletions osu.Game/Online/Leaderboards/DrawableRank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ namespace osu.Game.Online.Leaderboards
{
public partial class DrawableRank : CompositeDrawable
{
private readonly ScoreRank rank;

public DrawableRank(ScoreRank rank)
{
this.rank = rank;

RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
FillAspectRatio = 2;
Expand Down Expand Up @@ -57,7 +53,7 @@ public DrawableRank(ScoreRank rank)
Origin = Anchor.Centre,
Spacing = new Vector2(-3, 0),
Padding = new MarginPadding { Top = 5 },
Colour = getRankNameColour(),
Colour = GetRankNameColour(rank),
Font = OsuFont.Numeric.With(size: 25),
Text = GetRankName(rank),
ShadowColour = Color4.Black.Opacity(0.3f),
Expand All @@ -74,7 +70,7 @@ public DrawableRank(ScoreRank rank)
/// <summary>
/// Retrieves the grade text colour.
/// </summary>
private ColourInfo getRankNameColour()
public static ColourInfo GetRankNameColour(ScoreRank rank)
{
switch (rank)
{
Expand Down
6 changes: 3 additions & 3 deletions osu.Game/Rulesets/UI/ModSwitchTiny.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class ModSwitchTiny : CompositeDrawable
public BindableBool Active { get; } = new BindableBool();

public const float DEFAULT_HEIGHT = 30;
private const float width = 73;
public const float WIDTH = 73;

protected readonly IMod Mod;
private readonly bool showExtendedInformation;
Expand Down Expand Up @@ -56,7 +56,7 @@ public ModSwitchTiny(IMod mod, bool showExtendedInformation = false)
Width = 100 + DEFAULT_HEIGHT / 2,
RelativeSizeAxes = Axes.Y,
Masking = true,
X = width,
X = WIDTH,
Margin = new MarginPadding { Left = -DEFAULT_HEIGHT },
Children = new Drawable[]
{
Expand All @@ -77,7 +77,7 @@ public ModSwitchTiny(IMod mod, bool showExtendedInformation = false)
},
new CircularContainer
{
Width = width,
Width = WIDTH,
RelativeSizeAxes = Axes.Y,
Masking = true,
Children = new Drawable[]
Expand Down
Loading
Loading