mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 12:02:54 +08:00
Adds DisableSeek property to MusicController
This commit is contained in:
parent
a8ca0c899d
commit
d54a7295f6
@ -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 };
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user