1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 19:03:21 +08:00

Merge pull request #1 from peppy/song-select-filtering-fixes

Fixes inconsistencies and shortcomings of filtering.
This commit is contained in:
Drew DeVault 2017-02-02 06:54:26 -08:00 committed by GitHub
commit 5136d10e0e
8 changed files with 273 additions and 279 deletions

@ -1 +1 @@
Subproject commit 4880e5425cfa277be56ef87ec4d79a250ecb6d17 Subproject commit 16a01c7381e3ee8ef6b4fe863ba9232deba04c29

View File

@ -38,25 +38,22 @@ namespace osu.Game.Beatmaps.Drawables
get { return state; } get { return state; }
set set
{ {
Header.Alpha = value == BeatmapGroupState.Hidden ? 0 : 1;
switch (value) switch (value)
{ {
case BeatmapGroupState.Expanded: case BeatmapGroupState.Expanded:
foreach (BeatmapPanel panel in BeatmapPanels)
panel.FadeIn(250);
Header.State = PanelSelectedState.Selected; Header.State = PanelSelectedState.Selected;
if (SelectedPanel != null) foreach (BeatmapPanel panel in BeatmapPanels)
SelectedPanel.State = PanelSelectedState.Selected; panel.State = panel == SelectedPanel ? PanelSelectedState.Selected : PanelSelectedState.NotSelected;
break; break;
case BeatmapGroupState.Collapsed: case BeatmapGroupState.Collapsed:
case BeatmapGroupState.Hidden:
Header.State = PanelSelectedState.NotSelected; Header.State = PanelSelectedState.NotSelected;
if (SelectedPanel != null)
SelectedPanel.State = PanelSelectedState.NotSelected;
foreach (BeatmapPanel panel in BeatmapPanels) foreach (BeatmapPanel panel in BeatmapPanels)
panel.FadeOut(300, EasingTypes.OutQuint); panel.State = PanelSelectedState.Hidden;
break;
case BeatmapGroupState.Hidden:
Header.State = PanelSelectedState.Hidden;
foreach (BeatmapPanel panel in BeatmapPanels)
panel.State = PanelSelectedState.Hidden;
break; break;
} }
state = value; state = value;

View File

@ -2,14 +2,11 @@
//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.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.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.MathUtils;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
@ -17,7 +14,6 @@ using osu.Game.Graphics.UserInterface;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Modes;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
@ -33,6 +29,7 @@ namespace osu.Game.Beatmaps.Drawables
protected override void Selected() protected override void Selected()
{ {
base.Selected(); base.Selected();
GainedSelection?.Invoke(this); GainedSelection?.Invoke(this);
background.ColourInfo = ColourInfo.GradientVertical( background.ColourInfo = ColourInfo.GradientVertical(

View File

@ -68,12 +68,6 @@ namespace osu.Game.Beatmaps.Drawables
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
FadeInFromZero(250);
}
protected override void Selected() protected override void Selected()
{ {
base.Selected(); base.Selected();

View File

@ -55,6 +55,7 @@ namespace osu.Game.Beatmaps.Drawables
{ {
switch (state) switch (state)
{ {
case PanelSelectedState.Hidden:
case PanelSelectedState.NotSelected: case PanelSelectedState.NotSelected:
Deselected(); Deselected();
break; break;
@ -62,6 +63,11 @@ namespace osu.Game.Beatmaps.Drawables
Selected(); Selected();
break; break;
} }
if (state == PanelSelectedState.Hidden)
FadeOut(300, EasingTypes.OutQuint);
else
FadeIn(250);
} }
private PanelSelectedState state = PanelSelectedState.NotSelected; private PanelSelectedState state = PanelSelectedState.NotSelected;
@ -112,6 +118,7 @@ namespace osu.Game.Beatmaps.Drawables
enum PanelSelectedState enum PanelSelectedState
{ {
Hidden,
NotSelected, NotSelected,
Selected Selected
} }

View File

@ -1,212 +1,212 @@
using System; using System;
using OpenTK; using OpenTK;
using OpenTK.Input; using OpenTK.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace osu.Game.Overlays.Pause namespace osu.Game.Overlays.Pause
{ {
public class PauseOverlay : OverlayContainer public class PauseOverlay : OverlayContainer
{ {
private const int transition_duration = 200; private const int transition_duration = 200;
private const int button_height = 70; private const int button_height = 70;
private const float background_alpha = 0.75f; private const float background_alpha = 0.75f;
public Action OnResume; public Action OnResume;
public Action OnRetry; public Action OnRetry;
public Action OnQuit; public Action OnQuit;
public int Retries public int Retries
{ {
set set
{ {
if (retryCounterContainer != null) if (retryCounterContainer != null)
{ {
// "You've retried 1,065 times in this session" // "You've retried 1,065 times in this session"
// "You've retried 1 time in this session" // "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[] retryCounterContainer.Children = new Drawable[]
{ {
new SpriteText new SpriteText
{ {
Text = "You've retried ", Text = "You've retried ",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f), ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18 TextSize = 18
}, },
new SpriteText new SpriteText
{ {
Text = String.Format("{0:n0}", value), Text = String.Format("{0:n0}", value),
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f), ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18 TextSize = 18
}, },
new SpriteText new SpriteText
{ {
Text = $" time{((value == 1) ? "" : "s")} in this session", Text = $" time{((value == 1) ? "" : "s")} in this session",
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f), ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18 TextSize = 18
} }
}; };
} }
} }
} }
private FlowContainer retryCounterContainer; private FlowContainer retryCounterContainer;
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => State == Visibility.Visible; public override bool HandleInput => State == Visibility.Visible;
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In); protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In);
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (args.Key == Key.Escape) if (args.Key == Key.Escape)
{ {
if (State == Visibility.Hidden) return false; if (State == Visibility.Hidden) return false;
resume(); resume();
return true; return true;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,
Alpha = background_alpha, Alpha = background_alpha,
}, },
new FlowContainer new FlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FlowDirection.VerticalOnly, Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0f, 50f), Spacing = new Vector2(0f, 50f),
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{ {
new FlowContainer new FlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FlowDirection.VerticalOnly, Direction = FlowDirection.VerticalOnly,
Spacing = new Vector2(0f, 20f), Spacing = new Vector2(0f, 20f),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText new SpriteText
{ {
Text = @"paused", Text = @"paused",
Font = @"Exo2.0-Medium", Font = @"Exo2.0-Medium",
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
TextSize = 30, TextSize = 30,
Colour = colours.Yellow, Colour = colours.Yellow,
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f) ShadowColour = new Color4(0, 0, 0, 0.25f)
}, },
new SpriteText new SpriteText
{ {
Text = @"you're not going to do what i think you're going to do, are ya?", Text = @"you're not going to do what i think you're going to do, are ya?",
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Shadow = true, Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f) ShadowColour = new Color4(0, 0, 0, 0.25f)
} }
} }
}, },
new FlowContainer new FlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Masking = true, Masking = true,
EdgeEffect = new EdgeEffect EdgeEffect = new EdgeEffect
{ {
Type = EdgeEffectType.Shadow, Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.6f), Colour = Color4.Black.Opacity(0.6f),
Radius = 50 Radius = 50
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
new ResumeButton new ResumeButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
Action = resume Action = resume
}, },
new RetryButton new RetryButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
Action = delegate Action = delegate
{ {
Hide(); Hide();
OnRetry?.Invoke(); OnRetry?.Invoke();
} }
}, },
new QuitButton new QuitButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Height = button_height, Height = button_height,
Action = delegate Action = delegate
{ {
Hide(); Hide();
OnQuit?.Invoke(); OnQuit?.Invoke();
} }
} }
} }
}, },
retryCounterContainer = new FlowContainer retryCounterContainer = new FlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
} }
} }
}, },
new PauseProgressBar new PauseProgressBar
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Width = 1f Width = 1f
} }
}; };
Retries = 0; Retries = 0;
} }
private void resume() private void resume()
{ {
Hide(); Hide();
OnResume?.Invoke(); OnResume?.Invoke();
} }
public PauseOverlay() public PauseOverlay()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
} }
} }

