mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +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.
|
// 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.
|
// 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;
|
Ruleset.Disabled = applyBeatmapRulesetRestrictions;
|
||||||
Beatmap.Disabled = applyRestrictions;
|
Beatmap.Disabled = applyBeatmapRulesetRestrictions;
|
||||||
|
|
||||||
|
musicController.DisableSeek = applyUserSeekRestrictions;
|
||||||
|
|
||||||
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||||
|
|
||||||
|
@ -221,9 +221,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private bool? conditionalSeek(double progress)
|
private bool? conditionalSeek(double progress)
|
||||||
{
|
{
|
||||||
if (current.Track.Looping)
|
return DisableSeek ? false : current?.Track.Seek(progress);
|
||||||
return current?.Track.Seek(progress);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -235,6 +233,8 @@ namespace osu.Game.Overlays
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DisableSeek { get; set; }
|
||||||
|
|
||||||
private void beatmapDisabledChanged(bool disabled)
|
private void beatmapDisabledChanged(bool disabled)
|
||||||
{
|
{
|
||||||
if (disabled)
|
if (disabled)
|
||||||
|
@ -50,6 +50,8 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool AllowBeatmapRulesetChange => true;
|
public virtual bool AllowBeatmapRulesetChange => true;
|
||||||
|
|
||||||
|
public virtual bool AllowUserSeek => true;
|
||||||
|
|
||||||
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected virtual float BackgroundParallaxAmount => 1;
|
protected virtual float BackgroundParallaxAmount => 1;
|
||||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
|
public override bool AllowUserSeek => false;
|
||||||
|
|
||||||
protected const float BACKGROUND_FADE_DURATION = 800;
|
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||||
|
|
||||||
protected float BackgroundOpacity => 1 - (float)DimLevel;
|
protected float BackgroundOpacity => 1 - (float)DimLevel;
|
||||||
|
Loading…
Reference in New Issue
Block a user