Make IOsuScreen.AllowTrackAdjustments nullable

Allows for inheriting value from the previous screen if undefined
This commit is contained in:
AbstractQbit
2021-09-14 17:37:57 +03:00
parent 52b1539dea
commit b9193aae6d
13 changed files with 42 additions and 12 deletions

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

@ -60,8 +60,9 @@ namespace osu.Game.Screens
/// <summary>
/// Whether mod track adjustments are allowed to be applied.
/// Null means to inherit from the parent screen.
/// </summary>
bool AllowTrackAdjustments { get; }
bool? AllowTrackAdjustments { get; }
/// <summary>
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Import
{
public override bool HideOverlaysOnEnter => true;
public override bool AllowTrackAdjustments => false;
public override bool? AllowTrackAdjustments => false;
private OsuFileSelector fileSelector;
private Container contentContainer;

View File

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

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

@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay
[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
public override bool AllowTrackAdjustments => false;
public override bool? AllowTrackAdjustments => false;
public override bool CursorVisible => (screenStack?.CurrentScreen as IOnlinePlaySubScreen)?.CursorVisible ?? true;

View File

@ -11,6 +11,8 @@ namespace osu.Game.Screens.OnlinePlay
{
public override bool DisallowExternalBeatmapRulesetChanges => false;
public override bool? AllowTrackAdjustments => true;
public virtual string ShortTitle => Title;
[Resolved(CanBeNull = true)]

View File

@ -81,7 +81,7 @@ namespace osu.Game.Screens
public virtual float BackgroundParallaxAmount => 1;
public virtual bool AllowTrackAdjustments => true;
public virtual bool? AllowTrackAdjustments => null;
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

@ -10,6 +10,8 @@ namespace osu.Game.Screens.Play
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
public override bool? AllowTrackAdjustments => true;
public void ApplyToBackground(Action<BackgroundScreenBeatmap> action) => base.ApplyToBackground(b => action.Invoke((BackgroundScreenBeatmap)b));
}
}

View File

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