1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:43:10 +08:00

Move all the "inherit previous AllowTrackAdjustments" logic into OsuScreen

This commit is contained in:
AbstractQbit 2021-09-15 21:25:39 +03:00
parent 931e873a7e
commit 318f0941ca
8 changed files with 13 additions and 11 deletions

View File

@ -1075,10 +1075,7 @@ namespace osu.Game
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
API.Activity.BindTo(newOsuScreen.Activity);
if (newOsuScreen.AllowTrackAdjustments.HasValue)
MusicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments.Value;
else
newOsuScreen.AllowTrackAdjustments = MusicController.AllowTrackAdjustments;
MusicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments;
if (newOsuScreen.HideOverlaysOnEnter)
CloseAllOverlays();

View File

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

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens
/// Whether mod track adjustments are allowed to be applied.
/// A <see langword="null"/> value means that the parent screen's value of this setting will be used.
/// </summary>
bool? AllowTrackAdjustments { get; set; }
bool AllowTrackAdjustments { get; }
/// <summary>
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.

View File

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

View File

@ -11,7 +11,7 @@ namespace osu.Game.Screens.OnlinePlay
{
public override bool DisallowExternalBeatmapRulesetChanges => false;
public override bool? AllowTrackAdjustments => true;
public override bool AllowTrackAdjustments => true;
public virtual string ShortTitle => Title;

View File

@ -81,7 +81,12 @@ namespace osu.Game.Screens
public virtual float BackgroundParallaxAmount => 1;
public virtual bool? AllowTrackAdjustments { get; set; }
[Resolved]
private MusicController musicController { get; set; }
private bool? allowTrackAdjustments;
public virtual bool AllowTrackAdjustments => allowTrackAdjustments ??= (musicController?.AllowTrackAdjustments ?? false);
public Bindable<WorkingBeatmap> Beatmap { get; private set; }

View File

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

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select
protected virtual bool DisplayStableImportPrompt => stableImportManager?.SupportsImportFromStable == true;
public override bool? AllowTrackAdjustments => true;
public override bool AllowTrackAdjustments => true;
/// <summary>
/// Can be null if <see cref="ShowFooter"/> is false.