View File

@ -1,23 +1,23 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Copyright (c) 2007-2016 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 OpenTK; using OpenTK;
using osu.Framework.Caching; using osu.Framework.Caching;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Game.Database; using osu.Game.Database;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Lists; using osu.Framework.Lists;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK.Input; using OpenTK.Input;
using System.Collections; using System.Collections;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -97,10 +97,10 @@ namespace osu.Game.Screens.Select
computeYPositions(); computeYPositions();
} }
private void movePanel(Panel panel, bool advance, ref float currentY) private void movePanel(Panel panel, bool advance, bool animated, ref float currentY)
{ {
yPositions.Add(currentY); yPositions.Add(currentY);
panel.MoveToY(currentY, 750, EasingTypes.OutExpo); panel.MoveToY(currentY, animated && (panel.IsOnScreen || panel.State != PanelSelectedState.Hidden) ? 750 : 0, EasingTypes.OutExpo);
if (advance) if (advance)
currentY += panel.DrawHeight + 5; currentY += panel.DrawHeight + 5;
@ -110,7 +110,7 @@ namespace osu.Game.Screens.Select
/// Computes the target Y positions for every panel in the carousel. /// Computes the target Y positions for every panel in the carousel.
/// </summary> /// </summary>
/// <returns>The Y position of the currently selected panel.</returns> /// <returns>The Y position of the currently selected panel.</returns>
private float computeYPositions() private float computeYPositions(bool animated = true)
{ {
yPositions.Clear(); yPositions.Clear();
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Select
foreach (BeatmapGroup group in groups) foreach (BeatmapGroup group in groups)
{ {
movePanel(group.Header, group.State != BeatmapGroupState.Hidden, ref currentY); movePanel(group.Header, group.State != BeatmapGroupState.Hidden, animated, ref currentY);
if (group.State == BeatmapGroupState.Expanded) if (group.State == BeatmapGroupState.Expanded)
{ {
@ -137,7 +137,7 @@ namespace osu.Game.Screens.Select
if (panel.Alpha == 0) if (panel.Alpha == 0)
panel.MoveToY(headerY); panel.MoveToY(headerY);
movePanel(panel, true, ref currentY); movePanel(panel, true, animated, ref currentY);
} }
} }
else else
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Select
foreach (BeatmapPanel panel in group.BeatmapPanels) foreach (BeatmapPanel panel in group.BeatmapPanels)
{ {
panel.MoveToX(0, 500, EasingTypes.OutExpo); panel.MoveToX(0, 500, EasingTypes.OutExpo);
movePanel(panel, false, ref currentY); movePanel(panel, false, animated, ref currentY);
} }
} }
} }
@ -158,30 +158,30 @@ namespace osu.Game.Screens.Select
return selectedY; return selectedY;
} }
public void SelectBeatmap(BeatmapInfo beatmap) public void SelectBeatmap(BeatmapInfo beatmap, bool animated = true)
{ {
foreach (BeatmapGroup group in groups) foreach (BeatmapGroup group in groups)
{ {
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap)); var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
if (panel != null) if (panel != null)
{ {
SelectGroup(group, panel); SelectGroup(group, panel, animated);
return; return;
} }
} }
} }
public void SelectGroup(BeatmapGroup group, BeatmapPanel panel) public void SelectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true)
{ {
if (SelectedGroup != null && SelectedGroup != group) if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden)
SelectedGroup.State = BeatmapGroupState.Collapsed; SelectedGroup.State = BeatmapGroupState.Collapsed;
SelectedGroup = group; SelectedGroup = group;
panel.State = PanelSelectedState.Selected; panel.State = PanelSelectedState.Selected;
SelectedPanel = panel; SelectedPanel = panel;
float selectedY = computeYPositions(); float selectedY = computeYPositions(animated);
ScrollTo(selectedY); ScrollTo(selectedY, animated);
} }
private static float offsetX(float dist, float halfHeight) private static float offsetX(float dist, float halfHeight)
@ -203,7 +203,7 @@ namespace osu.Game.Screens.Select
private void updatePanel(Panel p, float halfHeight) private void updatePanel(Panel p, float halfHeight)
{ {
var height = p.IsVisible ? p.DrawHeight : 0; var height = p.IsVisible ? p.DrawHeight : 0;
float panelDrawY = p.Position.Y - Current + height / 2; float panelDrawY = p.Position.Y - Current + height / 2;
float dist = Math.Abs(1f - panelDrawY / halfHeight); float dist = Math.Abs(1f - panelDrawY / halfHeight);
@ -246,18 +246,12 @@ namespace osu.Game.Screens.Select
for (int i = firstIndex; i < lastIndex; ++i) for (int i = firstIndex; i < lastIndex; ++i)
{ {
Panel p = Lifetime[i]; Panel p = Lifetime[i];
p.IsOnScreen = true; if (p.State != PanelSelectedState.Hidden)
p.IsOnScreen = true; //we don't want to update the on-screen state of hidden pannels as they have incorrect (stacked) y values.
updatePanel(p, halfHeight); updatePanel(p, halfHeight);
} }
} }
public void InvalidateVisible()
{
Lifetime.StartIndex = 0;
Lifetime.EndIndex = groups.Count - 1;
computeYPositions();
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
int direction = 0; int direction = 0;
@ -281,34 +275,46 @@ namespace osu.Game.Screens.Select
break; break;
} }
if (direction != 0) if (direction == 0)
return base.OnKeyDown(state, args);
if (!skipDifficulties)
{ {
int index = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction; int i = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction;
if (!skipDifficulties && index >= 0 && index < SelectedGroup.BeatmapPanels.Count) if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count)
//changing difficulty panel, not set.
SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[index]);
else
{ {
index = (groups.IndexOf(SelectedGroup) + direction + groups.Count) % groups.Count; //changing difficulty panel, not set.
SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap); SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]);
return true;
} }
return true;
} }
return base.OnKeyDown(state, args); int startIndex = groups.IndexOf(SelectedGroup);
} int index = startIndex;
public void SelectRandom() do
{ {
if (groups.Count < 1) index = (index + direction + groups.Count) % groups.Count;
return; if (groups[index].State != BeatmapGroupState.Hidden)
{
SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap);
return true;
}
} while (index != startIndex);
return true;
}
public void SelectRandom()
{
if (groups.Count < 1)
return;
BeatmapGroup group = groups[RNG.Next(groups.Count)]; BeatmapGroup group = groups[RNG.Next(groups.Count)];
BeatmapPanel panel = group?.BeatmapPanels.First(); BeatmapPanel panel = group?.BeatmapPanels.First();
if (panel == null) if (panel == null)
return; return;
SelectGroup(group, panel); SelectGroup(group, panel);
} }
public IEnumerator<BeatmapGroup> GetEnumerator() => groups.GetEnumerator(); public IEnumerator<BeatmapGroup> GetEnumerator() => groups.GetEnumerator();

