Merge pull request #1009 from peppy/fix-track-rotation

Fix track rotation
This commit is contained in:
Dan Balasescu 2017-07-14 19:48:43 +10:00 committed by GitHub
commit aa15d369c3
6 changed files with 24 additions and 7 deletions

View File

@ -69,7 +69,7 @@ protected override Track GetTrack()
var trackData = getReader()?.GetStream(Metadata.AudioFile);
return trackData == null ? null : new TrackBass(trackData);
}
catch { return null; }
catch { return new TrackVirtual(); }
}
}
}
}

View File

@ -59,6 +59,9 @@ public MusicController()
{
Width = 400;
Margin = new MarginPadding(10);
// required to let MusicController handle beatmap cycling.
AlwaysPresent = true;
}
protected override bool OnDragStart(InputState state) => true;
@ -252,12 +255,16 @@ private void play()
private void prev()
{
if (beatmapBacking.Disabled) return;
queuedDirection = TransformDirection.Prev;
playlist.PlayPrevious();
}
private void next()
{
if (beatmapBacking.Disabled) return;
queuedDirection = TransformDirection.Next;
playlist.PlayNext();
}

View File

@ -29,7 +29,11 @@ public abstract class OsuScreen : Screen
internal virtual bool HasLocalCursorDisplayed => false;
internal virtual bool AllowRulesetChange => true;
/// <summary>
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
/// </summary>
internal virtual bool AllowBeatmapRulesetChange => true;
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
@ -85,7 +89,13 @@ protected override void Update()
{
if (!IsCurrentScreen) return;
ruleset.Disabled = !AllowRulesetChange;
if (ParentScreen != null)
{
// we only want to apply these restrictions when we are inside a screen stack.
// the use case for not applying is in visual/unit tests.
ruleset.Disabled = !AllowBeatmapRulesetChange;
beatmap.Disabled = !AllowBeatmapRulesetChange;
}
}
protected override void OnResuming(Screen last)

View File

@ -39,7 +39,7 @@ public class Player : OsuScreen
public Action RestartRequested;
internal override bool AllowRulesetChange => false;
internal override bool AllowBeatmapRulesetChange => false;
public bool HasFailed { get; private set; }

View File

@ -27,7 +27,7 @@ public class PlayerLoader : OsuScreen
private bool showOverlays = true;
internal override bool ShowOverlays => showOverlays;
internal override bool AllowRulesetChange => false;
internal override bool AllowBeatmapRulesetChange => false;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);

View File

@ -31,7 +31,7 @@ public class Results : OsuScreen
private ResultModeTabControl modeChangeButtons;
internal override bool AllowRulesetChange => false;
internal override bool AllowBeatmapRulesetChange => false;
private Container currentPage;