1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Make selectGroup a private method.

This commit is contained in:
Dean Herbert 2017-03-04 22:05:02 +09:00
parent a2b79de672
commit 8f3621ca24
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 10 additions and 9 deletions

View File

@ -137,14 +137,16 @@ namespace osu.Game.Screens.Select
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, animated); selectGroup(group, panel, animated);
return; return;
} }
} }
} }
public void SelectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true) private void selectGroup(BeatmapGroup group, BeatmapPanel panel, bool animated = true)
{ {
Trace.Assert(group.BeatmapPanels.Contains(panel), @"Selected panel must be in provided group");
if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden) if (SelectedGroup != null && SelectedGroup != group && SelectedGroup.State != BeatmapGroupState.Hidden)
SelectedGroup.State = BeatmapGroupState.Collapsed; SelectedGroup.State = BeatmapGroupState.Collapsed;
@ -334,7 +336,7 @@ namespace osu.Game.Screens.Select
if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count) if (i >= 0 && i < SelectedGroup.BeatmapPanels.Count)
{ {
//changing difficulty panel, not set. //changing difficulty panel, not set.
SelectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]); selectGroup(SelectedGroup, SelectedGroup.BeatmapPanels[i]);
return; return;
} }
} }
@ -357,11 +359,14 @@ namespace osu.Game.Screens.Select
{ {
if (groups.Count < 1) if (groups.Count < 1)
return; 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

@ -403,11 +403,7 @@ namespace osu.Game.Screens.Select
if (Beatmap == null || select) if (Beatmap == null || select)
carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
else else
{ carousel.SelectBeatmap(Beatmap.BeatmapInfo);
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
if (panel != null)
carousel.SelectGroup(group, panel);
}
})); }));
} }