Merge pull request #168 from huoyaoyuan/fixes

Fixes for music controller
This commit is contained in:
Dean Herbert 2016-11-14 16:11:31 +09:00 committed by GitHub
commit 1d51e6af2a
4 changed files with 23 additions and 19 deletions

Binary file not shown.

View File

@ -51,11 +51,15 @@ namespace osu.Game.Beatmaps.Drawable
difficulties.Show(); difficulties.Show();
header.State = PanelSelectedState.Selected; header.State = PanelSelectedState.Selected;
if (SelectedPanel != null)
SelectedPanel.State = PanelSelectedState.Selected;
break; break;
case BeatmapGroupState.Collapsed: case BeatmapGroupState.Collapsed:
FadeTo(0.8f, 250); FadeTo(0.8f, 250);
header.State = PanelSelectedState.NotSelected; header.State = PanelSelectedState.NotSelected;
if (SelectedPanel != null)
SelectedPanel.State = PanelSelectedState.NotSelected;
difficulties.Hide(); difficulties.Hide();
break; break;
} }

View File

@ -109,10 +109,7 @@ namespace osu.Game
} }
}); });
(modeStack = new Intro (modeStack = new Intro()).Preload(this, d =>
{
Beatmap = Beatmap
}).Preload(this, d =>
{ {
mainContent.Add(d); mainContent.Add(d);

View File

@ -229,7 +229,7 @@ namespace osu.Game.Overlays
void preferUnicode_changed(object sender, EventArgs e) void preferUnicode_changed(object sender, EventArgs e)
{ {
updateDisplay(current, false); updateDisplay(current, TransformDirection.None);
} }
private void workingChanged(object sender = null, EventArgs e = null) private void workingChanged(object sender = null, EventArgs e = null)
@ -237,7 +237,7 @@ namespace osu.Game.Overlays
if (beatmapSource.Value == current) return; if (beatmapSource.Value == current) return;
bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false; bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false;
current = beatmapSource.Value; current = beatmapSource.Value;
updateDisplay(current, audioEquals ? null : (bool?)true); updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Next);
appendToHistory(current.BeatmapInfo); appendToHistory(current.BeatmapInfo);
} }
@ -298,10 +298,10 @@ namespace osu.Game.Overlays
current.Track.Start(); current.Track.Start();
beatmapSource.Value = current; beatmapSource.Value = current;
}); });
updateDisplay(current, isNext); updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev);
} }
private void updateDisplay(WorkingBeatmap beatmap, bool? isNext) private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
{ {
if (beatmap.Beatmap == null) if (beatmap.Beatmap == null)
//todo: we may need to display some default text here (currently in the constructor). //todo: we may need to display some default text here (currently in the constructor).
@ -315,20 +315,21 @@ namespace osu.Game.Overlays
Add(newBackground); Add(newBackground);
if (isNext == true) switch (direction)
{ {
case TransformDirection.Next:
newBackground.Position = new Vector2(400, 0); newBackground.Position = new Vector2(400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic); newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic); backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
} break;
else if (isNext == false) case TransformDirection.Prev:
{
newBackground.Position = new Vector2(-400, 0); newBackground.Position = new Vector2(-400, 0);
newBackground.MoveToX(0, 500, EasingTypes.OutCubic); newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic); backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
break;
} }
backgroundSprite.Expire();
backgroundSprite.Expire();
backgroundSprite = newBackground; backgroundSprite = newBackground;
} }
@ -354,6 +355,8 @@ namespace osu.Game.Overlays
protected override void PopOut() => FadeOut(100); protected override void PopOut() => FadeOut(100);
private enum TransformDirection { None, Next, Prev }
private class MusicControllerBackground : BufferedContainer private class MusicControllerBackground : BufferedContainer
{ {
private Sprite sprite; private Sprite sprite;