Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d22a361
Remove old elements, add new colours, reshuffle order of some element…
mk56-spn Jan 14, 2023
984ec84
Resize and organise elements in DrawableCarouselBeatmap.cs
mk56-spn Jan 14, 2023
0f3a7ee
Add new icon design to DrawableCarouselBeatmap.cs
mk56-spn Jan 14, 2023
ce7166c
add difficulty spectrum to DrawableCarouselBeatmapSet.cs and adjust r…
mk56-spn Jan 14, 2023
fc288be
Touch up designs, add outer coloured glow
mk56-spn Jan 14, 2023
15701a0
Add a small annotation
mk56-spn Jan 14, 2023
301144d
change mapper osuspritetext to use colourprovider colours
mk56-spn Jan 16, 2023
0d75438
Remove invalid difficulty icon tests
mk56-spn Jan 16, 2023
868c85c
Merge branch 'master' into beatmap_carousel_new_clean
mk56-spn Jan 16, 2023
ef11698
Fix issue with panel content
mk56-spn Jan 16, 2023
c62f5ec
add buffered container to background to allow for uniform opacity
mk56-spn Jan 18, 2023
2160c57
add pixel hack to avoid colour bleed on carousel
mk56-spn Jan 23, 2023
e6d7a84
Merge branch 'master' into beatmap_carousel_new_clean
mk56-spn Feb 21, 2023
d41ac28
Fix leftover unused Drawable from merge
mk56-spn Feb 21, 2023
a1d6ed2
Merge branch 'master' into beatmap_carousel_new_clean
peppy Mar 15, 2023
9b264fe
Remove unused `DifficultyIcon` implementations
peppy Mar 15, 2023
d7079a8
Add basic test scene to `TestSceneBeatmapCarousel`
peppy Mar 15, 2023
4d89b9c
Merge remote-tracking branch 'upstream/master' into pr/22197
Joehuu Sep 8, 2023
ae927d0
Fix param rename after merge
Joehuu Sep 6, 2023
e7ba064
Cache colour provider screen/test-wide
Joehuu Sep 8, 2023
ff396de
Add some way to visualize difficulty colors in test
Joehuu Sep 8, 2023
487a78a
Set 0.00 difficulty color for initial display
Joehuu Sep 8, 2023
0accb84
Use colour underline again instead of padding hack
Joehuu Sep 8, 2023
febb95a
Fix beatmap set header border not being "inner alignment"
Joehuu Sep 8, 2023
c8d3342
Make some hardcoded numbers consts
Joehuu Sep 8, 2023
b8cfba0
Fix missing initial color of colour underline
Joehuu Sep 8, 2023
c0b901c
Change gradient of set header border to horizontal
Joehuu Sep 8, 2023
5e13563
Update makeshift border of difficulty panels
Joehuu Sep 8, 2023
62be06e
Add star rating gradient and slight background gradient
Joehuu Sep 8, 2023
cfcc79e
Remove unnecessary fill flow
Joehuu Sep 8, 2023
1579978
Add shear to carousel panels
Joehuu Sep 8, 2023
717a724
Add right arrow to set panel when selected
Joehuu Sep 8, 2023
c54daac
Add experimental right arrow animations to hide fade overlap imperfec…
Joehuu Sep 8, 2023
5b1929c
Improve edge effect of difficulty panels
Joehuu Sep 9, 2023
518a038
Improve/update edge effect of set panels
Joehuu Sep 9, 2023
575cd12
Rename `HasBorder` to `HasCustomBorder`
Joehuu Sep 9, 2023
f79410b
Add comment explaining colour sampling of set panel border and arrow
Joehuu Sep 9, 2023
c465004
Move const variables above
Joehuu Sep 9, 2023
4874487
Adjust animations
peppy Sep 9, 2023
51ce2f3
Adjust some metrics to match figma
Joehuu Sep 12, 2023
ce2c843
Rewrite colour provider todo to be more understandable
Joehuu Sep 12, 2023
3c3f588
Add placeholder background to hide left arrow content when beatmap ha…
Joehuu Sep 12, 2023
5adeadb
Remove most aliased edges
Joehuu Sep 12, 2023
95bf923
Merge remote-tracking branch 'upstream/master' into pr/22197
Joehuu May 13, 2024
300bcc8
Fix crash due to header children load changing
Joehuu Feb 16, 2024
b3c63a3
Simplify border edge effect
Joehuu May 14, 2024
f6a59b4
Add single beatmap difficulty display
Joehuu May 14, 2024
e113949
Merge remote-tracking branch 'upstream/master' into pr/22197
Joehuu Jul 20, 2024
31c8e3f
Fix diff count tests
Joehuu Jul 21, 2024
62b8780
Merge branch 'master' into beatmap_carousel_new_clean
peppy Aug 19, 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
23 changes: 20 additions & 3 deletions osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Osu;
Expand All @@ -30,6 +32,9 @@ namespace osu.Game.Tests.Visual.SongSelect
[TestFixture]
public partial class TestSceneBeatmapCarousel : OsuManualInputManagerTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);

