1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 23:27:25 +08:00

Adds DisableSeek property to MusicController

This commit is contained in:
Jacob Odgård Tørring 2018-05-10 13:20:04 +02:00
parent a8ca0c899d
commit d54a7295f6
4 changed files with 13 additions and 6 deletions

View File

@ -537,10 +537,13 @@ namespace osu.Game
// 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.
bool applyRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false;
bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false;
bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false;
Ruleset.Disabled = applyRestrictions;
Beatmap.Disabled = applyRestrictions;
Ruleset.Disabled = applyBeatmapRulesetRestrictions;
Beatmap.Disabled = applyBeatmapRulesetRestrictions;
musicController.DisableSeek = applyUserSeekRestrictions;
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };

View File

@ -221,9 +221,7 @@ namespace osu.Game.Overlays
private bool? conditionalSeek(double progress)
{
if (current.Track.Looping)
return current?.Track.Seek(progress);
return false;
return DisableSeek ? false : current?.Track.Seek(progress);
}
protected override void LoadComplete()
@ -235,6 +233,8 @@ namespace osu.Game.Overlays
base.LoadComplete();
}
public bool DisableSeek { get; set; }
private void beatmapDisabledChanged(bool disabled)
{
if (disabled)

View File

@ -50,6 +50,8 @@ namespace osu.Game.Screens
/// </summary>
public virtual bool AllowBeatmapRulesetChange => true;
public virtual bool AllowUserSeek => true;
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected virtual float BackgroundParallaxAmount => 1;

View File

@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play
public override bool AllowBeatmapRulesetChange => false;
public override bool AllowUserSeek => false;
protected const float BACKGROUND_FADE_DURATION = 800;
protected float BackgroundOpacity => 1 - (float)DimLevel;