1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 23:47:24 +08:00

Merge pull request #814 from MrTheMake/songselect-fixes

Fixes to the song select screen
This commit is contained in:
Dean Herbert 2017-05-22 12:52:36 +09:00 committed by GitHub
commit f8c419f9ba
5 changed files with 50 additions and 10 deletions

View File

@ -57,12 +57,17 @@ namespace osu.Game.Screens
beatmap.Value = localMap;
}
beatmap.ValueChanged += OnBeatmapChanged;
if (osuGame != null)
ruleset.BindTo(osuGame.Ruleset);
}
protected override void LoadComplete()
{
base.LoadComplete();
beatmap.ValueChanged += OnBeatmapChanged;
}
/// <summary>
/// The global Beatmap was changed.
/// </summary>

View File

@ -155,7 +155,11 @@ namespace osu.Game.Screens.Select
index = (index + direction + groups.Count) % groups.Count;
if (groups[index].State != BeatmapGroupState.Hidden)
{
SelectBeatmap(groups[index].BeatmapPanels.First().Beatmap);
if (skipDifficulties)
SelectBeatmap(groups[index].SelectedPanel != null ? groups[index].SelectedPanel.Beatmap : groups[index].BeatmapPanels.First().Beatmap);
else
SelectBeatmap(direction == 1 ? groups[index].BeatmapPanels.First().Beatmap : groups[index].BeatmapPanels.Last().Beatmap);
return;
}
} while (index != startIndex);
@ -167,10 +171,8 @@ namespace osu.Game.Screens.Select
if (visibleGroups.Count < 1)
return;
BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)];
BeatmapPanel panel = group?.BeatmapPanels.First();
if (panel == null)
return;
BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)];
selectGroup(group, panel);
}
@ -409,7 +411,14 @@ namespace osu.Game.Screens.Select
int firstIndex = yPositions.BinarySearch(Current - Panel.MAX_HEIGHT);
if (firstIndex < 0) firstIndex = ~firstIndex;
int lastIndex = yPositions.BinarySearch(Current + drawHeight);
if (lastIndex < 0) lastIndex = ~lastIndex;
if (lastIndex < 0)
{
lastIndex = ~lastIndex;
// Add the first panel of the last visible beatmap group to preload its data.
if (lastIndex != 0 && panels[lastIndex - 1] is BeatmapSetHeader)
lastIndex++;
}
// Add those panels within the previously found index range that should be displayed.
for (int i = firstIndex; i < lastIndex; ++i)

View File

@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Menu;
@ -68,8 +69,6 @@ namespace osu.Game.Screens.Select
public Footer()
{
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
Anchor = Anchor.BottomCentre;
@ -124,5 +123,13 @@ namespace osu.Game.Screens.Select
updateModeLight();
}
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || StartButton.Contains(screenSpacePos);
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnClick(InputState state) => true;
protected override bool OnDragStart(InputState state) => true;
}
}

View File

@ -57,14 +57,23 @@ namespace osu.Game.Screens.Select
{
beatmap?.Mods.BindTo(modSelect.SelectedMods);
if (Beatmap?.Track != null)
Beatmap.Track.Looping = false;
beatmapDetails.Beatmap = beatmap;
if (beatmap?.Track != null)
beatmap.Track.Looping = true;
base.OnBeatmapChanged(beatmap);
}
protected override void OnResuming(Screen last)
{
player = null;
Beatmap.Track.Looping = true;
base.OnResuming(last);
}
@ -83,13 +92,21 @@ namespace osu.Game.Screens.Select
return true;
}
return base.OnExiting(next);
if (base.OnExiting(next))
return true;
if (Beatmap?.Track != null)
Beatmap.Track.Looping = false;
return false;
}
protected override void OnSelected()
{
if (player != null) return;
Beatmap.Track.Looping = false;
LoadComponentAsync(player = new PlayerLoader(new Player
{
Beatmap = Beatmap, //eagerly set this so it's present before push.

View File

@ -229,6 +229,8 @@ namespace osu.Game.Screens.Select
changeBackground(Beatmap);
selectionChangeNoBounce = Beatmap?.BeatmapInfo;
Content.FadeInFromZero(250);
beatmapInfoWedge.State = Visibility.Visible;