1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +08:00

Reset all types of adjustments in MusicController; Rename AllowRateAdjustments to AllowTrackAdjustments

This commit is contained in:
Henry Lin 2021-07-29 15:39:26 +08:00
parent c67c763a92
commit 89e8296eb1
9 changed files with 22 additions and 19 deletions

View File

@ -1058,7 +1058,7 @@ namespace osu.Game
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode); OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
API.Activity.BindTo(newOsuScreen.Activity); API.Activity.BindTo(newOsuScreen.Activity);
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments; MusicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments;
if (newOsuScreen.HideOverlaysOnEnter) if (newOsuScreen.HideOverlaysOnEnter)
CloseAllOverlays(); CloseAllOverlays();

View File

@ -400,35 +400,38 @@ namespace osu.Game.Overlays
NextTrack(); NextTrack();
} }
private bool allowRateAdjustments; private bool allowTrackAdjustments;
/// <summary> /// <summary>
/// Whether mod rate adjustments are allowed to be applied. /// Whether mod track adjustments are allowed to be applied.
/// </summary> /// </summary>
public bool AllowRateAdjustments public bool AllowTrackAdjustments
{ {
get => allowRateAdjustments; get => allowTrackAdjustments;
set set
{ {
if (allowRateAdjustments == value) if (allowTrackAdjustments == value)
return; return;
allowRateAdjustments = value; allowTrackAdjustments = value;
ResetTrackAdjustments(); ResetTrackAdjustments();
} }
} }
/// <summary> /// <summary>
/// Resets the speed adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowRateAdjustments"/> is <c>true</c>. /// Resets the adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowTrackAdjustments"/> is <c>true</c>.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Does not reset speed adjustments applied directly to the beatmap track. /// Does not reset any adjustments applied directly to the beatmap track.
/// </remarks> /// </remarks>
public void ResetTrackAdjustments() public void ResetTrackAdjustments()
{ {
CurrentTrack.ResetSpeedAdjustments(); CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Balance);
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Frequency);
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo);
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume);
if (allowRateAdjustments) if (allowTrackAdjustments)
{ {
foreach (var mod in mods.Value.OfType<IApplicableToTrack>()) foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
mod.ApplyToTrack(CurrentTrack); mod.ApplyToTrack(CurrentTrack);

View File

@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit
public override bool DisallowExternalBeatmapRulesetChanges => true; public override bool DisallowExternalBeatmapRulesetChanges => true;
public override bool AllowRateAdjustments => false; public override bool AllowTrackAdjustments => false;
protected bool HasUnsavedChanges => lastSavedHash != changeHandler.CurrentStateHash; protected bool HasUnsavedChanges => lastSavedHash != changeHandler.CurrentStateHash;

View File

@ -59,9 +59,9 @@ namespace osu.Game.Screens
Bindable<RulesetInfo> Ruleset { get; } Bindable<RulesetInfo> Ruleset { get; }
/// <summary> /// <summary>
/// Whether mod rate adjustments are allowed to be applied. /// Whether mod track adjustments are allowed to be applied.
/// </summary> /// </summary>
bool AllowRateAdjustments { get; } bool AllowTrackAdjustments { get; }
/// <summary> /// <summary>
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>. /// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Menu
public override bool AllowExternalScreenChange => true; public override bool AllowExternalScreenChange => true;
public override bool AllowRateAdjustments => false; public override bool AllowTrackAdjustments => false;
private Screen songSelect; private Screen songSelect;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
public override bool DisallowExternalBeatmapRulesetChanges => true; public override bool DisallowExternalBeatmapRulesetChanges => true;
// We are managing our own adjustments. For now, this happens inside the Player instances themselves. // We are managing our own adjustments. For now, this happens inside the Player instances themselves.
public override bool AllowRateAdjustments => false; public override bool AllowTrackAdjustments => false;
/// <summary> /// <summary>
/// Whether all spectating players have finished loading. /// Whether all spectating players have finished loading.

View File

@ -81,7 +81,7 @@ namespace osu.Game.Screens
public virtual float BackgroundParallaxAmount => 1; public virtual float BackgroundParallaxAmount => 1;
public virtual bool AllowRateAdjustments => true; public virtual bool AllowTrackAdjustments => true;
public Bindable<WorkingBeatmap> Beatmap { get; private set; } public Bindable<WorkingBeatmap> Beatmap { get; private set; }

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered; protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
// We are managing our own adjustments (see OnEntering/OnExiting). // We are managing our own adjustments (see OnEntering/OnExiting).
public override bool AllowRateAdjustments => false; public override bool AllowTrackAdjustments => false;
private readonly IBindable<bool> gameActive = new Bindable<bool>(true); private readonly IBindable<bool> gameActive = new Bindable<bool>(true);

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens
public override bool CursorVisible => false; public override bool CursorVisible => false;
public override bool AllowRateAdjustments => false; public override bool AllowTrackAdjustments => false;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
} }