private TestBeatmapCarousel carousel;
private RulesetStore rulesets;

Expand All @@ -47,6 +52,18 @@ private void load(RulesetStore rulesets)
this.rulesets = rulesets;
}

[Test]
public void TestBasic()
{
loadBeatmaps(setCount: 10, randomDifficulties: true);

AddSliderStep("change star difficulty", 0, 11.9, 5.55, v =>
{
foreach (var hasCurrentValue in carousel.ChildrenOfType<IHasCurrentValue<StarDifficulty>>())
hasCurrentValue.Current.Value = new StarDifficulty(v, 0);
});
}

[Test]
public void TestExternalRulesetChange()
{
Expand Down Expand Up @@ -888,11 +905,11 @@ public void TestSortingWithDifficultyFiltered()
AddStep("Sort by difficulty", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty }, false));

checkVisibleItemCount(false, local_set_count * local_diff_count);
checkVisibleItemCount(true, 1);
checkVisibleItemCount(true, 0);

AddStep("Filter to normal", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Normal" }, false));
checkVisibleItemCount(false, local_set_count);
checkVisibleItemCount(true, 1);
checkVisibleItemCount(true, 0);

AddUntilStep("Check all visible sets have one normal", () =>
{
Expand All @@ -903,7 +920,7 @@ public void TestSortingWithDifficultyFiltered()

AddStep("Filter to insane", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Difficulty, SearchText = "Insane" }, false));
checkVisibleItemCount(false, local_set_count);
checkVisibleItemCount(true, 1);
checkVisibleItemCount(true, 0);

AddUntilStep("Check all visible sets have one insane", () =>
{
Expand Down
188 changes: 0 additions & 188 deletions osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,15 +736,6 @@ public void TestExternalBeatmapChangeWhileFiltered(bool differentRuleset)

AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);

AddAssert("selected only shows expected ruleset (plus converts)", () =>
{
var selectedPanel = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item!.State.Value == CarouselItemState.Selected);

// special case for converts checked here.
return selectedPanel.ChildrenOfType<FilterableDifficultyIcon>().All(i =>
i.IsFiltered || i.Item.BeatmapInfo.Ruleset.OnlineID == targetRuleset || i.Item.BeatmapInfo.Ruleset.OnlineID == 0);
});

AddUntilStep("carousel has correct", () => songSelect!.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
AddUntilStep("game has correct", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(target));

Expand Down Expand Up @@ -886,79 +877,6 @@ public void TestHideSetSelectsCorrectBeatmap()
AddAssert("Selected beatmap has not changed", () => songSelect!.Carousel.SelectedBeatmapInfo?.ID == previousID);
}

[Test]
public void TestDifficultyIconSelecting()
{
addRulesetImportStep(0);
createSongSelect();

AddUntilStep("wait for selection", () => !Beatmap.IsDefault);

DrawableCarouselBeatmapSet set = null!;
AddStep("Find the DrawableCarouselBeatmapSet", () =>
{
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First();
});

FilterableDifficultyIcon difficultyIcon = null!;

AddUntilStep("Find an icon", () =>
{
var foundIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
.FirstOrDefault(icon => getDifficultyIconIndex(set, icon) != getCurrentBeatmapIndex());

if (foundIcon == null)
return false;

difficultyIcon = foundIcon;
return true;
});

AddStep("Click on a difficulty", () =>
{
InputManager.MoveMouseTo(difficultyIcon);

InputManager.Click(MouseButton.Left);
});

AddAssert("Selected beatmap correct", () => getCurrentBeatmapIndex() == getDifficultyIconIndex(set, difficultyIcon));

double? maxBPM = null;
AddStep("Filter some difficulties", () => songSelect!.Carousel.Filter(new FilterCriteria
{
BPM = new FilterCriteria.OptionalRange<double>
{
Min = maxBPM = songSelect!.Carousel.SelectedBeatmapSet!.MaxBPM,
IsLowerInclusive = true
}
}));

BeatmapInfo? filteredBeatmap = null;
FilterableDifficultyIcon? filteredIcon = null;

AddStep("Get filtered icon", () =>
{
var selectedSet = songSelect!.Carousel.SelectedBeatmapSet;

Debug.Assert(selectedSet != null);

filteredBeatmap = selectedSet.Beatmaps.First(b => b.BPM < maxBPM);
int filteredBeatmapIndex = getBeatmapIndex(selectedSet, filteredBeatmap);
filteredIcon = set.ChildrenOfType<FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex);
});

AddStep("Click on a filtered difficulty", () =>
{
Debug.Assert(filteredIcon != null);

InputManager.MoveMouseTo(filteredIcon);

InputManager.Click(MouseButton.Left);
});

AddAssert("Selected beatmap correct", () => songSelect!.Carousel.SelectedBeatmapInfo?.Equals(filteredBeatmap) == true);
}

