mirror of
https://github.com/ppy/osu
synced 2025-04-01 14:38:37 +00:00
Merge branch 'master' into editor-selection-tool
This commit is contained in:
commit
35b6114d01
@ -1 +1 @@
|
|||||||
Subproject commit fc6de01ad6045544991bf278316c9eed8ea01ef1
|
Subproject commit 5da6990a8e68dea852495950996e1362a293dbd5
|
342
osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs
Normal file
342
osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Screens.Select.Carousel;
|
||||||
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
internal class TestCaseBeatmapCarousel : OsuTestCase
|
||||||
|
{
|
||||||
|
private TestBeatmapCarousel carousel;
|
||||||
|
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(CarouselItem),
|
||||||
|
typeof(CarouselGroup),
|
||||||
|
typeof(CarouselGroupEagerSelect),
|
||||||
|
typeof(CarouselBeatmap),
|
||||||
|
typeof(CarouselBeatmapSet),
|
||||||
|
|
||||||
|
typeof(DrawableCarouselItem),
|
||||||
|
typeof(CarouselItemState),
|
||||||
|
|
||||||
|
typeof(DrawableCarouselBeatmap),
|
||||||
|
typeof(DrawableCarouselBeatmapSet),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private readonly Stack<BeatmapSetInfo> selectedSets = new Stack<BeatmapSetInfo>();
|
||||||
|
|
||||||
|
private BeatmapInfo currentSelection;
|
||||||
|
|
||||||
|
private const int set_count = 5;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Add(carousel = new TestBeatmapCarousel
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
});
|
||||||
|
|
||||||
|
List<BeatmapSetInfo> beatmapSets = new List<BeatmapSetInfo>();
|
||||||
|
|
||||||
|
for (int i = 1; i <= set_count; i++)
|
||||||
|
beatmapSets.Add(createTestBeatmapSet(i));
|
||||||
|
|
||||||
|
carousel.SelectionChanged = s => currentSelection = s;
|
||||||
|
|
||||||
|
AddStep("Load Beatmaps", () => { carousel.BeatmapSets = beatmapSets; });
|
||||||
|
|
||||||
|
AddUntilStep(() => carousel.BeatmapSets.Any(), "Wait for load");
|
||||||
|
|
||||||
|
testTraversal();
|
||||||
|
testFiltering();
|
||||||
|
testRandom();
|
||||||
|
testAddRemove();
|
||||||
|
testSorting();
|
||||||
|
|
||||||
|
testRemoveAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureRandomFetchSuccess() =>
|
||||||
|
AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
|
||||||
|
|
||||||
|
private void checkSelected(int set, int? diff = null) =>
|
||||||
|
AddAssert($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
|
||||||
|
{
|
||||||
|
if (diff != null)
|
||||||
|
return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
|
||||||
|
|
||||||
|
return carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Contains(carousel.SelectedBeatmap);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void setSelected(int set, int diff) =>
|
||||||
|
AddStep($"select set{set} diff{diff}", () =>
|
||||||
|
carousel.SelectBeatmap(carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff - 1).First()));
|
||||||
|
|
||||||
|
private void advanceSelection(bool diff, int direction = 1, int count = 1)
|
||||||
|
{
|
||||||
|
if (count == 1)
|
||||||
|
AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
|
||||||
|
carousel.SelectNext(direction, !diff));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
|
||||||
|
carousel.SelectNext(direction, !diff), count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkVisibleItemCount(bool diff, int count) =>
|
||||||
|
AddAssert($"{count} {(diff ? "diffs" : "sets")} visible", () =>
|
||||||
|
carousel.Items.Count(s => (diff ? s.Item is CarouselBeatmap : s.Item is CarouselBeatmapSet) && s.Item.Visible) == count);
|
||||||
|
|
||||||
|
private void nextRandom() =>
|
||||||
|
AddStep("select random next", () =>
|
||||||
|
{
|
||||||
|
carousel.RandomAlgorithm.Value = RandomSelectAlgorithm.RandomPermutation;
|
||||||
|
|
||||||
|
if (!selectedSets.Any() && carousel.SelectedBeatmap != null)
|
||||||
|
selectedSets.Push(carousel.SelectedBeatmapSet);
|
||||||
|
|
||||||
|
carousel.SelectNextRandom();
|
||||||
|
selectedSets.Push(carousel.SelectedBeatmapSet);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void ensureRandomDidntRepeat() =>
|
||||||
|
AddAssert("ensure no repeats", () => selectedSets.Distinct().Count() == selectedSets.Count);
|
||||||
|
|
||||||
|
private void prevRandom() => AddStep("select random last", () =>
|
||||||
|
{
|
||||||
|
carousel.SelectPreviousRandom();
|
||||||
|
selectedSets.Pop();
|
||||||
|
});
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test keyboard traversal
|
||||||
|
/// </summary>
|
||||||
|
private void testTraversal()
|
||||||
|
{
|
||||||
|
advanceSelection(direction: 1, diff: false);
|
||||||
|
checkSelected(1, 1);
|
||||||
|
|
||||||
|
advanceSelection(direction: 1, diff: true);
|
||||||
|
checkSelected(1, 2);
|
||||||
|
|
||||||
|
advanceSelection(direction: -1, diff: false);
|
||||||
|
checkSelected(set_count, 1);
|
||||||
|
|
||||||
|
advanceSelection(direction: -1, diff: true);
|
||||||
|
checkSelected(set_count - 1, 3);
|
||||||
|
|
||||||
|
advanceSelection(diff: false);
|
||||||
|
advanceSelection(diff: false);
|
||||||
|
checkSelected(1, 2);
|
||||||
|
|
||||||
|
advanceSelection(direction: -1, diff: true);
|
||||||
|
advanceSelection(direction: -1, diff: true);
|
||||||
|
checkSelected(set_count, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test filtering
|
||||||
|
/// </summary>
|
||||||
|
private void testFiltering()
|
||||||
|
{
|
||||||
|
// basic filtering
|
||||||
|
|
||||||
|
setSelected(1, 1);
|
||||||
|
|
||||||
|
AddStep("Filter", () => carousel.Filter(new FilterCriteria { SearchText = "set #3!" }, false));
|
||||||
|
checkVisibleItemCount(diff: false, count: 1);
|
||||||
|
checkVisibleItemCount(diff: true, count: 3);
|
||||||
|
checkSelected(3, 1);
|
||||||
|
|
||||||
|
advanceSelection(diff: true, count: 4);
|
||||||
|
checkSelected(3, 2);
|
||||||
|
|
||||||
|
AddStep("Un-filter (debounce)", () => carousel.Filter(new FilterCriteria()));
|
||||||
|
AddUntilStep(() => !carousel.PendingFilterTask, "Wait for debounce");
|
||||||
|
checkVisibleItemCount(diff: false, count: set_count);
|
||||||
|
checkVisibleItemCount(diff: true, count: 3);
|
||||||
|
|
||||||
|
// test filtering some difficulties (and keeping current beatmap set selected).
|
||||||
|
|
||||||
|
setSelected(1, 2);
|
||||||
|
AddStep("Filter some difficulties", () => carousel.Filter(new FilterCriteria { SearchText = "Normal" }, false));
|
||||||
|
checkSelected(1, 1);
|
||||||
|
|
||||||
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
|
checkSelected(1, 1);
|
||||||
|
|
||||||
|
AddStep("Filter all", () => carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false));
|
||||||
|
|
||||||
|
checkVisibleItemCount(false, 0);
|
||||||
|
checkVisibleItemCount(true, 0);
|
||||||
|
AddAssert("Selection is null", () => currentSelection == null);
|
||||||
|
|
||||||
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
|
|
||||||
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test random non-repeating algorithm
|
||||||
|
/// </summary>
|
||||||
|
private void testRandom()
|
||||||
|
{
|
||||||
|
setSelected(1, 1);
|
||||||
|
|
||||||
|
nextRandom();
|
||||||
|
ensureRandomDidntRepeat();
|
||||||
|
nextRandom();
|
||||||
|
ensureRandomDidntRepeat();
|
||||||
|
nextRandom();
|
||||||
|
ensureRandomDidntRepeat();
|
||||||
|
|
||||||
|
prevRandom();
|
||||||
|
ensureRandomFetchSuccess();
|
||||||
|
prevRandom();
|
||||||
|
ensureRandomFetchSuccess();
|
||||||
|
|
||||||
|
nextRandom();
|
||||||
|
ensureRandomDidntRepeat();
|
||||||
|
nextRandom();
|
||||||
|
ensureRandomDidntRepeat();
|
||||||
|
|
||||||
|
nextRandom();
|
||||||
|
AddAssert("ensure repeat", () => selectedSets.Contains(carousel.SelectedBeatmapSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test adding and removing beatmap sets
|
||||||
|
/// </summary>
|
||||||
|
private void testAddRemove()
|
||||||
|
{
|
||||||
|
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 1)));
|
||||||
|
AddStep("Add new set", () => carousel.UpdateBeatmapSet(createTestBeatmapSet(set_count + 2)));
|
||||||
|
|
||||||
|
checkVisibleItemCount(false, set_count + 2);
|
||||||
|
|
||||||
|
AddStep("Remove set", () => carousel.RemoveBeatmapSet(createTestBeatmapSet(set_count + 2)));
|
||||||
|
|
||||||
|
checkVisibleItemCount(false, set_count + 1);
|
||||||
|
|
||||||
|
setSelected(set_count + 1, 1);
|
||||||
|
|
||||||
|
AddStep("Remove set", () => carousel.RemoveBeatmapSet(createTestBeatmapSet(set_count + 1)));
|
||||||
|
|
||||||
|
checkVisibleItemCount(false, set_count);
|
||||||
|
|
||||||
|
checkSelected(set_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test sorting
|
||||||
|
/// </summary>
|
||||||
|
private void testSorting()
|
||||||
|
{
|
||||||
|
AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false));
|
||||||
|
AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz");
|
||||||
|
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
||||||
|
AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testRemoveAll()
|
||||||
|
{
|
||||||
|
setSelected(2, 1);
|
||||||
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
|
||||||
|
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet));
|
||||||
|
checkSelected(2);
|
||||||
|
|
||||||
|
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
||||||
|
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
||||||
|
checkSelected(1);
|
||||||
|
|
||||||
|
AddUntilStep(() =>
|
||||||
|
{
|
||||||
|
if (!carousel.BeatmapSets.Any()) return true;
|
||||||
|
|
||||||
|
carousel.RemoveBeatmapSet(carousel.BeatmapSets.Last());
|
||||||
|
return false;
|
||||||
|
}, "Remove all");
|
||||||
|
|
||||||
|
AddAssert("Selection is null", () => currentSelection == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private BeatmapSetInfo createTestBeatmapSet(int i)
|
||||||
|
{
|
||||||
|
return new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
ID = i,
|
||||||
|
OnlineBeatmapSetID = i,
|
||||||
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
OnlineBeatmapSetID = i,
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = $"peppy{i.ToString().PadLeft(6, '0')}",
|
||||||
|
Title = $"test set #{i}!",
|
||||||
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, i - 1)), 5))
|
||||||
|
},
|
||||||
|
Beatmaps = new List<BeatmapInfo>(new[]
|
||||||
|
{
|
||||||
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = i * 10,
|
||||||
|
Path = "normal.osu",
|
||||||
|
Version = "Normal",
|
||||||
|
StarDifficulty = 2,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
OverallDifficulty = 3.5f,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = i * 10 + 1,
|
||||||
|
Path = "hard.osu",
|
||||||
|
Version = "Hard",
|
||||||
|
StarDifficulty = 5,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
OverallDifficulty = 5,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = i * 10 + 2,
|
||||||
|
Path = "insane.osu",
|
||||||
|
Version = "Insane",
|
||||||
|
StarDifficulty = 6,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
OverallDifficulty = 7,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestBeatmapCarousel : BeatmapCarousel
|
||||||
|
{
|
||||||
|
public new List<DrawableCarouselItem> Items => base.Items;
|
||||||
|
|
||||||
|
public bool PendingFilterTask => FilterTask != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
using osu.Game.Tests.Platform;
|
using osu.Game.Tests.Platform;
|
||||||
|
|
||||||
@ -26,10 +27,28 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(SongSelect),
|
||||||
|
typeof(BeatmapCarousel),
|
||||||
|
|
||||||
|
typeof(CarouselItem),
|
||||||
|
typeof(CarouselGroup),
|
||||||
|
typeof(CarouselGroupEagerSelect),
|
||||||
|
typeof(CarouselBeatmap),
|
||||||
|
typeof(CarouselBeatmapSet),
|
||||||
|
|
||||||
|
typeof(DrawableCarouselItem),
|
||||||
|
typeof(CarouselItemState),
|
||||||
|
|
||||||
|
typeof(DrawableCarouselBeatmap),
|
||||||
|
typeof(DrawableCarouselBeatmapSet),
|
||||||
|
};
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(BeatmapManager baseManager)
|
||||||
{
|
{
|
||||||
PlaySongSelect songSelect;
|
PlaySongSelect songSelect;
|
||||||
|
|
||||||
@ -43,7 +62,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
Func<OsuDbContext> contextFactory = () => context;
|
Func<OsuDbContext> contextFactory = () => context;
|
||||||
|
|
||||||
dependencies.Cache(rulesets = new RulesetStore(contextFactory));
|
dependencies.Cache(rulesets = new RulesetStore(contextFactory));
|
||||||
dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null));
|
dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null)
|
||||||
|
{
|
||||||
|
DefaultBeatmap = baseManager.GetWorkingBeatmap(null)
|
||||||
|
});
|
||||||
|
|
||||||
for (int i = 0; i < 100; i += 10)
|
for (int i = 0; i < 100; i += 10)
|
||||||
manager.Import(createTestBeatmapSet(i));
|
manager.Import(createTestBeatmapSet(i));
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
<Compile Include="Beatmaps\IO\ImportBeatmapTest.cs" />
|
<Compile Include="Beatmaps\IO\ImportBeatmapTest.cs" />
|
||||||
<Compile Include="Resources\Resource.cs" />
|
<Compile Include="Resources\Resource.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoderTest.cs" />
|
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoderTest.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseBeatmapCarousel.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapDetailArea.cs" />
|
<Compile Include="Visual\TestCaseBeatmapDetailArea.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapDetails.cs" />
|
<Compile Include="Visual\TestCaseBeatmapDetails.cs" />
|
||||||
<Compile Include="Visual\TestCaseBeatmapInfoWedge.cs" />
|
<Compile Include="Visual\TestCaseBeatmapInfoWedge.cs" />
|
||||||
|
@ -118,6 +118,8 @@ namespace osu.Game.Beatmaps
|
|||||||
[JsonProperty("difficulty_rating")]
|
[JsonProperty("difficulty_rating")]
|
||||||
public double StarDifficulty { get; set; }
|
public double StarDifficulty { get; set; }
|
||||||
|
|
||||||
|
public override string ToString() => $"{Metadata} [{Version}]";
|
||||||
|
|
||||||
public bool Equals(BeatmapInfo other)
|
public bool Equals(BeatmapInfo other)
|
||||||
{
|
{
|
||||||
if (ID == 0 || other?.ID == 0)
|
if (ID == 0 || other?.ID == 0)
|
||||||
|
@ -374,12 +374,9 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns>
|
/// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns>
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
||||||
{
|
{
|
||||||
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null)
|
|
||||||
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
|
|
||||||
|
|
||||||
if (beatmapInfo.Metadata == null)
|
if (beatmapInfo.Metadata == null)
|
||||||
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ namespace osu.Game.Beatmaps
|
|||||||
public string AudioFile { get; set; }
|
public string AudioFile { get; set; }
|
||||||
public string BackgroundFile { get; set; }
|
public string BackgroundFile { get; set; }
|
||||||
|
|
||||||
|
public override string ToString() => $"{Artist} - {Title} ({Author})";
|
||||||
|
|
||||||
public string[] SearchableTerms => new[]
|
public string[] SearchableTerms => new[]
|
||||||
{
|
{
|
||||||
Author?.Username,
|
Author?.Username,
|
||||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public List<BeatmapSetFileInfo> Files { get; set; }
|
public List<BeatmapSetFileInfo> Files { get; set; }
|
||||||
|
|
||||||
|
public override string ToString() => Metadata.ToString();
|
||||||
|
|
||||||
public bool Protected { get; set; }
|
public bool Protected { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,147 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
|
||||||
{
|
|
||||||
public class BeatmapGroup : IStateful<BeatmapGroupState>
|
|
||||||
{
|
|
||||||
public event Action<BeatmapGroupState> StateChanged;
|
|
||||||
|
|
||||||
public BeatmapPanel SelectedPanel;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fires when one of our difficulties was selected. Will fire on first expand.
|
|
||||||
/// </summary>
|
|
||||||
public Action<BeatmapGroup, BeatmapPanel> SelectionChanged;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
|
||||||
/// </summary>
|
|
||||||
public Action<BeatmapInfo> StartRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> DeleteRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> RestoreHiddenRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapInfo> HideDifficultyRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapInfo> EditRequested;
|
|
||||||
|
|
||||||
public BeatmapSetHeader Header;
|
|
||||||
|
|
||||||
public List<BeatmapPanel> BeatmapPanels;
|
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet;
|
|
||||||
|
|
||||||
private BeatmapGroupState state;
|
|
||||||
|
|
||||||
public BeatmapGroupState State
|
|
||||||
{
|
|
||||||
get { return state; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
state = value;
|
|
||||||
UpdateState();
|
|
||||||
StateChanged?.Invoke(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateState()
|
|
||||||
{
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case BeatmapGroupState.Expanded:
|
|
||||||
Header.State = PanelSelectedState.Selected;
|
|
||||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
|
||||||
if (panel == SelectedPanel)
|
|
||||||
panel.State = PanelSelectedState.Selected;
|
|
||||||
else if (panel.Filtered)
|
|
||||||
panel.State = PanelSelectedState.Hidden;
|
|
||||||
else
|
|
||||||
panel.State = PanelSelectedState.NotSelected;
|
|
||||||
break;
|
|
||||||
case BeatmapGroupState.Collapsed:
|
|
||||||
Header.State = PanelSelectedState.NotSelected;
|
|
||||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
|
||||||
panel.State = PanelSelectedState.Hidden;
|
|
||||||
break;
|
|
||||||
case BeatmapGroupState.Hidden:
|
|
||||||
Header.State = PanelSelectedState.Hidden;
|
|
||||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
|
||||||
panel.State = PanelSelectedState.Hidden;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapManager manager)
|
|
||||||
{
|
|
||||||
if (beatmapSet == null)
|
|
||||||
throw new ArgumentNullException(nameof(beatmapSet));
|
|
||||||
if (manager == null)
|
|
||||||
throw new ArgumentNullException(nameof(manager));
|
|
||||||
|
|
||||||
BeatmapSet = beatmapSet;
|
|
||||||
WorkingBeatmap beatmap = manager.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault());
|
|
||||||
|
|
||||||
Header = new BeatmapSetHeader(beatmap)
|
|
||||||
{
|
|
||||||
GainedSelection = headerGainedSelection,
|
|
||||||
DeleteRequested = b => DeleteRequested(b),
|
|
||||||
RestoreHiddenRequested = b => RestoreHiddenRequested(b),
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
};
|
|
||||||
|
|
||||||
BeatmapPanels = BeatmapSet.Beatmaps.Where(b => !b.Hidden).OrderBy(b => b.RulesetID).ThenBy(b => b.StarDifficulty).Select(b => new BeatmapPanel(b)
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
GainedSelection = panelGainedSelection,
|
|
||||||
HideRequested = p => HideDifficultyRequested?.Invoke(p),
|
|
||||||
StartRequested = p => StartRequested?.Invoke(p.Beatmap),
|
|
||||||
EditRequested = p => EditRequested?.Invoke(p.Beatmap),
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
Header.AddDifficultyIcons(BeatmapPanels);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void headerGainedSelection(BeatmapSetHeader panel)
|
|
||||||
{
|
|
||||||
State = BeatmapGroupState.Expanded;
|
|
||||||
|
|
||||||
//we want to make sure one of our children is selected in the case none have been selected yet.
|
|
||||||
if (SelectedPanel == null)
|
|
||||||
BeatmapPanels.First(p => !p.Filtered).State = PanelSelectedState.Selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void panelGainedSelection(BeatmapPanel panel)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (SelectedPanel == panel) return;
|
|
||||||
|
|
||||||
if (SelectedPanel != null)
|
|
||||||
SelectedPanel.State = PanelSelectedState.NotSelected;
|
|
||||||
SelectedPanel = panel;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
State = BeatmapGroupState.Expanded;
|
|
||||||
SelectionChanged?.Invoke(this, SelectedPanel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum BeatmapGroupState
|
|
||||||
{
|
|
||||||
Collapsed,
|
|
||||||
Expanded,
|
|
||||||
Hidden,
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
||||||
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
||||||
|
|
||||||
Set(OsuSetting.SelectionRandomType, SelectionRandomType.RandomPermutation);
|
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
||||||
|
|
||||||
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ namespace osu.Game.Configuration
|
|||||||
SaveUsername,
|
SaveUsername,
|
||||||
DisplayStarsMinimum,
|
DisplayStarsMinimum,
|
||||||
DisplayStarsMaximum,
|
DisplayStarsMaximum,
|
||||||
SelectionRandomType,
|
RandomSelectAlgorithm,
|
||||||
SnakingInSliders,
|
SnakingInSliders,
|
||||||
SnakingOutSliders,
|
SnakingOutSliders,
|
||||||
ShowFpsDisplay,
|
ShowFpsDisplay,
|
||||||
|
@ -5,11 +5,11 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
{
|
{
|
||||||
public enum SelectionRandomType
|
public enum RandomSelectAlgorithm
|
||||||
{
|
{
|
||||||
[Description("Never repeat")]
|
[Description("Never repeat")]
|
||||||
RandomPermutation,
|
RandomPermutation,
|
||||||
[Description("Random")]
|
[Description("Random")]
|
||||||
Random
|
Random
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,14 +15,19 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
public class SpriteIcon : CompositeDrawable
|
public class SpriteIcon : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly Sprite spriteShadow;
|
private Sprite spriteShadow;
|
||||||
private readonly Sprite spriteMain;
|
private Sprite spriteMain;
|
||||||
|
|
||||||
private Cached layout = new Cached();
|
private Cached layout = new Cached();
|
||||||
private readonly Container shadowVisibility;
|
private Container shadowVisibility;
|
||||||
|
|
||||||
public SpriteIcon()
|
private FontStore store;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(FontStore store)
|
||||||
{
|
{
|
||||||
|
this.store = store;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
shadowVisibility = new Container
|
shadowVisibility = new Container
|
||||||
@ -39,7 +44,7 @@ namespace osu.Game.Graphics
|
|||||||
Y = 2,
|
Y = 2,
|
||||||
Colour = new Color4(0f, 0f, 0f, 0.2f),
|
Colour = new Color4(0f, 0f, 0f, 0.2f),
|
||||||
},
|
},
|
||||||
Alpha = 0,
|
Alpha = shadow ? 1 : 0,
|
||||||
},
|
},
|
||||||
spriteMain = new Sprite
|
spriteMain = new Sprite
|
||||||
{
|
{
|
||||||
@ -49,14 +54,7 @@ namespace osu.Game.Graphics
|
|||||||
FillMode = FillMode.Fit
|
FillMode = FillMode.Fit
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private FontStore store;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(FontStore store)
|
|
||||||
{
|
|
||||||
this.store = store;
|
|
||||||
updateTexture();
|
updateTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,12 +103,15 @@ namespace osu.Game.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool shadow;
|
||||||
public bool Shadow
|
public bool Shadow
|
||||||
{
|
{
|
||||||
get { return spriteShadow.IsPresent; }
|
get { return shadow; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
shadowVisibility.Alpha = value ? 1 : 0;
|
shadow = value;
|
||||||
|
if (shadowVisibility != null)
|
||||||
|
shadowVisibility.Alpha = value ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -72,16 +73,9 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(star_spacing),
|
Spacing = new Vector2(star_spacing),
|
||||||
|
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => new Star { Alpha = minStarAlpha })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < StarCount; i++)
|
|
||||||
{
|
|
||||||
stars.Add(new Star
|
|
||||||
{
|
|
||||||
Alpha = minStarAlpha,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -147,15 +141,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
Size = new Vector2(star_size);
|
Size = new Vector2(star_size);
|
||||||
|
|
||||||
Children = new[]
|
Child = Icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Icon = new SpriteIcon
|
Size = new Vector2(star_size),
|
||||||
{
|
Icon = FontAwesome.fa_star,
|
||||||
Size = new Vector2(star_size),
|
Anchor = Anchor.Centre,
|
||||||
Icon = FontAwesome.fa_star,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
Bindable = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum),
|
||||||
KeyboardStep = 1f
|
KeyboardStep = 1f
|
||||||
},
|
},
|
||||||
new SettingsEnumDropdown<SelectionRandomType>
|
new SettingsEnumDropdown<RandomSelectAlgorithm>
|
||||||
{
|
{
|
||||||
LabelText = "Random beatmap selection",
|
LabelText = "Random selection algorithm",
|
||||||
Bindable = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType),
|
Bindable = config.GetBindable<RandomSelectAlgorithm>(OsuSetting.RandomSelectAlgorithm),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -15,169 +14,166 @@ using osu.Framework.MathUtils;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
|
using osu.Game.Screens.Select.Carousel;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class BeatmapCarousel : OsuScrollContainer
|
public class BeatmapCarousel : OsuScrollContainer
|
||||||
{
|
{
|
||||||
public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap;
|
/// <summary>
|
||||||
|
/// Triggered when the <see cref="BeatmapSets"/> loaded change and are completely loaded.
|
||||||
|
/// </summary>
|
||||||
|
public Action BeatmapSetsChanged;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently selected beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public BeatmapInfo SelectedBeatmap => selectedBeatmap?.Beatmap;
|
||||||
|
|
||||||
|
private CarouselBeatmap selectedBeatmap => selectedBeatmapSet?.Beatmaps.FirstOrDefault(s => s.State == CarouselItemState.Selected);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently selected beatmap set.
|
||||||
|
/// </summary>
|
||||||
|
public BeatmapSetInfo SelectedBeatmapSet => selectedBeatmapSet?.BeatmapSet;
|
||||||
|
|
||||||
|
private CarouselBeatmapSet selectedBeatmapSet;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised when the <see cref="SelectedBeatmap"/> is changed.
|
||||||
|
/// </summary>
|
||||||
|
public Action<BeatmapInfo> SelectionChanged;
|
||||||
|
|
||||||
public override bool HandleInput => AllowSelection;
|
public override bool HandleInput => AllowSelection;
|
||||||
|
|
||||||
public Action BeatmapsChanged;
|
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
|
||||||
|
|
||||||
public IEnumerable<BeatmapSetInfo> Beatmaps
|
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||||
{
|
{
|
||||||
get { return groups.Select(g => g.BeatmapSet); }
|
get { return beatmapSets.Select(g => g.BeatmapSet); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
scrollableContent.Clear(false);
|
CarouselGroup newRoot = new CarouselGroupEagerSelect();
|
||||||
panels.Clear();
|
|
||||||
groups.Clear();
|
|
||||||
|
|
||||||
List<BeatmapGroup> newGroups = null;
|
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
newGroups = value.Select(createGroup).Where(g => g != null).ToList();
|
value.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild);
|
||||||
criteria.Filter(newGroups);
|
newRoot.Filter(activeCriteria);
|
||||||
}).ContinueWith(t =>
|
|
||||||
{
|
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
foreach (var g in newGroups)
|
|
||||||
addGroup(g);
|
|
||||||
|
|
||||||
computeYPositions();
|
// preload drawables as the ctor overhead is quite high currently.
|
||||||
BeatmapsChanged?.Invoke();
|
var _ = newRoot.Drawables;
|
||||||
});
|
}).ContinueWith(_ => Schedule(() =>
|
||||||
});
|
{
|
||||||
|
root = newRoot;
|
||||||
|
scrollableContent.Clear(false);
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
scrollPositionCache.Invalidate();
|
||||||
|
BeatmapSetsChanged?.Invoke();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<float> yPositions = new List<float>();
|
private readonly List<float> yPositions = new List<float>();
|
||||||
|
private Cached itemsCache = new Cached();
|
||||||
|
private Cached scrollPositionCache = new Cached();
|
||||||
|
|
||||||
/// <summary>
|
private readonly Container<DrawableCarouselItem> scrollableContent;
|
||||||
/// Required for now unfortunately.
|
|
||||||
/// </summary>
|
|
||||||
private BeatmapManager manager;
|
|
||||||
|
|
||||||
private readonly Container<Panel> scrollableContent;
|
public Bindable<RandomSelectAlgorithm> RandomAlgorithm = new Bindable<RandomSelectAlgorithm>();
|
||||||
|
private readonly List<CarouselBeatmapSet> previouslyVisitedRandomSets = new List<CarouselBeatmapSet>();
|
||||||
|
private readonly Stack<CarouselBeatmap> randomSelectedBeatmaps = new Stack<CarouselBeatmap>();
|
||||||
|
|
||||||
private readonly List<BeatmapGroup> groups = new List<BeatmapGroup>();
|
protected List<DrawableCarouselItem> Items = new List<DrawableCarouselItem>();
|
||||||
|
private CarouselGroup root = new CarouselGroupEagerSelect();
|
||||||
private Bindable<SelectionRandomType> randomType;
|
|
||||||
private readonly List<BeatmapGroup> seenGroups = new List<BeatmapGroup>();
|
|
||||||
|
|
||||||
private readonly List<Panel> panels = new List<Panel>();
|
|
||||||
|
|
||||||
private readonly Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>> randomSelectedBeatmaps = new Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>>();
|
|
||||||
|
|
||||||
private BeatmapGroup selectedGroup;
|
|
||||||
private BeatmapPanel selectedPanel;
|
|
||||||
|
|
||||||
public BeatmapCarousel()
|
public BeatmapCarousel()
|
||||||
{
|
{
|
||||||
Add(new OsuContextMenuContainer
|
Child = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Child = scrollableContent = new Container<Panel>
|
Child = scrollableContent = new Container<DrawableCarouselItem>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveBeatmap(BeatmapSetInfo beatmapSet)
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Schedule(() => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID)));
|
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
var existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID);
|
||||||
|
|
||||||
|
if (existingSet == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
root.RemoveChild(existingSet);
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet)
|
public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
// todo: this method should be smarter as to not recreate panels that haven't changed, etc.
|
Schedule(() =>
|
||||||
var oldGroup = groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID);
|
|
||||||
|
|
||||||
var newGroup = createGroup(beatmapSet);
|
|
||||||
|
|
||||||
int index = groups.IndexOf(oldGroup);
|
|
||||||
if (index >= 0)
|
|
||||||
groups.RemoveAt(index);
|
|
||||||
|
|
||||||
if (newGroup != null)
|
|
||||||
{
|
{
|
||||||
if (index >= 0)
|
CarouselBeatmapSet existingSet = beatmapSets.FirstOrDefault(b => b.BeatmapSet.ID == beatmapSet.ID);
|
||||||
groups.Insert(index, newGroup);
|
|
||||||
else
|
|
||||||
addGroup(newGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hadSelection = selectedGroup == oldGroup;
|
bool hadSelection = existingSet?.State?.Value == CarouselItemState.Selected;
|
||||||
|
|
||||||
if (hadSelection && newGroup == null)
|
var newSet = createCarouselSet(beatmapSet);
|
||||||
selectedGroup = null;
|
|
||||||
|
|
||||||
Filter(null, false);
|
if (existingSet != null)
|
||||||
|
root.RemoveChild(existingSet);
|
||||||
|
|
||||||
//check if we can/need to maintain our current selection.
|
if (newSet == null)
|
||||||
if (hadSelection && newGroup != null)
|
{
|
||||||
{
|
itemsCache.Invalidate();
|
||||||
var newSelection =
|
SelectNext();
|
||||||
newGroup.BeatmapPanels.Find(p => p.Beatmap.ID == selectedPanel?.Beatmap.ID);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (newSelection == null && oldGroup != null && selectedPanel != null)
|
root.AddChild(newSet);
|
||||||
newSelection = newGroup.BeatmapPanels[Math.Min(newGroup.BeatmapPanels.Count - 1, oldGroup.BeatmapPanels.IndexOf(selectedPanel))];
|
|
||||||
|
|
||||||
selectGroup(newGroup, newSelection);
|
applyActiveCriteria(false, false);
|
||||||
}
|
|
||||||
|
//check if we can/need to maintain our current selection.
|
||||||
|
if (hadSelection)
|
||||||
|
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet);
|
||||||
|
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true)
|
public void SelectBeatmap(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap == null || beatmap.Hidden)
|
if (beatmap?.Hidden != false)
|
||||||
{
|
|
||||||
SelectNext();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (beatmap == SelectedBeatmap) return;
|
foreach (CarouselBeatmapSet group in beatmapSets)
|
||||||
|
|
||||||
foreach (BeatmapGroup group in groups)
|
|
||||||
{
|
{
|
||||||
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
|
var item = group.Beatmaps.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
|
||||||
if (panel != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
selectGroup(group, panel, animated);
|
select(item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action<BeatmapInfo> SelectionChanged;
|
|
||||||
|
|
||||||
public Action StartRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> DeleteRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> RestoreRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapInfo> EditRequested;
|
|
||||||
|
|
||||||
public Action<BeatmapInfo> HideDifficultyRequested;
|
|
||||||
|
|
||||||
private void selectNullBeatmap()
|
|
||||||
{
|
|
||||||
selectedGroup = null;
|
|
||||||
selectedPanel = null;
|
|
||||||
SelectionChanged?.Invoke(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Increment selection in the carousel in a chosen direction.
|
/// Increment selection in the carousel in a chosen direction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -185,331 +181,137 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
||||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||||
{
|
{
|
||||||
// todo: we may want to refactor and remove this as an optimisation in the future.
|
int originalIndex = Items.IndexOf(selectedBeatmap?.Drawables.First());
|
||||||
if (groups.All(g => g.State == BeatmapGroupState.Hidden))
|
|
||||||
{
|
|
||||||
selectNullBeatmap();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int originalIndex = Math.Max(0, groups.IndexOf(selectedGroup));
|
|
||||||
int currentIndex = originalIndex;
|
int currentIndex = originalIndex;
|
||||||
|
|
||||||
// local function to increment the index in the required direction, wrapping over extremities.
|
// local function to increment the index in the required direction, wrapping over extremities.
|
||||||
int incrementIndex() => currentIndex = (currentIndex + direction + groups.Count) % groups.Count;
|
int incrementIndex() => currentIndex = (currentIndex + direction + Items.Count) % Items.Count;
|
||||||
|
|
||||||
// in the case we are skipping difficulties, we want to increment the index once before starting to find out new target
|
while (incrementIndex() != originalIndex)
|
||||||
// (we don't care about the currently selected group).
|
|
||||||
if (skipDifficulties)
|
|
||||||
incrementIndex();
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
var group = groups[currentIndex];
|
var item = Items[currentIndex].Item;
|
||||||
|
|
||||||
if (group.State == BeatmapGroupState.Hidden) continue;
|
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
|
||||||
|
|
||||||
// we are only interested in non-filtered panels.
|
switch (item)
|
||||||
IEnumerable<BeatmapPanel> validPanels = group.BeatmapPanels.Where(p => !p.Filtered);
|
|
||||||
|
|
||||||
// if we are considering difficulties, we need to do a few extrea steps.
|
|
||||||
if (!skipDifficulties)
|
|
||||||
{
|
{
|
||||||
// we want to reverse the panel order if we are searching backwards.
|
case CarouselBeatmap beatmap:
|
||||||
if (direction < 0)
|
if (skipDifficulties) continue;
|
||||||
validPanels = validPanels.Reverse();
|
select(beatmap);
|
||||||
|
return;
|
||||||
// if we are currently on the selected panel, let's try to find a valid difficulty before leaving to the next group.
|
case CarouselBeatmapSet set:
|
||||||
// the first valid difficulty is found by skipping to the selected panel and then one further.
|
if (skipDifficulties)
|
||||||
if (currentIndex == originalIndex)
|
select(set);
|
||||||
validPanels = validPanels.SkipWhile(p => p != selectedPanel).Skip(1);
|
else
|
||||||
|
select(direction > 0 ? set.Beatmaps.First(b => !b.Filtered) : set.Beatmaps.Last(b => !b.Filtered));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var next = validPanels.FirstOrDefault();
|
|
||||||
|
|
||||||
// at this point, we can perform the selection change if we have a valid new target, else continue to increment in the specified direction.
|
|
||||||
if (next != null)
|
|
||||||
{
|
|
||||||
selectGroup(group, next);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} while (incrementIndex() != originalIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<BeatmapGroup> getVisibleGroups() => groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
|
|
||||||
|
|
||||||
public void SelectNextRandom()
|
public void SelectNextRandom()
|
||||||
{
|
{
|
||||||
if (groups.Count == 0)
|
var visible = beatmapSets.Where(s => !s.Filtered).ToList();
|
||||||
|
if (!visible.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var visibleGroups = getVisibleGroups();
|
if (selectedBeatmap != null)
|
||||||
if (!visibleGroups.Any())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (selectedGroup != null)
|
|
||||||
randomSelectedBeatmaps.Push(new KeyValuePair<BeatmapGroup, BeatmapPanel>(selectedGroup, selectedGroup.SelectedPanel));
|
|
||||||
|
|
||||||
BeatmapGroup group;
|
|
||||||
|
|
||||||
if (randomType == SelectionRandomType.RandomPermutation)
|
|
||||||
{
|
{
|
||||||
var notSeenGroups = visibleGroups.Except(seenGroups);
|
randomSelectedBeatmaps.Push(selectedBeatmap);
|
||||||
if (!notSeenGroups.Any())
|
|
||||||
|
// when performing a random, we want to add the current set to the previously visited list
|
||||||
|
// else the user may be "randomised" to the existing selection.
|
||||||
|
if (previouslyVisitedRandomSets.LastOrDefault() != selectedBeatmapSet)
|
||||||
|
previouslyVisitedRandomSets.Add(selectedBeatmapSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
CarouselBeatmapSet set;
|
||||||
|
|
||||||
|
if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation)
|
||||||
|
{
|
||||||
|
var notYetVisitedSets = visible.Except(previouslyVisitedRandomSets).ToList();
|
||||||
|
if (!notYetVisitedSets.Any())
|
||||||
{
|
{
|
||||||
seenGroups.Clear();
|
previouslyVisitedRandomSets.Clear();
|
||||||
notSeenGroups = visibleGroups;
|
notYetVisitedSets = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
group = notSeenGroups.ElementAt(RNG.Next(notSeenGroups.Count()));
|
set = notYetVisitedSets.ElementAt(RNG.Next(notYetVisitedSets.Count));
|
||||||
seenGroups.Add(group);
|
previouslyVisitedRandomSets.Add(set);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
group = visibleGroups.ElementAt(RNG.Next(visibleGroups.Count()));
|
set = visible.ElementAt(RNG.Next(visible.Count));
|
||||||
|
|
||||||
BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)];
|
select(set.Beatmaps.Skip(RNG.Next(set.Beatmaps.Count())).FirstOrDefault());
|
||||||
|
|
||||||
selectGroup(group, panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectPreviousRandom()
|
public void SelectPreviousRandom()
|
||||||
{
|
{
|
||||||
if (!randomSelectedBeatmaps.Any())
|
|
||||||
return;
|
|
||||||
|
|
||||||
var visibleGroups = getVisibleGroups();
|
|
||||||
if (!visibleGroups.Any())
|
|
||||||
return;
|
|
||||||
|
|
||||||
while (randomSelectedBeatmaps.Any())
|
while (randomSelectedBeatmaps.Any())
|
||||||
{
|
{
|
||||||
var beatmapCoordinates = randomSelectedBeatmaps.Pop();
|
var beatmap = randomSelectedBeatmaps.Pop();
|
||||||
var group = beatmapCoordinates.Key;
|
|
||||||
if (visibleGroups.Contains(group))
|
if (!beatmap.Filtered)
|
||||||
{
|
{
|
||||||
selectGroup(group, beatmapCoordinates.Value);
|
if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation)
|
||||||
|
previouslyVisitedRandomSets.Remove(selectedBeatmapSet);
|
||||||
|
select(beatmap);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FilterCriteria criteria = new FilterCriteria();
|
private void select(CarouselItem item)
|
||||||
|
{
|
||||||
|
if (item == null) return;
|
||||||
|
item.State.Value = CarouselItemState.Selected;
|
||||||
|
}
|
||||||
|
|
||||||
private ScheduledDelegate filterTask;
|
private FilterCriteria activeCriteria = new FilterCriteria();
|
||||||
|
|
||||||
|
protected ScheduledDelegate FilterTask;
|
||||||
|
|
||||||
public bool AllowSelection = true;
|
public bool AllowSelection = true;
|
||||||
|
|
||||||
public void FlushPendingFilters()
|
public void FlushPendingFilterOperations()
|
||||||
{
|
{
|
||||||
if (filterTask?.Completed == false)
|
if (FilterTask?.Completed == false)
|
||||||
Filter(null, false);
|
applyActiveCriteria(false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
|
public void Filter(FilterCriteria newCriteria, bool debounce = true)
|
||||||
{
|
{
|
||||||
if (newCriteria != null)
|
if (newCriteria != null)
|
||||||
criteria = newCriteria;
|
activeCriteria = newCriteria;
|
||||||
|
|
||||||
Action perform = delegate
|
applyActiveCriteria(debounce, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyActiveCriteria(bool debounce, bool scroll)
|
||||||
|
{
|
||||||
|
if (root.Children.Any() != true) return;
|
||||||
|
|
||||||
|
void perform()
|
||||||
{
|
{
|
||||||
filterTask = null;
|
FilterTask = null;
|
||||||
|
|
||||||
criteria.Filter(groups);
|
root.Filter(activeCriteria);
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
if (scroll) scrollPositionCache.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
var filtered = new List<BeatmapGroup>(groups);
|
FilterTask?.Cancel();
|
||||||
|
FilterTask = null;
|
||||||
scrollableContent.Clear(false);
|
|
||||||
panels.Clear();
|
|
||||||
groups.Clear();
|
|
||||||
|
|
||||||
foreach (var g in filtered)
|
|
||||||
addGroup(g);
|
|
||||||
|
|
||||||
computeYPositions();
|
|
||||||
|
|
||||||
selectedGroup?.UpdateState();
|
|
||||||
|
|
||||||
if (selectedGroup == null || selectedGroup.State == BeatmapGroupState.Hidden)
|
|
||||||
SelectNext();
|
|
||||||
else
|
|
||||||
selectGroup(selectedGroup, selectedPanel);
|
|
||||||
};
|
|
||||||
|
|
||||||
filterTask?.Cancel();
|
|
||||||
filterTask = null;
|
|
||||||
|
|
||||||
if (debounce)
|
if (debounce)
|
||||||
filterTask = Scheduler.AddDelayed(perform, 250);
|
FilterTask = Scheduler.AddDelayed(perform, 250);
|
||||||
else
|
else
|
||||||
perform();
|
perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScrollToSelected(bool animated = true)
|
private float? scrollTarget;
|
||||||
{
|
|
||||||
float selectedY = computeYPositions(animated);
|
|
||||||
ScrollTo(selectedY, animated);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
|
public void ScrollToSelected() => scrollPositionCache.Invalidate();
|
||||||
{
|
|
||||||
if (beatmapSet.Beatmaps.All(b => b.Hidden))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
foreach (var b in beatmapSet.Beatmaps)
|
|
||||||
{
|
|
||||||
if (b.Metadata == null)
|
|
||||||
b.Metadata = beatmapSet.Metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BeatmapGroup(beatmapSet, manager)
|
|
||||||
{
|
|
||||||
SelectionChanged = (g, p) => selectGroup(g, p),
|
|
||||||
StartRequested = b => StartRequested?.Invoke(),
|
|
||||||
DeleteRequested = b => DeleteRequested?.Invoke(b),
|
|
||||||
RestoreHiddenRequested = s => RestoreRequested?.Invoke(s),
|
|
||||||
EditRequested = b => EditRequested?.Invoke(b),
|
|
||||||
HideDifficultyRequested = b => HideDifficultyRequested?.Invoke(b),
|
|
||||||
State = BeatmapGroupState.Collapsed
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
|
||||||
private void load(BeatmapManager manager, OsuConfigManager config)
|
|
||||||
{
|
|
||||||
this.manager = manager;
|
|
||||||
|
|
||||||
randomType = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addGroup(BeatmapGroup group)
|
|
||||||
{
|
|
||||||
// prevent duplicates by concurrent independent actions trying to add a group
|
|
||||||
if (groups.Any(g => g.BeatmapSet.ID == group.BeatmapSet.ID))
|
|
||||||
return;
|
|
||||||
|
|
||||||
groups.Add(group);
|
|
||||||
panels.Add(group.Header);
|
|
||||||
panels.AddRange(group.BeatmapPanels);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeGroup(BeatmapGroup group)
|
|
||||||
{
|
|
||||||
if (group == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (selectedGroup == group)
|
|
||||||
{
|
|
||||||
if (getVisibleGroups().Count() == 1)
|
|
||||||
selectNullBeatmap();
|
|
||||||
else
|
|
||||||
SelectNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
groups.Remove(group);
|
|
||||||
panels.Remove(group.Header);
|
|
||||||
foreach (var p in group.BeatmapPanels)
|
|
||||||
panels.Remove(p);
|
|
||||||
|
|
||||||
scrollableContent.Remove(group.Header);
|
|
||||||
scrollableContent.RemoveRange(group.BeatmapPanels);
|
|
||||||
|
|
||||||
computeYPositions();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Computes the target Y positions for every panel in the carousel.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The Y position of the currently selected panel.</returns>
|
|
||||||
private float computeYPositions(bool animated = true)
|
|
||||||
{
|
|
||||||
yPositions.Clear();
|
|
||||||
|
|
||||||
float currentY = DrawHeight / 2;
|
|
||||||
float selectedY = currentY;
|
|
||||||
|
|
||||||
foreach (BeatmapGroup group in groups)
|
|
||||||
{
|
|
||||||
movePanel(group.Header, group.State != BeatmapGroupState.Hidden, animated, ref currentY);
|
|
||||||
|
|
||||||
if (group.State == BeatmapGroupState.Expanded)
|
|
||||||
{
|
|
||||||
group.Header.MoveToX(-100, 500, Easing.OutExpo);
|
|
||||||
var headerY = group.Header.Position.Y;
|
|
||||||
|
|
||||||
foreach (BeatmapPanel panel in group.BeatmapPanels)
|
|
||||||
{
|
|
||||||
if (panel == selectedPanel)
|
|
||||||
selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2;
|
|
||||||
|
|
||||||
panel.MoveToX(-50, 500, Easing.OutExpo);
|
|
||||||
|
|
||||||
bool isHidden = panel.State == PanelSelectedState.Hidden;
|
|
||||||
|
|
||||||
//on first display we want to begin hidden under our group's header.
|
|
||||||
if (isHidden || panel.Alpha == 0)
|
|
||||||
panel.MoveToY(headerY);
|
|
||||||
|
|
||||||
movePanel(panel, !isHidden, animated, ref currentY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
group.Header.MoveToX(0, 500, Easing.OutExpo);
|
|
||||||
|
|
||||||
foreach (BeatmapPanel panel in group.BeatmapPanels)
|
|
||||||
{
|
|
||||||
panel.MoveToX(0, 500, Easing.OutExpo);
|
|
||||||
movePanel(panel, false, animated, ref currentY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentY += DrawHeight / 2;
|
|
||||||
scrollableContent.Height = currentY;
|
|
||||||
|
|
||||||
return selectedY;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void movePanel(Panel panel, bool advance, bool animated, ref float currentY)
|
|
||||||
{
|
|
||||||
yPositions.Add(currentY);
|
|
||||||
panel.MoveToY(currentY, animated ? 750 : 0, Easing.OutExpo);
|
|
||||||
|
|
||||||
if (advance)
|
|
||||||
currentY += panel.DrawHeight + 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectGroup(BeatmapGroup group, BeatmapPanel panel = null, bool animated = true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (panel == null || panel.Filtered == true)
|
|
||||||
panel = group.BeatmapPanels.First(p => !p.Filtered);
|
|
||||||
|
|
||||||
if (selectedPanel == panel) return;
|
|
||||||
|
|
||||||
Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group");
|
|
||||||
|
|
||||||
if (selectedGroup != null && selectedGroup != group && selectedGroup.State != BeatmapGroupState.Hidden)
|
|
||||||
selectedGroup.State = BeatmapGroupState.Collapsed;
|
|
||||||
|
|
||||||
group.State = BeatmapGroupState.Expanded;
|
|
||||||
group.SelectedPanel = panel;
|
|
||||||
|
|
||||||
panel.State = PanelSelectedState.Selected;
|
|
||||||
|
|
||||||
if (selectedPanel == panel) return;
|
|
||||||
|
|
||||||
selectedPanel = panel;
|
|
||||||
selectedGroup = group;
|
|
||||||
|
|
||||||
SelectionChanged?.Invoke(panel.Beatmap);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
ScrollToSelected(animated);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
@ -545,68 +347,185 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
if (!itemsCache.IsValid)
|
||||||
|
updateItems();
|
||||||
|
|
||||||
|
if (!scrollPositionCache.IsValid)
|
||||||
|
updateScrollPosition();
|
||||||
|
|
||||||
float drawHeight = DrawHeight;
|
float drawHeight = DrawHeight;
|
||||||
|
|
||||||
// Remove all panels that should no longer be on-screen
|
// Remove all items that should no longer be on-screen
|
||||||
scrollableContent.RemoveAll(delegate(Panel p)
|
scrollableContent.RemoveAll(p => p.Y < Current - p.DrawHeight || p.Y > Current + drawHeight || !p.IsPresent);
|
||||||
{
|
|
||||||
float panelPosY = p.Position.Y;
|
|
||||||
bool remove = panelPosY < Current - p.DrawHeight || panelPosY > Current + drawHeight || !p.IsPresent;
|
|
||||||
return remove;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Find index range of all panels that should be on-screen
|
// Find index range of all items that should be on-screen
|
||||||
Trace.Assert(panels.Count == yPositions.Count);
|
Trace.Assert(Items.Count == yPositions.Count);
|
||||||
|
|
||||||
int firstIndex = yPositions.BinarySearch(Current - Panel.MAX_HEIGHT);
|
int firstIndex = yPositions.BinarySearch(Current - DrawableCarouselItem.MAX_HEIGHT);
|
||||||
if (firstIndex < 0) firstIndex = ~firstIndex;
|
if (firstIndex < 0) firstIndex = ~firstIndex;
|
||||||
int lastIndex = yPositions.BinarySearch(Current + drawHeight);
|
int lastIndex = yPositions.BinarySearch(Current + drawHeight);
|
||||||
if (lastIndex < 0)
|
if (lastIndex < 0) lastIndex = ~lastIndex;
|
||||||
{
|
|
||||||
lastIndex = ~lastIndex;
|
|
||||||
|
|
||||||
// Add the first panel of the last visible beatmap group to preload its data.
|
int notVisibleCount = 0;
|
||||||
if (lastIndex != 0 && panels[lastIndex - 1] is BeatmapSetHeader)
|
|
||||||
lastIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add those panels within the previously found index range that should be displayed.
|
// Add those items within the previously found index range that should be displayed.
|
||||||
for (int i = firstIndex; i < lastIndex; ++i)
|
for (int i = firstIndex; i < lastIndex; ++i)
|
||||||
{
|
{
|
||||||
Panel panel = panels[i];
|
DrawableCarouselItem item = Items[i];
|
||||||
if (panel.State == PanelSelectedState.Hidden)
|
|
||||||
|
if (!item.Item.Visible)
|
||||||
|
{
|
||||||
|
if (!item.IsPresent)
|
||||||
|
notVisibleCount++;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Only add if we're not already part of the content.
|
// Only add if we're not already part of the content.
|
||||||
if (!scrollableContent.Contains(panel))
|
if (!scrollableContent.Contains(item))
|
||||||
{
|
{
|
||||||
// Makes sure headers are always _below_ panels,
|
// Makes sure headers are always _below_ items,
|
||||||
// and depth flows downward.
|
// and depth flows downward.
|
||||||
panel.Depth = i + (panel is BeatmapSetHeader ? panels.Count : 0);
|
item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
||||||
|
|
||||||
switch (panel.LoadState)
|
switch (item.LoadState)
|
||||||
{
|
{
|
||||||
case LoadState.NotLoaded:
|
case LoadState.NotLoaded:
|
||||||
LoadComponentAsync(panel);
|
LoadComponentAsync(item);
|
||||||
break;
|
break;
|
||||||
case LoadState.Loading:
|
case LoadState.Loading:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
scrollableContent.Add(panel);
|
scrollableContent.Add(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update externally controlled state of currently visible panels
|
// this is not actually useful right now, but once we have groups may well be.
|
||||||
|
if (notVisibleCount > 50)
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
|
||||||
|
// Update externally controlled state of currently visible items
|
||||||
// (e.g. x-offset and opacity).
|
// (e.g. x-offset and opacity).
|
||||||
float halfHeight = drawHeight / 2;
|
float halfHeight = drawHeight / 2;
|
||||||
foreach (Panel p in scrollableContent.Children)
|
foreach (DrawableCarouselItem p in scrollableContent.Children)
|
||||||
updatePanel(p, halfHeight);
|
updateItem(p, halfHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CarouselBeatmapSet createCarouselSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
if (beatmapSet.Beatmaps.All(b => b.Hidden))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// todo: remove the need for this.
|
||||||
|
foreach (var b in beatmapSet.Beatmaps)
|
||||||
|
{
|
||||||
|
if (b.Metadata == null)
|
||||||
|
b.Metadata = beatmapSet.Metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
var set = new CarouselBeatmapSet(beatmapSet);
|
||||||
|
|
||||||
|
foreach (var c in set.Beatmaps)
|
||||||
|
{
|
||||||
|
c.State.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
if (v == CarouselItemState.Selected)
|
||||||
|
{
|
||||||
|
selectedBeatmapSet = set;
|
||||||
|
SelectionChanged?.Invoke(c.Beatmap);
|
||||||
|
|
||||||
|
itemsCache.Invalidate();
|
||||||
|
scrollPositionCache.Invalidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes the x-offset of currently visible panels. Makes the carousel appear round.
|
/// Computes the target Y positions for every item in the carousel.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The Y position of the currently selected item.</returns>
|
||||||
|
private void updateItems()
|
||||||
|
{
|
||||||
|
Items = root.Drawables.ToList();
|
||||||
|
|
||||||
|
yPositions.Clear();
|
||||||
|
|
||||||
|
float currentY = DrawHeight / 2;
|
||||||
|
DrawableCarouselBeatmapSet lastSet = null;
|
||||||
|
|
||||||
|
scrollTarget = null;
|
||||||
|
|
||||||
|
foreach (DrawableCarouselItem d in Items)
|
||||||
|
{
|
||||||
|
if (d.IsPresent)
|
||||||
|
{
|
||||||
|
switch (d)
|
||||||
|
{
|
||||||
|
case DrawableCarouselBeatmapSet set:
|
||||||
|
lastSet = set;
|
||||||
|
|
||||||
|
set.MoveToX(set.Item.State == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo);
|
||||||
|
set.MoveToY(currentY, 750, Easing.OutExpo);
|
||||||
|
break;
|
||||||
|
case DrawableCarouselBeatmap beatmap:
|
||||||
|
if (beatmap.Item.State.Value == CarouselItemState.Selected)
|
||||||
|
scrollTarget = currentY + beatmap.DrawHeight / 2 - DrawHeight / 2;
|
||||||
|
|
||||||
|
void performMove(float y, float? startY = null)
|
||||||
|
{
|
||||||
|
if (startY != null) beatmap.MoveTo(new Vector2(0, startY.Value));
|
||||||
|
beatmap.MoveToX(beatmap.Item.State == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo);
|
||||||
|
beatmap.MoveToY(y, 750, Easing.OutExpo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Assert(lastSet != null);
|
||||||
|
|
||||||
|
float? setY = null;
|
||||||
|
if (!d.IsLoaded || beatmap.Alpha == 0) // can't use IsPresent due to DrawableCarouselItem override.
|
||||||
|
setY = lastSet.Y + lastSet.DrawHeight + 5;
|
||||||
|
|
||||||
|
if (d.IsLoaded)
|
||||||
|
performMove(currentY, setY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float y = currentY;
|
||||||
|
d.OnLoadComplete = _ => performMove(y, setY);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
yPositions.Add(currentY);
|
||||||
|
|
||||||
|
if (d.Item.Visible)
|
||||||
|
currentY += d.DrawHeight + 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentY += DrawHeight / 2;
|
||||||
|
scrollableContent.Height = currentY;
|
||||||
|
|
||||||
|
if (selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected)
|
||||||
|
{
|
||||||
|
selectedBeatmapSet = null;
|
||||||
|
SelectionChanged?.Invoke(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemsCache.Validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateScrollPosition()
|
||||||
|
{
|
||||||
|
if (scrollTarget != null) ScrollTo(scrollTarget.Value);
|
||||||
|
scrollPositionCache.Validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Computes the x-offset of currently visible items. Makes the carousel appear round.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dist">
|
/// <param name="dist">
|
||||||
/// Vertical distance from the center of the carousel container
|
/// Vertical distance from the center of the carousel container
|
||||||
@ -624,20 +543,20 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update a panel's x position and multiplicative alpha based on its y position and
|
/// Update a item's x position and multiplicative alpha based on its y position and
|
||||||
/// the current scroll position.
|
/// the current scroll position.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="p">The panel to be updated.</param>
|
/// <param name="p">The item to be updated.</param>
|
||||||
/// <param name="halfHeight">Half the draw height of the carousel container.</param>
|
/// <param name="halfHeight">Half the draw height of the carousel container.</param>
|
||||||
private void updatePanel(Panel p, float halfHeight)
|
private void updateItem(DrawableCarouselItem p, float halfHeight)
|
||||||
{
|
{
|
||||||
var height = p.IsPresent ? p.DrawHeight : 0;
|
var height = p.IsPresent ? p.DrawHeight : 0;
|
||||||
|
|
||||||
float panelDrawY = p.Position.Y - Current + height / 2;
|
float itemDrawY = p.Position.Y - Current + height / 2;
|
||||||
float dist = Math.Abs(1f - panelDrawY / halfHeight);
|
float dist = Math.Abs(1f - itemDrawY / halfHeight);
|
||||||
|
|
||||||
// Setting the origin position serves as an additive position on top of potential
|
// Setting the origin position serves as an additive position on top of potential
|
||||||
// local transformation we may want to apply (e.g. when a panel gets selected, we
|
// local transformation we may want to apply (e.g. when a item gets selected, we
|
||||||
// may want to smoothly transform it leftwards.)
|
// may want to smoothly transform it leftwards.)
|
||||||
p.OriginPosition = new Vector2(-offsetX(dist, halfHeight), 0);
|
p.OriginPosition = new Vector2(-offsetX(dist, halfHeight), 0);
|
||||||
|
|
||||||
|
55
osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs
Normal file
55
osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
|
{
|
||||||
|
public class CarouselBeatmap : CarouselItem
|
||||||
|
{
|
||||||
|
public readonly BeatmapInfo Beatmap;
|
||||||
|
|
||||||
|
public CarouselBeatmap(BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
Beatmap = beatmap;
|
||||||
|
State.Value = CarouselItemState.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DrawableCarouselItem CreateDrawableRepresentation() => new DrawableCarouselBeatmap(this);
|
||||||
|
|
||||||
|
public override void Filter(FilterCriteria criteria)
|
||||||
|
{
|
||||||
|
base.Filter(criteria);
|
||||||
|
|
||||||
|
bool match = criteria.Ruleset == null || Beatmap.RulesetID == criteria.Ruleset.ID || Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(criteria.SearchText))
|
||||||
|
match &=
|
||||||
|
Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteria.SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
|
||||||
|
Beatmap.Version.IndexOf(criteria.SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0;
|
||||||
|
|
||||||
|
Filtered.Value = !match;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
||||||
|
{
|
||||||
|
if (!(other is CarouselBeatmap otherBeatmap))
|
||||||
|
return base.CompareTo(criteria, other);
|
||||||
|
|
||||||
|
switch (criteria.Sort)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case SortMode.Difficulty:
|
||||||
|
var ruleset = Beatmap.RulesetID.CompareTo(otherBeatmap.Beatmap.RulesetID);
|
||||||
|
if (ruleset != 0) return ruleset;
|
||||||
|
|
||||||
|
return Beatmap.StarDifficulty.CompareTo(otherBeatmap.Beatmap.StarDifficulty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() => Beatmap.ToString();
|
||||||
|
}
|
||||||
|
}
|
58
osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
Normal file
58
osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
|
{
|
||||||
|
public class CarouselBeatmapSet : CarouselGroupEagerSelect
|
||||||
|
{
|
||||||
|
public IEnumerable<CarouselBeatmap> Beatmaps => InternalChildren.OfType<CarouselBeatmap>();
|
||||||
|
|
||||||
|
public BeatmapSetInfo BeatmapSet;
|
||||||
|
|
||||||
|
public CarouselBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
|
{
|
||||||
|
BeatmapSet = beatmapSet ?? throw new ArgumentNullException(nameof(beatmapSet));
|
||||||
|
|
||||||
|
beatmapSet.Beatmaps
|
||||||
|
.Where(b => !b.Hidden)
|
||||||
|
.Select(b => new CarouselBeatmap(b))
|
||||||
|
.ForEach(AddChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DrawableCarouselItem CreateDrawableRepresentation() => new DrawableCarouselBeatmapSet(this);
|
||||||
|
|
||||||
|
public override int CompareTo(FilterCriteria criteria, CarouselItem other)
|
||||||
|
{
|
||||||
|
if (!(other is CarouselBeatmapSet otherSet))
|
||||||
|
return base.CompareTo(criteria, other);
|
||||||
|
|
||||||
|
switch (criteria.Sort)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case SortMode.Artist:
|
||||||
|
return string.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
case SortMode.Title:
|
||||||
|
return string.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
case SortMode.Author:
|
||||||
|
return string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
case SortMode.Difficulty:
|
||||||
|
return BeatmapSet.MaxStarDifficulty.CompareTo(otherSet.BeatmapSet.MaxStarDifficulty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Filter(FilterCriteria criteria)
|
||||||
|
{
|
||||||
|
base.Filter(criteria);
|
||||||
|
Filtered.Value = InternalChildren.All(i => i.Filtered);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() => BeatmapSet.ToString();
|
||||||
|
}
|
||||||
|
}
|
91
osu.Game/Screens/Select/Carousel/CarouselGroup.cs
Normal file
91
osu.Game/Screens/Select/Carousel/CarouselGroup.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A group which ensures only one child is selected.
|
||||||
|
/// </summary>
|
||||||
|
public class CarouselGroup : CarouselItem
|
||||||
|
{
|
||||||
|
private readonly List<CarouselItem> items;
|
||||||
|
|
||||||
|
protected override DrawableCarouselItem CreateDrawableRepresentation() => null;
|
||||||
|
|
||||||
|
public IReadOnlyList<CarouselItem> Children => InternalChildren;
|
||||||
|
|
||||||
|
protected List<CarouselItem> InternalChildren = new List<CarouselItem>();
|
||||||
|
|
||||||
|
public override List<DrawableCarouselItem> Drawables
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var drawables = base.Drawables;
|
||||||
|
foreach (var c in InternalChildren)
|
||||||
|
drawables.AddRange(c.Drawables);
|
||||||
|
return drawables;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void RemoveChild(CarouselItem i)
|
||||||
|
{
|
||||||
|
InternalChildren.Remove(i);
|
||||||
|
|
||||||
|
// it's important we do the deselection after removing, so any further actions based on
|
||||||
|
// State.ValueChanged make decisions post-removal.
|
||||||
|
i.State.Value = CarouselItemState.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void AddChild(CarouselItem i)
|
||||||
|
{
|
||||||
|
i.State.ValueChanged += v => ChildItemStateChanged(i, v);
|
||||||
|
InternalChildren.Add(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CarouselGroup(List<CarouselItem> items = null)
|
||||||
|
{
|
||||||
|
if (items != null) InternalChildren = items;
|
||||||
|
|
||||||
|
State.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
switch (v)
|
||||||
|
{
|
||||||
|
case CarouselItemState.Collapsed:
|
||||||
|
case CarouselItemState.NotSelected:
|
||||||
|
InternalChildren.ForEach(c => c.State.Value = CarouselItemState.Collapsed);
|
||||||
|
break;
|
||||||
|
case CarouselItemState.Selected:
|
||||||
|
InternalChildren.ForEach(c =>
|
||||||
|
{
|
||||||
|
if (c.State == CarouselItemState.Collapsed) c.State.Value = CarouselItemState.NotSelected;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Filter(FilterCriteria criteria)
|
||||||
|
{
|
||||||
|
base.Filter(criteria);
|
||||||
|
InternalChildren.Sort((x, y) => x.CompareTo(criteria, y));
|
||||||
|
InternalChildren.ForEach(c => c.Filter(criteria));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
|
||||||
|
{
|
||||||
|
// ensure we are the only item selected
|
||||||
|
if (value == CarouselItemState.Selected)
|
||||||
|
{
|
||||||
|
foreach (var b in InternalChildren)
|
||||||
|
{
|
||||||
|
if (item == b) continue;
|
||||||
|
b.State.Value = CarouselItemState.NotSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
State.Value = CarouselItemState.Selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
104
osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs
Normal file
104
osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A group which ensures at least one child is selected (if the group itself is selected).
|
||||||
|
/// </summary>
|
||||||
|
public class CarouselGroupEagerSelect : CarouselGroup
|
||||||
|
{
|
||||||
|
public CarouselGroupEagerSelect()
|
||||||
|
{
|
||||||
|
State.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
if (v == CarouselItemState.Selected)
|
||||||
|
attemptSelection();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// We need to keep track of the index for cases where the selection is removed but we want to select a new item based on its old location.
|
||||||
|
/// </summary>
|
||||||
|
private int lastSelectedIndex;
|
||||||
|
|
||||||
|
private CarouselItem lastSelected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To avoid overhead during filter operations, we don't attempt any selections until after all
|
||||||
|
/// children have been filtered. This bool will be true during the base <see cref="Filter(FilterCriteria)"/>
|
||||||
|
/// operation.
|
||||||
|
/// </summary>
|
||||||
|
private bool filteringChildren;
|
||||||
|
|
||||||
|
public override void Filter(FilterCriteria criteria)
|
||||||
|
{
|
||||||
|
filteringChildren = true;
|
||||||
|
base.Filter(criteria);
|
||||||
|
filteringChildren = false;
|
||||||
|
|
||||||
|
attemptSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void RemoveChild(CarouselItem i)
|
||||||
|
{
|
||||||
|
base.RemoveChild(i);
|
||||||
|
|
||||||
|
if (i != lastSelected)
|
||||||
|
updateSelectedIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddChild(CarouselItem i)
|
||||||
|
{
|
||||||
|
base.AddChild(i);
|
||||||
|
attemptSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ChildItemStateChanged(CarouselItem item, CarouselItemState value)
|
||||||
|
{
|
||||||
|
base.ChildItemStateChanged(item, value);
|
||||||
|
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case CarouselItemState.Selected:
|
||||||
|
updateSelected(item);
|
||||||
|
break;
|
||||||
|
case CarouselItemState.NotSelected:
|
||||||
|
case CarouselItemState.Collapsed:
|
||||||
|
attemptSelection();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attemptSelection()
|
||||||
|
{
|
||||||
|
if (filteringChildren) return;
|
||||||
|
|
||||||
|
// we only perform eager selection if we are a currently selected group.
|
||||||
|
if (State != CarouselItemState.Selected) return;
|
||||||
|
|
||||||
|
// we only perform eager selection if none of our children are in a selected state already.
|
||||||
|
if (Children.Any(i => i.State == CarouselItemState.Selected)) return;
|
||||||
|
|
||||||
|
CarouselItem nextToSelect =
|
||||||
|
Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered) ??
|
||||||
|
Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered);
|
||||||
|
|
||||||
|
if (nextToSelect != null)
|
||||||
|
nextToSelect.State.Value = CarouselItemState.Selected;
|
||||||
|
else
|
||||||
|
updateSelected(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSelected(CarouselItem newSelection)
|
||||||
|
{
|
||||||
|
lastSelected = newSelection;
|
||||||
|
updateSelectedIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSelectedIndex() => lastSelectedIndex = lastSelected == null ? 0 : Math.Max(0, InternalChildren.IndexOf(lastSelected));
|
||||||
|
}
|
||||||
|
}
|
62
osu.Game/Screens/Select/Carousel/CarouselItem.cs
Normal file
62
osu.Game/Screens/Select/Carousel/CarouselItem.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
|
{
|
||||||
|
public abstract class CarouselItem
|
||||||
|
{
|
||||||
|
public readonly BindableBool Filtered = new BindableBool();
|
||||||
|
|
||||||
|
public readonly Bindable<CarouselItemState> State = new Bindable<CarouselItemState>(CarouselItemState.NotSelected);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This item is not in a hidden state.
|
||||||
|
/// </summary>
|
||||||
|
public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered;
|
||||||
|
|
||||||
|
public virtual List<DrawableCarouselItem> Drawables
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var items = new List<DrawableCarouselItem>();
|
||||||
|
|
||||||
|
var self = drawableRepresentation.Value;
|
||||||
|
if (self?.IsPresent == true) items.Add(self);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CarouselItem()
|
||||||
|
{
|
||||||
|
drawableRepresentation = new Lazy<DrawableCarouselItem>(CreateDrawableRepresentation);
|
||||||
|
|
||||||
|
Filtered.ValueChanged += v =>
|
||||||
|
{
|
||||||
|
if (v && State == CarouselItemState.Selected)
|
||||||
|
State.Value = CarouselItemState.NotSelected;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Lazy<DrawableCarouselItem> drawableRepresentation;
|
||||||
|
|
||||||
|
protected abstract DrawableCarouselItem CreateDrawableRepresentation();
|
||||||
|
|
||||||
|
public virtual void Filter(FilterCriteria criteria)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => GetHashCode().CompareTo(other.GetHashCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum CarouselItemState
|
||||||
|
{
|
||||||
|
Collapsed,
|
||||||
|
NotSelected,
|
||||||
|
Selected,
|
||||||
|
}
|
||||||
|
}
|
@ -2,85 +2,56 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
{
|
{
|
||||||
public class BeatmapPanel : Panel, IHasContextMenu
|
public class DrawableCarouselBeatmap : DrawableCarouselItem, IHasContextMenu
|
||||||
{
|
{
|
||||||
public BeatmapInfo Beatmap;
|
private readonly BeatmapInfo beatmap;
|
||||||
private readonly Sprite background;
|
|
||||||
|
|
||||||
public Action<BeatmapPanel> GainedSelection;
|
private Sprite background;
|
||||||
public Action<BeatmapPanel> StartRequested;
|
|
||||||
public Action<BeatmapPanel> EditRequested;
|
|
||||||
public Action<BeatmapInfo> HideRequested;
|
|
||||||
|
|
||||||
private readonly Triangles triangles;
|
private Action<BeatmapInfo> startRequested;
|
||||||
private readonly StarCounter starCounter;
|
private Action<BeatmapInfo> editRequested;
|
||||||
|
private Action<BeatmapInfo> hideRequested;
|
||||||
|
|
||||||
protected override void Selected()
|
private Triangles triangles;
|
||||||
|
private StarCounter starCounter;
|
||||||
|
|
||||||
|
public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel)
|
||||||
{
|
{
|
||||||
base.Selected();
|
beatmap = panel.Beatmap;
|
||||||
|
|
||||||
GainedSelection?.Invoke(this);
|
|
||||||
|
|
||||||
background.Colour = ColourInfo.GradientVertical(
|
|
||||||
new Color4(20, 43, 51, 255),
|
|
||||||
new Color4(40, 86, 102, 255));
|
|
||||||
|
|
||||||
triangles.Colour = Color4.White;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Deselected()
|
|
||||||
{
|
|
||||||
base.Deselected();
|
|
||||||
|
|
||||||
background.Colour = new Color4(20, 43, 51, 255);
|
|
||||||
triangles.Colour = OsuColour.Gray(0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
|
||||||
{
|
|
||||||
if (State == PanelSelectedState.Selected)
|
|
||||||
StartRequested?.Invoke(this);
|
|
||||||
|
|
||||||
return base.OnClick(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BindableBool Filtered = new BindableBool();
|
|
||||||
|
|
||||||
protected override void ApplyState(PanelSelectedState last = PanelSelectedState.Hidden)
|
|
||||||
{
|
|
||||||
if (!IsLoaded) return;
|
|
||||||
|
|
||||||
base.ApplyState(last);
|
|
||||||
|
|
||||||
if (last == PanelSelectedState.Hidden && State != last)
|
|
||||||
starCounter.ReplayAnimation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapPanel(BeatmapInfo beatmap)
|
|
||||||
{
|
|
||||||
if (beatmap == null)
|
|
||||||
throw new ArgumentNullException(nameof(beatmap));
|
|
||||||
|
|
||||||
Beatmap = beatmap;
|
|
||||||
Height *= 0.60f;
|
Height *= 0.60f;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(SongSelect songSelect, BeatmapManager manager)
|
||||||
|
{
|
||||||
|
if (songSelect != null)
|
||||||
|
{
|
||||||
|
startRequested = songSelect.Start;
|
||||||
|
editRequested = songSelect.Edit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manager != null)
|
||||||
|
hideRequested = manager.Hide;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -160,11 +131,46 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Selected()
|
||||||
|
{
|
||||||
|
base.Selected();
|
||||||
|
|
||||||
|
background.Colour = ColourInfo.GradientVertical(
|
||||||
|
new Color4(20, 43, 51, 255),
|
||||||
|
new Color4(40, 86, 102, 255));
|
||||||
|
|
||||||
|
triangles.Colour = Color4.White;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Deselected()
|
||||||
|
{
|
||||||
|
base.Deselected();
|
||||||
|
|
||||||
|
background.Colour = new Color4(20, 43, 51, 255);
|
||||||
|
triangles.Colour = OsuColour.Gray(0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
if (Item.State == CarouselItemState.Selected)
|
||||||
|
startRequested?.Invoke(beatmap);
|
||||||
|
|
||||||
|
return base.OnClick(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void ApplyState()
|
||||||
|
{
|
||||||
|
if (Item.State.Value != CarouselItemState.Collapsed && Alpha == 0)
|
||||||
|
starCounter.ReplayAnimation();
|
||||||
|
|
||||||
|
base.ApplyState();
|
||||||
|
}
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
{
|
{
|
||||||
new OsuMenuItem("Play", MenuItemType.Highlighted, () => StartRequested?.Invoke(this)),
|
new OsuMenuItem("Play", MenuItemType.Highlighted, () => startRequested?.Invoke(beatmap)),
|
||||||
new OsuMenuItem("Edit", MenuItemType.Standard, () => EditRequested?.Invoke(this)),
|
new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested?.Invoke(beatmap)),
|
||||||
new OsuMenuItem("Hide", MenuItemType.Destructive, () => HideRequested?.Invoke(Beatmap)),
|
new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested?.Invoke(beatmap)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,68 +4,57 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Localisation;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
{
|
{
|
||||||
public class BeatmapSetHeader : Panel, IHasContextMenu
|
public class DrawableCarouselBeatmapSet : DrawableCarouselItem, IHasContextMenu
|
||||||
{
|
{
|
||||||
public Action<BeatmapSetHeader> GainedSelection;
|
private Action<BeatmapSetInfo> deleteRequested;
|
||||||
|
private Action<BeatmapSetInfo> restoreHiddenRequested;
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> DeleteRequested;
|
private readonly BeatmapSetInfo beatmapSet;
|
||||||
|
|
||||||
public Action<BeatmapSetInfo> RestoreHiddenRequested;
|
|
||||||
|
|
||||||
private readonly WorkingBeatmap beatmap;
|
|
||||||
|
|
||||||
private readonly FillFlowContainer difficultyIcons;
|
private readonly FillFlowContainer difficultyIcons;
|
||||||
|
|
||||||
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
public DrawableCarouselBeatmapSet(CarouselBeatmapSet set)
|
||||||
|
: base(set)
|
||||||
{
|
{
|
||||||
if (beatmap == null)
|
beatmapSet = set.BeatmapSet;
|
||||||
throw new ArgumentNullException(nameof(beatmap));
|
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
|
||||||
|
|
||||||
difficultyIcons = new FillFlowContainer
|
|
||||||
{
|
|
||||||
Margin = new MarginPadding { Top = 5 },
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Selected()
|
|
||||||
{
|
|
||||||
base.Selected();
|
|
||||||
GainedSelection?.Invoke(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation)
|
private void load(LocalisationEngine localisation, BeatmapManager manager)
|
||||||
{
|
{
|
||||||
if (localisation == null)
|
if (localisation == null)
|
||||||
throw new ArgumentNullException(nameof(localisation));
|
throw new ArgumentNullException(nameof(localisation));
|
||||||
|
|
||||||
|
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
|
||||||
|
deleteRequested = manager.Delete;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DelayedLoadWrapper(
|
new DelayedLoadWrapper(
|
||||||
new PanelBackground(beatmap)
|
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
|
||||||
}, 300),
|
}, 300
|
||||||
|
),
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
@ -76,23 +65,46 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-BoldItalic",
|
Font = @"Exo2.0-BoldItalic",
|
||||||
Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title),
|
Current = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title),
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist),
|
Current = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist),
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
difficultyIcons
|
new FillFlowContainer<FilterableDifficultyIcon>
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Top = 5 },
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MenuItem[] ContextMenuItems
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List<MenuItem> items = new List<MenuItem>();
|
||||||
|
|
||||||
|
if (Item.State == CarouselItemState.NotSelected)
|
||||||
|
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
|
||||||
|
|
||||||
|
if (beatmapSet.Beatmaps.Any(b => b.Hidden))
|
||||||
|
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested?.Invoke(beatmapSet)));
|
||||||
|
|
||||||
|
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => deleteRequested?.Invoke(beatmapSet)));
|
||||||
|
|
||||||
|
return items.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class PanelBackground : BufferedContainer
|
private class PanelBackground : BufferedContainer
|
||||||
{
|
{
|
||||||
public PanelBackground(WorkingBeatmap working)
|
public PanelBackground(WorkingBeatmap working)
|
||||||
@ -129,22 +141,19 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(
|
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
||||||
Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(
|
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
||||||
new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
|
||||||
Width = 0.2f,
|
Width = 0.2f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(
|
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
||||||
new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -153,41 +162,15 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddDifficultyIcons(IEnumerable<BeatmapPanel> panels)
|
|
||||||
{
|
|
||||||
if (panels == null)
|
|
||||||
throw new ArgumentNullException(nameof(panels));
|
|
||||||
|
|
||||||
difficultyIcons.AddRange(panels.Select(p => new FilterableDifficultyIcon(p)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public MenuItem[] ContextMenuItems
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<MenuItem> items = new List<MenuItem>();
|
|
||||||
|
|
||||||
if (State == PanelSelectedState.NotSelected)
|
|
||||||
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => State = PanelSelectedState.Selected));
|
|
||||||
|
|
||||||
if (beatmap.BeatmapSetInfo.Beatmaps.Any(b => b.Hidden))
|
|
||||||
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => RestoreHiddenRequested?.Invoke(beatmap.BeatmapSetInfo)));
|
|
||||||
|
|
||||||
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => DeleteRequested?.Invoke(beatmap.BeatmapSetInfo)));
|
|
||||||
|
|
||||||
return items.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class FilterableDifficultyIcon : DifficultyIcon
|
public class FilterableDifficultyIcon : DifficultyIcon
|
||||||
{
|
{
|
||||||
private readonly BindableBool filtered = new BindableBool();
|
private readonly BindableBool filtered = new BindableBool();
|
||||||
|
|
||||||
public FilterableDifficultyIcon(BeatmapPanel panel)
|
public FilterableDifficultyIcon(CarouselBeatmap item)
|
||||||
: base(panel.Beatmap)
|
: base(item.Beatmap)
|
||||||
{
|
{
|
||||||
filtered.BindTo(panel.Filtered);
|
filtered.BindTo(item.Filtered);
|
||||||
filtered.ValueChanged += v => this.FadeTo(v ? 0.1f : 1, 100);
|
filtered.ValueChanged += v => Schedule(() => this.FadeTo(v ? 0.1f : 1, 100));
|
||||||
filtered.TriggerChange();
|
filtered.TriggerChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,45 +1,53 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework;
|
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.MathUtils;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Screens.Select.Carousel
|
||||||
{
|
{
|
||||||
public class Panel : Container, IStateful<PanelSelectedState>
|
public abstract class DrawableCarouselItem : Container
|
||||||
{
|
{
|
||||||
public const float MAX_HEIGHT = 80;
|
public const float MAX_HEIGHT = 80;
|
||||||
|
|
||||||
public event Action<PanelSelectedState> StateChanged;
|
|
||||||
|
|
||||||
public override bool RemoveWhenNotAlive => false;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
private readonly Container nestedContainer;
|
public override bool IsPresent => base.IsPresent || Item.Visible;
|
||||||
|
|
||||||
private readonly Container borderContainer;
|
public readonly CarouselItem Item;
|
||||||
|
|
||||||
private readonly Box hoverLayer;
|
private Container nestedContainer;
|
||||||
|
private Container borderContainer;
|
||||||
|
|
||||||
|
private Box hoverLayer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => nestedContainer;
|
protected override Container<Drawable> Content => nestedContainer;
|
||||||
|
|
||||||
protected Panel()
|
protected DrawableCarouselItem(CarouselItem item)
|
||||||
{
|
{
|
||||||
|
Item = item;
|
||||||
|
|
||||||
Height = MAX_HEIGHT;
|
Height = MAX_HEIGHT;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Alpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
AddInternal(borderContainer = new Container
|
private SampleChannel sampleHover;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, OsuColour colours)
|
||||||
|
{
|
||||||
|
InternalChild = borderContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
@ -58,16 +66,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Blending = BlendingMode.Additive,
|
Blending = BlendingMode.Additive,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
Alpha = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SampleChannel sampleHover;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio, OsuColour colours)
|
|
||||||
{
|
|
||||||
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}");
|
||||||
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
hoverLayer.Colour = colours.Blue.Opacity(0.1f);
|
||||||
}
|
}
|
||||||
@ -86,60 +86,41 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMultiplicativeAlpha(float alpha)
|
public void SetMultiplicativeAlpha(float alpha) => borderContainer.Alpha = alpha;
|
||||||
{
|
|
||||||
borderContainer.Alpha = alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ApplyState();
|
ApplyState();
|
||||||
|
Item.Filtered.ValueChanged += _ => Schedule(ApplyState);
|
||||||
|
Item.State.ValueChanged += _ => Schedule(ApplyState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ApplyState(PanelSelectedState last = PanelSelectedState.Hidden)
|
protected virtual void ApplyState()
|
||||||
{
|
{
|
||||||
if (!IsLoaded) return;
|
if (!IsLoaded) return;
|
||||||
|
|
||||||
switch (state)
|
switch (Item.State.Value)
|
||||||
{
|
{
|
||||||
case PanelSelectedState.Hidden:
|
case CarouselItemState.NotSelected:
|
||||||
case PanelSelectedState.NotSelected:
|
|
||||||
Deselected();
|
Deselected();
|
||||||
break;
|
break;
|
||||||
case PanelSelectedState.Selected:
|
case CarouselItemState.Selected:
|
||||||
Selected();
|
Selected();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == PanelSelectedState.Hidden)
|
if (!Item.Visible)
|
||||||
this.FadeOut(300, Easing.OutQuint);
|
this.FadeOut(300, Easing.OutQuint);
|
||||||
else
|
else
|
||||||
this.FadeIn(250);
|
this.FadeIn(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PanelSelectedState state = PanelSelectedState.NotSelected;
|
|
||||||
|
|
||||||
public PanelSelectedState State
|
|
||||||
{
|
|
||||||
get { return state; }
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (state == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var last = state;
|
|
||||||
state = value;
|
|
||||||
|
|
||||||
ApplyState(last);
|
|
||||||
|
|
||||||
StateChanged?.Invoke(State);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Selected()
|
protected virtual void Selected()
|
||||||
{
|
{
|
||||||
|
Item.State.Value = CarouselItemState.Selected;
|
||||||
|
|
||||||
borderContainer.BorderThickness = 2.5f;
|
borderContainer.BorderThickness = 2.5f;
|
||||||
borderContainer.EdgeEffect = new EdgeEffectParameters
|
borderContainer.EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
@ -152,6 +133,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
protected virtual void Deselected()
|
protected virtual void Deselected()
|
||||||
{
|
{
|
||||||
|
Item.State.Value = CarouselItemState.NotSelected;
|
||||||
|
|
||||||
borderContainer.BorderThickness = 0;
|
borderContainer.BorderThickness = 0;
|
||||||
borderContainer.EdgeEffect = new EdgeEffectParameters
|
borderContainer.EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
@ -164,15 +147,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
{
|
{
|
||||||
State = PanelSelectedState.Selected;
|
Item.State.Value = CarouselItemState.Selected;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PanelSelectedState
|
|
||||||
{
|
|
||||||
Hidden,
|
|
||||||
NotSelected,
|
|
||||||
Selected
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class EditSongSelect : SongSelect
|
public class EditSongSelect : SongSelect
|
||||||
{
|
{
|
||||||
protected override bool ShowFooter => false;
|
protected override bool ShowFooter => false;
|
||||||
|
|
||||||
protected override void OnSelected(InputState state) => Exit();
|
protected override void Start() => Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Drawables;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
@ -18,54 +13,5 @@ namespace osu.Game.Screens.Select
|
|||||||
public string SearchText;
|
public string SearchText;
|
||||||
public RulesetInfo Ruleset;
|
public RulesetInfo Ruleset;
|
||||||
public bool AllowConvertedBeatmaps;
|
public bool AllowConvertedBeatmaps;
|
||||||
|
|
||||||
private bool canConvert(BeatmapInfo beatmapInfo) => beatmapInfo.RulesetID == Ruleset.ID || beatmapInfo.RulesetID == 0 && Ruleset.ID > 0 && AllowConvertedBeatmaps;
|
|
||||||
|
|
||||||
public void Filter(List<BeatmapGroup> groups)
|
|
||||||
{
|
|
||||||
foreach (var g in groups)
|
|
||||||
{
|
|
||||||
var set = g.BeatmapSet;
|
|
||||||
|
|
||||||
// we only support converts from osu! mode to other modes for now.
|
|
||||||
// in the future this will have to change, at which point this condition will become a touch more complicated.
|
|
||||||
bool hasCurrentMode = set.Beatmaps.Any(canConvert);
|
|
||||||
|
|
||||||
bool match = hasCurrentMode;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(SearchText))
|
|
||||||
match &= set.Metadata.SearchableTerms.Any(term => term.IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
|
||||||
|
|
||||||
foreach (var panel in g.BeatmapPanels)
|
|
||||||
panel.Filtered.Value = !canConvert(panel.Beatmap);
|
|
||||||
|
|
||||||
switch (g.State)
|
|
||||||
{
|
|
||||||
case BeatmapGroupState.Hidden:
|
|
||||||
if (match) g.State = BeatmapGroupState.Collapsed;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!match) g.State = BeatmapGroupState.Hidden;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Sort)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case SortMode.Artist:
|
|
||||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
break;
|
|
||||||
case SortMode.Title:
|
|
||||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
break;
|
|
||||||
case SortMode.Author:
|
|
||||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author.Username, y.BeatmapSet.Metadata.Author.Username, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
break;
|
|
||||||
case SortMode.Difficulty:
|
|
||||||
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class MatchSongSelect : SongSelect
|
public class MatchSongSelect : SongSelect
|
||||||
{
|
{
|
||||||
protected override void OnSelected(InputState state) => Exit();
|
protected override void Start() => Exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -114,11 +113,12 @@ namespace osu.Game.Screens.Select
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSelected(InputState state)
|
protected override void Start()
|
||||||
{
|
{
|
||||||
if (player != null) return;
|
if (player != null) return;
|
||||||
|
|
||||||
if (state?.Keyboard.ControlPressed == true)
|
// Ctrl+Enter should start map with autoplay enabled.
|
||||||
|
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
||||||
{
|
{
|
||||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
var autoType = auto.GetType();
|
var autoType = auto.GetType();
|
||||||
|
@ -27,25 +27,11 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
public abstract class SongSelect : OsuScreen
|
public abstract class SongSelect : OsuScreen
|
||||||
{
|
{
|
||||||
private BeatmapManager beatmaps;
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
|
||||||
|
|
||||||
private readonly BeatmapCarousel carousel;
|
|
||||||
private DialogOverlay dialogOverlay;
|
|
||||||
|
|
||||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||||
|
private static readonly Vector2 background_blur = new Vector2(20);
|
||||||
private const float left_area_padding = 20;
|
private const float left_area_padding = 20;
|
||||||
|
|
||||||
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
public readonly FilterControl FilterControl;
|
||||||
|
|
||||||
protected Container LeftContent;
|
|
||||||
|
|
||||||
private static readonly Vector2 background_blur = new Vector2(20);
|
|
||||||
private CancellationTokenSource initialAddSetsTask;
|
|
||||||
|
|
||||||
private SampleChannel sampleChangeDifficulty;
|
|
||||||
private SampleChannel sampleChangeBeatmap;
|
|
||||||
|
|
||||||
protected virtual bool ShowFooter => true;
|
protected virtual bool ShowFooter => true;
|
||||||
|
|
||||||
@ -65,77 +51,90 @@ namespace osu.Game.Screens.Select
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Container FooterPanels;
|
protected readonly Container FooterPanels;
|
||||||
|
|
||||||
public readonly FilterControl FilterControl;
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
||||||
|
|
||||||
|
protected Container LeftContent;
|
||||||
|
|
||||||
|
private readonly BeatmapCarousel carousel;
|
||||||
|
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
||||||
|
private DialogOverlay dialogOverlay;
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
|
|
||||||
|
private SampleChannel sampleChangeDifficulty;
|
||||||
|
private SampleChannel sampleChangeBeatmap;
|
||||||
|
|
||||||
|
private CancellationTokenSource initialAddSetsTask;
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
protected SongSelect()
|
protected SongSelect()
|
||||||
{
|
{
|
||||||
const float carousel_width = 640;
|
const float carousel_width = 640;
|
||||||
const float filter_height = 100;
|
const float filter_height = 100;
|
||||||
|
|
||||||
Add(new ParallaxContainer
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Top = filter_height },
|
new ParallaxContainer
|
||||||
ParallaxAmount = 0.005f,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Children = new[]
|
|
||||||
{
|
{
|
||||||
new WedgeBackground
|
Padding = new MarginPadding { Top = filter_height },
|
||||||
|
ParallaxAmount = 0.005f,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new WedgeBackground
|
||||||
Padding = new MarginPadding { Right = carousel_width * 0.76f },
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Right = carousel_width * 0.76f },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
Add(LeftContent = new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Size = new Vector2(wedged_container_size.X, 1),
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Bottom = 50,
|
|
||||||
Top = wedged_container_size.Y + left_area_padding,
|
|
||||||
Left = left_area_padding,
|
|
||||||
Right = left_area_padding * 2,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Add(carousel = new BeatmapCarousel
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Size = new Vector2(carousel_width, 1),
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
SelectionChanged = carouselSelectionChanged,
|
|
||||||
BeatmapsChanged = carouselBeatmapsLoaded,
|
|
||||||
DeleteRequested = promptDelete,
|
|
||||||
RestoreRequested = s => { foreach (var b in s.Beatmaps) beatmaps.Restore(b); },
|
|
||||||
EditRequested = editRequested,
|
|
||||||
HideDifficultyRequested = b => beatmaps.Hide(b),
|
|
||||||
StartRequested = () => carouselRaisedStart(),
|
|
||||||
});
|
|
||||||
Add(FilterControl = new FilterControl
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = filter_height,
|
|
||||||
FilterChanged = criteria => filterChanged(criteria),
|
|
||||||
Exit = Exit,
|
|
||||||
});
|
|
||||||
Add(beatmapInfoWedge = new BeatmapInfoWedge
|
|
||||||
{
|
|
||||||
Alpha = 0,
|
|
||||||
Size = wedged_container_size,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Margin = new MarginPadding
|
|
||||||
{
|
|
||||||
Top = left_area_padding,
|
|
||||||
Right = left_area_padding,
|
|
||||||
},
|
},
|
||||||
});
|
LeftContent = new Container
|
||||||
Add(new ResetScrollContainer(() => carousel.ScrollToSelected())
|
{
|
||||||
{
|
Origin = Anchor.BottomLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
Anchor = Anchor.BottomLeft,
|
||||||
Width = 250,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(wedged_container_size.X, 1),
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Bottom = 50,
|
||||||
|
Top = wedged_container_size.Y + left_area_padding,
|
||||||
|
Left = left_area_padding,
|
||||||
|
Right = left_area_padding * 2,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
carousel = new BeatmapCarousel
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Size = new Vector2(carousel_width, 1),
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
SelectionChanged = carouselSelectionChanged,
|
||||||
|
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
||||||
|
},
|
||||||
|
FilterControl = new FilterControl
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = filter_height,
|
||||||
|
FilterChanged = c => carousel.Filter(c),
|
||||||
|
Exit = Exit,
|
||||||
|
},
|
||||||
|
beatmapInfoWedge = new BeatmapInfoWedge
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
Size = wedged_container_size,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = left_area_padding,
|
||||||
|
Right = left_area_padding,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new ResetScrollContainer(() => carousel.ScrollToSelected())
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 250,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ShowFooter)
|
if (ShowFooter)
|
||||||
@ -163,12 +162,14 @@ namespace osu.Game.Screens.Select
|
|||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
||||||
{
|
{
|
||||||
|
dependencies.Cache(this);
|
||||||
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
||||||
Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3);
|
Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3);
|
||||||
|
|
||||||
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => promptDelete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.beatmaps == null)
|
if (this.beatmaps == null)
|
||||||
@ -189,51 +190,31 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
initialAddSetsTask = new CancellationTokenSource();
|
initialAddSetsTask = new CancellationTokenSource();
|
||||||
|
|
||||||
carousel.Beatmaps = this.beatmaps.GetAllUsableBeatmapSets();
|
carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets();
|
||||||
|
|
||||||
Beatmap.ValueChanged += beatmap_ValueChanged;
|
|
||||||
|
|
||||||
Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled;
|
Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled;
|
||||||
carousel.AllowSelection = !Beatmap.Disabled;
|
Beatmap.TriggerChange();
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += b =>
|
||||||
|
{
|
||||||
|
if (IsCurrentScreen)
|
||||||
|
carousel.SelectBeatmap(b?.BeatmapInfo);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editRequested(BeatmapInfo beatmap)
|
public void Edit(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
Push(new Editor());
|
Push(new Editor());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBeatmapRestored(BeatmapInfo beatmap)
|
public void Start(BeatmapInfo beatmap)
|
||||||
{
|
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
var beatmapSet = beatmaps.QueryBeatmapSet(s => s.ID == beatmap.BeatmapSetInfoID);
|
|
||||||
carousel.UpdateBeatmapSet(beatmapSet);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onBeatmapHidden(BeatmapInfo beatmap)
|
|
||||||
{
|
|
||||||
Schedule(() =>
|
|
||||||
{
|
|
||||||
var beatmapSet = beatmaps.QueryBeatmapSet(s => s.ID == beatmap.BeatmapSetInfoID);
|
|
||||||
carousel.UpdateBeatmapSet(beatmapSet);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void carouselBeatmapsLoaded()
|
|
||||||
{
|
|
||||||
if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false)
|
|
||||||
carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false);
|
|
||||||
else
|
|
||||||
carousel.SelectNextRandom();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void carouselRaisedStart(InputState state = null)
|
|
||||||
{
|
{
|
||||||
// if we have a pending filter operation, we want to run it now.
|
// if we have a pending filter operation, we want to run it now.
|
||||||
// it could change selection (ie. if the ruleset has been changed).
|
// it could change selection (ie. if the ruleset has been changed).
|
||||||
carousel.FlushPendingFilters();
|
carousel.FlushPendingFilterOperations();
|
||||||
|
|
||||||
|
carousel.SelectBeatmap(beatmap);
|
||||||
|
|
||||||
if (selectionChangedDebounce?.Completed == false)
|
if (selectionChangedDebounce?.Completed == false)
|
||||||
{
|
{
|
||||||
@ -242,9 +223,14 @@ namespace osu.Game.Screens.Select
|
|||||||
selectionChangedDebounce = null;
|
selectionChangedDebounce = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnSelected(state);
|
Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a selection is made.
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void Start();
|
||||||
|
|
||||||
private ScheduledDelegate selectionChangedDebounce;
|
private ScheduledDelegate selectionChangedDebounce;
|
||||||
|
|
||||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||||
@ -261,7 +247,7 @@ namespace osu.Game.Screens.Select
|
|||||||
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
|
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
|
||||||
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
|
if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true)
|
||||||
{
|
{
|
||||||
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
|
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||||
|
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
ensurePlayingSelected(preview);
|
ensurePlayingSelected(preview);
|
||||||
@ -301,23 +287,11 @@ namespace osu.Game.Screens.Select
|
|||||||
carousel.SelectNextRandom();
|
carousel.SelectNextRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void OnSelected(InputState state);
|
|
||||||
|
|
||||||
private void filterChanged(FilterCriteria criteria, bool debounce = true)
|
|
||||||
{
|
|
||||||
carousel.Filter(criteria, debounce);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => carousel.UpdateBeatmapSet(s));
|
|
||||||
|
|
||||||
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s));
|
|
||||||
|
|
||||||
protected override void OnEntering(Screen last)
|
protected override void OnEntering(Screen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
Content.FadeInFromZero(250);
|
Content.FadeInFromZero(250);
|
||||||
|
|
||||||
FilterControl.Activate();
|
FilterControl.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +320,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
logo.Action = () =>
|
logo.Action = () =>
|
||||||
{
|
{
|
||||||
carouselRaisedStart();
|
Start();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -358,13 +332,6 @@ namespace osu.Game.Screens.Select
|
|||||||
logo.FadeOut(logo_transition / 2, Easing.Out);
|
logo.FadeOut(logo_transition / 2, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmap_ValueChanged(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
if (!IsCurrentScreen) return;
|
|
||||||
|
|
||||||
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||||
@ -425,8 +392,7 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="beatmap">The working beatmap.</param>
|
/// <param name="beatmap">The working beatmap.</param>
|
||||||
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
|
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
var backgroundModeBeatmap = Background as BackgroundScreenBeatmap;
|
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
||||||
if (backgroundModeBeatmap != null)
|
|
||||||
{
|
{
|
||||||
backgroundModeBeatmap.Beatmap = beatmap;
|
backgroundModeBeatmap.Beatmap = beatmap;
|
||||||
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
|
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
|
||||||
@ -451,18 +417,22 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBeatmapSet(BeatmapSetInfo beatmapSet)
|
private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.UpdateBeatmapSet(s);
|
||||||
|
private void onBeatmapSetRemoved(BeatmapSetInfo s) => carousel.RemoveBeatmapSet(s);
|
||||||
|
private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
||||||
|
private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID));
|
||||||
|
|
||||||
|
private void carouselBeatmapsLoaded()
|
||||||
{
|
{
|
||||||
carousel.RemoveBeatmap(beatmapSet);
|
if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false)
|
||||||
if (carousel.SelectedBeatmap == null)
|
carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo);
|
||||||
Beatmap.SetDefault();
|
else
|
||||||
|
carousel.SelectNextRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void promptDelete(BeatmapSetInfo beatmap)
|
private void delete(BeatmapSetInfo beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap == null)
|
if (beatmap == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
|
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,15 +444,16 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
case Key.KeypadEnter:
|
case Key.KeypadEnter:
|
||||||
case Key.Enter:
|
case Key.Enter:
|
||||||
carouselRaisedStart(state);
|
Start();
|
||||||
return true;
|
return true;
|
||||||
case Key.Delete:
|
case Key.Delete:
|
||||||
if (state.Keyboard.ShiftPressed)
|
if (state.Keyboard.ShiftPressed)
|
||||||
{
|
{
|
||||||
if (!Beatmap.IsDefault)
|
if (!Beatmap.IsDefault)
|
||||||
promptDelete(Beatmap.Value.BeatmapSetInfo);
|
delete(Beatmap.Value.BeatmapSetInfo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,5 +136,7 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
[JsonProperty(@"rankHistory")]
|
[JsonProperty(@"rankHistory")]
|
||||||
public RankHistoryData RankHistory;
|
public RankHistoryData RankHistory;
|
||||||
|
|
||||||
|
public override string ToString() => Username;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,10 +262,7 @@
|
|||||||
<Compile Include="Beatmaps\ControlPoints\TimingControlPoint.cs" />
|
<Compile Include="Beatmaps\ControlPoints\TimingControlPoint.cs" />
|
||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapGroup.cs" />
|
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
|
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
|
|
||||||
<Compile Include="Beatmaps\Formats\LegacyDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\LegacyDecoder.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\LegacyStoryboardDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\LegacyStoryboardDecoder.cs" />
|
||||||
<Compile Include="Database\DatabaseContextFactory.cs" />
|
<Compile Include="Database\DatabaseContextFactory.cs" />
|
||||||
@ -322,7 +319,6 @@
|
|||||||
<Compile Include="Rulesets\Mods\IApplicableToScoreProcessor.cs" />
|
<Compile Include="Rulesets\Mods\IApplicableToScoreProcessor.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />
|
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
|
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\Panel.cs" />
|
|
||||||
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\Decoder.cs" />
|
<Compile Include="Beatmaps\Formats\Decoder.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\LegacyBeatmapDecoder.cs" />
|
||||||
@ -353,7 +349,7 @@
|
|||||||
<Compile Include="Configuration\ReleaseStream.cs" />
|
<Compile Include="Configuration\ReleaseStream.cs" />
|
||||||
<Compile Include="Configuration\ScoreMeterType.cs" />
|
<Compile Include="Configuration\ScoreMeterType.cs" />
|
||||||
<Compile Include="Configuration\ScreenshotFormat.cs" />
|
<Compile Include="Configuration\ScreenshotFormat.cs" />
|
||||||
<Compile Include="Configuration\SelectionRandomType.cs" />
|
<Compile Include="Configuration\RandomSelectAlgorithm.cs" />
|
||||||
<Compile Include="Database\DatabaseBackedStore.cs" />
|
<Compile Include="Database\DatabaseBackedStore.cs" />
|
||||||
<Compile Include="Database\OsuDbContext.cs" />
|
<Compile Include="Database\OsuDbContext.cs" />
|
||||||
<Compile Include="Graphics\Backgrounds\Background.cs" />
|
<Compile Include="Graphics\Backgrounds\Background.cs" />
|
||||||
@ -762,6 +758,14 @@
|
|||||||
<Compile Include="Screens\Select\BeatmapDetailAreaTabControl.cs" />
|
<Compile Include="Screens\Select\BeatmapDetailAreaTabControl.cs" />
|
||||||
<Compile Include="Screens\Select\BeatmapDetails.cs" />
|
<Compile Include="Screens\Select\BeatmapDetails.cs" />
|
||||||
<Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
|
<Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\CarouselBeatmap.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\CarouselBeatmapSet.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\CarouselGroup.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\CarouselGroupEagerSelect.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\CarouselItem.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\DrawableCarouselBeatmap.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\DrawableCarouselBeatmapSet.cs" />
|
||||||
|
<Compile Include="Screens\Select\Carousel\DrawableCarouselItem.cs" />
|
||||||
<Compile Include="Screens\Select\Details\AdvancedStats.cs" />
|
<Compile Include="Screens\Select\Details\AdvancedStats.cs" />
|
||||||
<Compile Include="Screens\Select\Details\FailRetryGraph.cs" />
|
<Compile Include="Screens\Select\Details\FailRetryGraph.cs" />
|
||||||
<Compile Include="Screens\Select\Details\UserRatings.cs" />
|
<Compile Include="Screens\Select\Details\UserRatings.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user