mirror of
https://github.com/ppy/osu.git
synced 2025-03-06 02:22:58 +08:00
Fix song select not showing active beatmap if it is filtered by local criteria
This commit is contained in:
parent
d61516e10c
commit
66fb72cd8a
@ -17,6 +17,7 @@ using osu.Framework.Caching;
|
|||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Logging;
|
||||||
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;
|
||||||
@ -229,6 +230,17 @@ namespace osu.Game.Screens.Select
|
|||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
select(item);
|
select(item);
|
||||||
|
|
||||||
|
// if we got here and the set is filtered, it means we were bypassing filters.
|
||||||
|
// in this case, reapplying the filter is necessary to ensure the panel is in the correct place
|
||||||
|
// (since it is forcefully being included in the carousel).
|
||||||
|
if (set.Filtered.Value)
|
||||||
|
{
|
||||||
|
Debug.Assert(bypassFilters);
|
||||||
|
|
||||||
|
applyActiveCriteria(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// All beatmaps which are not filtered and valid for display.
|
/// All beatmaps which are not filtered and valid for display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IEnumerable<BeatmapInfo> ValidBeatmaps => Beatmaps.Where(b => !b.Filtered.Value).Select(b => b.Beatmap);
|
protected IEnumerable<BeatmapInfo> ValidBeatmaps => Beatmaps.Where(b => !b.Filtered.Value || b.State.Value == CarouselItemState.Selected).Select(b => b.Beatmap);
|
||||||
|
|
||||||
private int compareUsingAggregateMax(CarouselBeatmapSet other, Func<BeatmapInfo, double> func)
|
private int compareUsingAggregateMax(CarouselBeatmapSet other, Func<BeatmapInfo, double> func)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This item is not in a hidden state.
|
/// This item is not in a hidden state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered.Value;
|
public bool Visible => State.Value == CarouselItemState.Selected || (State.Value != CarouselItemState.Collapsed && !Filtered.Value);
|
||||||
|
|
||||||
public virtual List<DrawableCarouselItem> Drawables
|
public virtual List<DrawableCarouselItem> Drawables
|
||||||
{
|
{
|
||||||
|
@ -376,16 +376,22 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void workingBeatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
private void workingBeatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
||||||
{
|
{
|
||||||
if (e.NewValue is DummyWorkingBeatmap) return;
|
if (e.NewValue is DummyWorkingBeatmap || !this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false))
|
if (!Carousel.SelectBeatmap(e.NewValue.BeatmapInfo, false))
|
||||||
{
|
{
|
||||||
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
|
// A selection may not have been possible with filters applied.
|
||||||
if (e.NewValue?.BeatmapInfo?.Ruleset != null && !e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
|
|
||||||
|
// There was possibly a ruleset mismatch. This is a case we can help things along by updating the game-wide ruleset to match.
|
||||||
|
if (e.NewValue.BeatmapInfo.Ruleset != null && !e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
|
||||||
{
|
{
|
||||||
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
|
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
|
||||||
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
|
transferRulesetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Even if a ruleset mismatch was not the cause (ie. a text filter is applied),
|
||||||
|
// we still want to forcefully show the new beatmap, bypassing filters.
|
||||||
|
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user