[Test]
public void TestChangingRulesetOnMultiRulesetBeatmap()
{
Expand Down Expand Up @@ -1008,107 +926,6 @@ public void TestChangingRulesetOnMultiRulesetBeatmap()
void onChange(ValueChangedEvent<WorkingBeatmap> valueChangedEvent) => changeCount++;
}

[Test]
public void TestDifficultyIconSelectingForDifferentRuleset()
{
changeRuleset(0);

createSongSelect();

AddStep("import multi-ruleset map", () =>
{
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
manager.Import(TestResources.CreateTestBeatmapSetInfo(3, usableRulesets));
});

DrawableCarouselBeatmapSet? set = null;
AddUntilStep("Find the DrawableCarouselBeatmapSet", () =>
{
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
return set != null;
});

FilterableDifficultyIcon? difficultyIcon = null;
AddUntilStep("Find an icon for different ruleset", () =>
{
difficultyIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
.FirstOrDefault(icon => icon.Item.BeatmapInfo.Ruleset.OnlineID == 3);
return difficultyIcon != null;
});

AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);

int previousSetID = 0;

AddStep("record set ID", () => previousSetID = ((IBeatmapSetInfo)Beatmap.Value.BeatmapSetInfo).OnlineID);

AddStep("Click on a difficulty", () =>
{
Debug.Assert(difficultyIcon != null);

InputManager.MoveMouseTo(difficultyIcon);

InputManager.Click(MouseButton.Left);
});

AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);

AddAssert("Selected beatmap still same set", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == previousSetID);
AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.OnlineID == 3);
}

[Test]
public void TestGroupedDifficultyIconSelecting()
{
changeRuleset(0);

createSongSelect();

BeatmapSetInfo? imported = null;

AddStep("import huge difficulty count map", () =>
{
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.OnlineID != 2).ToArray();
imported = manager.Import(TestResources.CreateTestBeatmapSetInfo(50, usableRulesets))?.Value;
});

AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported?.Beatmaps.First()));

DrawableCarouselBeatmapSet? set = null;
AddUntilStep("Find the DrawableCarouselBeatmapSet", () =>
{
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
return set != null;
});

GroupedDifficultyIcon groupIcon = null!;

AddUntilStep("Find group icon for different ruleset", () =>
{
var foundIcon = set.ChildrenOfType<GroupedDifficultyIcon>()
.FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.OnlineID == 3);

if (foundIcon == null)
return false;

groupIcon = foundIcon;
return true;
});

AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);

AddStep("Click on group", () =>
{
InputManager.MoveMouseTo(groupIcon);

InputManager.Click(MouseButton.Left);
});

AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);

AddAssert("Check first item in group selected", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(groupIcon.Items.First().BeatmapInfo));
}

[Test]
public void TestChangeRulesetWhilePresentingScore()
{
Expand Down Expand Up @@ -1335,11 +1152,6 @@ private int getCurrentBeatmapIndex()
return getBeatmapIndex(songSelect!.Carousel.SelectedBeatmapSet, songSelect!.Carousel.SelectedBeatmapInfo);
}

private int getDifficultyIconIndex(DrawableCarouselBeatmapSet set, FilterableDifficultyIcon icon)
{
return set.ChildrenOfType<FilterableDifficultyIcon>().ToList().FindIndex(i => i == icon);
}

private void addRulesetImportStep(int id)
{
Live<BeatmapSetInfo>? imported = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ namespace osu.Game.Tests.Visual.SongSelect
[TestFixture]
public partial class TestSceneUpdateBeatmapSetButton : OsuManualInputManagerTestScene
{
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine);

private BeatmapCarousel carousel = null!;

private TestSceneOnlinePlayBeatmapAvailabilityTracker.TestBeatmapModelDownloader beatmapDownloader = null!;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Select/BeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ private void updateYPositions()
// scroll position at currentY makes the set panel appear at the very top of the carousel's screen space
// move down by half of visible height (height of the carousel's visible extent, including semi-transparent areas)
// then reapply the top semi-transparent area (because carousel's screen space starts below it)
scrollTarget = currentY + DrawableCarouselBeatmapSet.HEIGHT - visibleHalfHeight + BleedTop;
scrollTarget = currentY + (set.Beatmaps.Count() == 1 ? 0 : DrawableCarouselBeatmapSet.HEIGHT) - visibleHalfHeight + BleedTop;

foreach (var b in set.Beatmaps)
{
Expand Down
3 changes: 2 additions & 1 deletion osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public override float TotalHeight
switch (State.Value)
{
case CarouselItemState.Selected:
return DrawableCarouselBeatmapSet.HEIGHT + Items.Count(c => c.Visible) * DrawableCarouselBeatmap.HEIGHT;
return DrawableCarouselBeatmapSet.HEIGHT
+ (Items.Count == 1 ? 0 : Items.Count(c => c.Visible) * DrawableCarouselBeatmap.HEIGHT);

default:
return DrawableCarouselBeatmapSet.HEIGHT;
Expand Down
Loading