View File

@ -146,7 +146,7 @@ namespace osu.Game.Screens.Select
Position = wedged_container_start_position, Position = wedged_container_start_position,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
FilterChanged = filterChanged, FilterChanged = filterChanged,
Exit = () => Exit(), Exit = Exit,
}, },
beatmapInfoWedge = new BeatmapInfoWedge beatmapInfoWedge = new BeatmapInfoWedge
{ {
@ -198,7 +198,6 @@ namespace osu.Game.Screens.Select
filterTask = null; filterTask = null;
var search = filter.Search; var search = filter.Search;
BeatmapGroup newSelection = null; BeatmapGroup newSelection = null;
bool changed = false;
foreach (var beatmapGroup in carousel) foreach (var beatmapGroup in carousel)
{ {
var set = beatmapGroup.BeatmapSet; var set = beatmapGroup.BeatmapSet;
@ -209,24 +208,20 @@ namespace osu.Game.Screens.Select
|| (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1; || (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1;
if (match) if (match)
{ {
changed |= beatmapGroup.State != BeatmapGroupState.Hidden;
beatmapGroup.State = BeatmapGroupState.Collapsed; beatmapGroup.State = BeatmapGroupState.Collapsed;
if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID) if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID)
newSelection = beatmapGroup; newSelection = beatmapGroup;
} }
else else
{ {
changed |= beatmapGroup.State == BeatmapGroupState.Hidden;
beatmapGroup.State = BeatmapGroupState.Hidden; beatmapGroup.State = BeatmapGroupState.Hidden;
} }
} }
if (newSelection != null) if (newSelection != null)
selectBeatmap(newSelection.BeatmapSet.Beatmaps[0]); carousel.SelectBeatmap(newSelection.BeatmapSet.Beatmaps[0], false);
if (changed)
carousel.InvalidateVisible();
}, 250); }, 250);
} }
private void onDatabaseOnBeatmapSetAdded(BeatmapSetInfo s) private void onDatabaseOnBeatmapSetAdded(BeatmapSetInfo s)
{ {
Schedule(() => addBeatmapSet(s, Game, true)); Schedule(() => addBeatmapSet(s, Game, true));
@ -320,11 +315,9 @@ namespace osu.Game.Screens.Select
//todo: change background in selectionChanged instead; support per-difficulty backgrounds. //todo: change background in selectionChanged instead; support per-difficulty backgrounds.
changeBackground(beatmap); changeBackground(beatmap);
selectBeatmap(beatmap.BeatmapInfo); carousel.SelectBeatmap(beatmap.BeatmapInfo);
} }
private void selectBeatmap(BeatmapInfo beatmap) => carousel.SelectBeatmap(beatmap);
/// <summary> /// <summary>
/// selection has been changed as the result of interaction with the carousel. /// selection has been changed as the result of interaction with the carousel.
/// </summary> /// </summary>