Rename GameplayAdjustments -> AdjustmentsFromMods

This commit is contained in:
Dan Balasescu
2022-09-08 17:14:06 +09:00
parent b0b4da533a
commit b559d4ecdf
10 changed files with 25 additions and 18 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tests.NonVisual
public TestGameplayClockContainer(IFrameBasedClock underlyingClock) public TestGameplayClockContainer(IFrameBasedClock underlyingClock)
: base(underlyingClock) : base(underlyingClock)
{ {
GameplayAdjustments.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(2.0)); AdjustmentsFromMods.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(2.0));
} }
} }
} }

View File

@ -265,7 +265,7 @@ namespace osu.Game.Rulesets.UI
private readonly AudioAdjustments gameplayAdjustments = new AudioAdjustments(); private readonly AudioAdjustments gameplayAdjustments = new AudioAdjustments();
public IAdjustableAudioComponent GameplayAdjustments => parentGameplayClock?.GameplayAdjustments ?? gameplayAdjustments; public IAdjustableAudioComponent AdjustmentsFromMods => parentGameplayClock?.AdjustmentsFromMods ?? gameplayAdjustments;
#endregion #endregion

View File

@ -14,7 +14,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// </summary> /// </summary>
public class MultiSpectatorPlayer : SpectatorPlayer public class MultiSpectatorPlayer : SpectatorPlayer
{ {
public IAdjustableAudioComponent GameplayAdjustments => GameplayClockContainer.GameplayAdjustments; /// <summary>
/// All adjustments applied to the clock of this <see cref="MultiSpectatorPlayer"/> which come from mods.
/// </summary>
public readonly AudioAdjustments ClockAdjustmentsFromMods = new AudioAdjustments();
private readonly SpectatorPlayerClock spectatorPlayerClock; private readonly SpectatorPlayerClock spectatorPlayerClock;
@ -56,6 +59,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
} }
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
=> new GameplayClockContainer(spectatorPlayerClock); {
var gameplayClockContainer = new GameplayClockContainer(spectatorPlayerClock);
ClockAdjustmentsFromMods.BindAdjustments(gameplayClockContainer.AdjustmentsFromMods);
return gameplayClockContainer;
}
} }
} }

View File

@ -187,10 +187,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
private void bindAudioAdjustments(PlayerArea first) private void bindAudioAdjustments(PlayerArea first)
{ {
if (boundAdjustments != null) if (boundAdjustments != null)
masterClockContainer.GameplayAdjustments.UnbindAdjustments(boundAdjustments); masterClockContainer.AdjustmentsFromMods.UnbindAdjustments(boundAdjustments);
boundAdjustments = first.GameplayAdjustments; boundAdjustments = first.ClockAdjustmentsFromMods;
masterClockContainer.GameplayAdjustments.BindAdjustments(boundAdjustments); masterClockContainer.AdjustmentsFromMods.BindAdjustments(boundAdjustments);
} }
private bool isCandidateAudioSource(SpectatorPlayerClock? clock) private bool isCandidateAudioSource(SpectatorPlayerClock? clock)

View File

@ -43,9 +43,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
public readonly SpectatorPlayerClock SpectatorPlayerClock; public readonly SpectatorPlayerClock SpectatorPlayerClock;
/// <summary> /// <summary>
/// The gameplay adjustments applied by the <see cref="Player"/> loaded in this area. /// The clock adjustments applied by the <see cref="Player"/> loaded in this area.
/// </summary> /// </summary>
public readonly AudioAdjustments GameplayAdjustments = new AudioAdjustments(); public readonly AudioAdjustments ClockAdjustmentsFromMods = new AudioAdjustments();
/// <summary> /// <summary>
/// The currently-loaded score. /// The currently-loaded score.
@ -103,7 +103,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
var player = new MultiSpectatorPlayer(Score, SpectatorPlayerClock); var player = new MultiSpectatorPlayer(Score, SpectatorPlayerClock);
player.OnGameplayStarted += () => OnGameplayStarted?.Invoke(); player.OnGameplayStarted += () => OnGameplayStarted?.Invoke();
GameplayAdjustments.BindAdjustments(player.GameplayAdjustments); ClockAdjustmentsFromMods.BindAdjustments(player.ClockAdjustmentsFromMods);
return player; return player;
})); }));

View File

@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play
/// </remarks> /// </remarks>
public double StartTime { get; protected set; } public double StartTime { get; protected set; }
public IAdjustableAudioComponent GameplayAdjustments { get; } = new AudioAdjustments(); public IAdjustableAudioComponent AdjustmentsFromMods { get; } = new AudioAdjustments();
private readonly BindableBool isPaused = new BindableBool(true); private readonly BindableBool isPaused = new BindableBool(true);

View File

@ -17,8 +17,8 @@ namespace osu.Game.Screens.Play
double rate = clock.Rate == 0 ? 1 : Math.Sign(clock.Rate); double rate = clock.Rate == 0 ? 1 : Math.Sign(clock.Rate);
return rate return rate
* clock.GameplayAdjustments.AggregateFrequency.Value * clock.AdjustmentsFromMods.AggregateFrequency.Value
* clock.GameplayAdjustments.AggregateTempo.Value; * clock.AdjustmentsFromMods.AggregateTempo.Value;
} }
} }
} }

View File

@ -19,9 +19,9 @@ namespace osu.Game.Screens.Play
double StartTime { get; } double StartTime { get; }
/// <summary> /// <summary>
/// All adjustments applied to this clock which come from gameplay or mods. /// All adjustments applied to this clock which come from mods.
/// </summary> /// </summary>
IAdjustableAudioComponent GameplayAdjustments { get; } IAdjustableAudioComponent AdjustmentsFromMods { get; }
IBindable<bool> IsPaused { get; } IBindable<bool> IsPaused { get; }
} }

View File

@ -201,7 +201,7 @@ namespace osu.Game.Screens.Play
musicController.ResetTrackAdjustments(); musicController.ResetTrackAdjustments();
track.BindAdjustments(GameplayAdjustments); track.BindAdjustments(AdjustmentsFromMods);
track.AddAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust); track.AddAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate); track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);
@ -213,7 +213,7 @@ namespace osu.Game.Screens.Play
if (!speedAdjustmentsApplied) if (!speedAdjustmentsApplied)
return; return;
track.UnbindAdjustments(GameplayAdjustments); track.UnbindAdjustments(AdjustmentsFromMods);
track.RemoveAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust); track.RemoveAdjustment(AdjustableProperty.Frequency, GameplayClock.ExternalPauseFrequencyAdjust);
track.RemoveAdjustment(AdjustableProperty.Tempo, UserPlaybackRate); track.RemoveAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);

View File

@ -997,7 +997,7 @@ namespace osu.Game.Screens.Play
mod.ApplyToHUD(HUDOverlay); mod.ApplyToHUD(HUDOverlay);
foreach (var mod in GameplayState.Mods.OfType<IApplicableToTrack>()) foreach (var mod in GameplayState.Mods.OfType<IApplicableToTrack>())
mod.ApplyToTrack(GameplayClockContainer.GameplayAdjustments); mod.ApplyToTrack(GameplayClockContainer.AdjustmentsFromMods);
updateGameplayState(); updateGameplayState();