mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Allow screen to specify whether to apply audio rate adjustments from mods
This commit is contained in:
parent
b8bb97607b
commit
6d06b444ba
@ -925,6 +925,8 @@ namespace osu.Game
|
||||
{
|
||||
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
|
||||
|
||||
musicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
|
||||
|
||||
if (newOsuScreen.HideOverlaysOnEnter)
|
||||
CloseAllOverlays();
|
||||
else
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Overlays
|
||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets().OrderBy(_ => RNG.Next()));
|
||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||
@ -233,6 +233,24 @@ namespace osu.Game.Overlays
|
||||
queuedDirection = null;
|
||||
}
|
||||
|
||||
private bool allowRateAdjustments;
|
||||
|
||||
/// <summary>
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
public bool AllowRateAdjustments
|
||||
{
|
||||
get => allowRateAdjustments;
|
||||
set
|
||||
{
|
||||
if (allowRateAdjustments == value)
|
||||
return;
|
||||
|
||||
allowRateAdjustments = value;
|
||||
ResetTrackAdjustments();
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetTrackAdjustments()
|
||||
{
|
||||
var track = current?.Track;
|
||||
@ -241,8 +259,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
track.ResetSpeedAdjustments();
|
||||
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToClock>())
|
||||
mod.ApplyToClock(track);
|
||||
if (allowRateAdjustments)
|
||||
{
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToClock>())
|
||||
mod.ApplyToClock(track);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -51,5 +51,10 @@ namespace osu.Game.Screens
|
||||
Bindable<WorkingBeatmap> Beatmap { get; }
|
||||
|
||||
Bindable<RulesetInfo> Ruleset { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
bool AllowRateAdjustments { get; }
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
public override bool AllowRateAdjustments => false;
|
||||
|
||||
private Screen songSelect;
|
||||
|
||||
private MenuSideFlashes sideFlashes;
|
||||
|
@ -91,6 +91,8 @@ namespace osu.Game.Screens
|
||||
|
||||
public Bindable<RulesetInfo> Ruleset { get; private set; }
|
||||
|
||||
public virtual bool AllowRateAdjustments => true;
|
||||
|
||||
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
|
@ -16,6 +16,8 @@ namespace osu.Game.Screens
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
public override bool AllowRateAdjustments => false;
|
||||
|
||||
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user