mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Make IOsuScreen.AllowTrackAdjustments nullable
Allows for inheriting value from the previous screen if undefined
This commit is contained in:
parent
52b1539dea
commit
b9193aae6d
@ -1075,8 +1075,6 @@ namespace osu.Game
|
|||||||
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
|
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
|
||||||
API.Activity.BindTo(newOsuScreen.Activity);
|
API.Activity.BindTo(newOsuScreen.Activity);
|
||||||
|
|
||||||
MusicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments;
|
|
||||||
|
|
||||||
if (newOsuScreen.HideOverlaysOnEnter)
|
if (newOsuScreen.HideOverlaysOnEnter)
|
||||||
CloseAllOverlays();
|
CloseAllOverlays();
|
||||||
else
|
else
|
||||||
@ -1093,6 +1091,24 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
ScreenChanged(lastScreen, newScreen);
|
ScreenChanged(lastScreen, newScreen);
|
||||||
Logger.Log($"Screen changed → {newScreen}");
|
Logger.Log($"Screen changed → {newScreen}");
|
||||||
|
|
||||||
|
// set AllowTrackAdjustments if new screen defines it, inherit otherwise
|
||||||
|
if (newScreen is IOsuScreen newOsuScreen && newOsuScreen.AllowTrackAdjustments.HasValue)
|
||||||
|
{
|
||||||
|
allowTrackAdjustmentsStack.Push(newOsuScreen.AllowTrackAdjustments.Value);
|
||||||
|
Logger.Log($"Screen's AllowTrackAdjustments explicit → {allowTrackAdjustmentsStack.First()}");
|
||||||
|
}
|
||||||
|
else if (allowTrackAdjustmentsStack.Any())
|
||||||
|
{
|
||||||
|
allowTrackAdjustmentsStack.Push(allowTrackAdjustmentsStack.First());
|
||||||
|
Logger.Log($"Screen's AllowTrackAdjustments inherit → {allowTrackAdjustmentsStack.First()}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allowTrackAdjustmentsStack.Push(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsStack.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||||
@ -1102,8 +1118,17 @@ namespace osu.Game
|
|||||||
|
|
||||||
if (newScreen == null)
|
if (newScreen == null)
|
||||||
Exit();
|
Exit();
|
||||||
|
|
||||||
|
if (allowTrackAdjustmentsStack.Count > 1)
|
||||||
|
{
|
||||||
|
allowTrackAdjustmentsStack.Pop();
|
||||||
|
MusicController.AllowTrackAdjustments = allowTrackAdjustmentsStack.First();
|
||||||
|
Logger.Log($"Screen's AllowTrackAdjustments return ← {allowTrackAdjustmentsStack.First()}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Stack<bool> allowTrackAdjustmentsStack = new Stack<bool>();
|
||||||
|
|
||||||
IBindable<bool> ILocalUserPlayInfo.IsPlaying => LocalUserPlaying;
|
IBindable<bool> ILocalUserPlayInfo.IsPlaying => LocalUserPlaying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
|
|
||||||
private OsuDirectorySelector directorySelector;
|
private OsuDirectorySelector directorySelector;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Text to display in the header to inform the user of what they are selecting.
|
/// Text to display in the header to inform the user of what they are selecting.
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
protected bool HasUnsavedChanges => lastSavedHash != changeHandler.CurrentStateHash;
|
protected bool HasUnsavedChanges => lastSavedHash != changeHandler.CurrentStateHash;
|
||||||
|
|
||||||
|
@ -60,8 +60,9 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether mod track adjustments are allowed to be applied.
|
/// Whether mod track adjustments are allowed to be applied.
|
||||||
|
/// Null means to inherit from the parent screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool AllowTrackAdjustments { 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"/>.
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Import
|
|||||||
{
|
{
|
||||||
public override bool HideOverlaysOnEnter => true;
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
private OsuFileSelector fileSelector;
|
private OsuFileSelector fileSelector;
|
||||||
private Container contentContainer;
|
private Container contentContainer;
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
public override bool AllowExternalScreenChange => true;
|
public override bool AllowExternalScreenChange => true;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
|
@ -26,7 +26,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 AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether all spectating players have finished loading.
|
/// Whether all spectating players have finished loading.
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
[Cached]
|
[Cached]
|
||||||
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
|
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;
|
public override bool CursorVisible => (screenStack?.CurrentScreen as IOnlinePlaySubScreen)?.CursorVisible ?? true;
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
{
|
{
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => false;
|
public override bool DisallowExternalBeatmapRulesetChanges => false;
|
||||||
|
|
||||||
|
public override bool? AllowTrackAdjustments => true;
|
||||||
|
|
||||||
public virtual string ShortTitle => Title;
|
public virtual string ShortTitle => Title;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public virtual float BackgroundParallaxAmount => 1;
|
public virtual float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
public virtual bool AllowTrackAdjustments => true;
|
public virtual bool? AllowTrackAdjustments => null;
|
||||||
|
|
||||||
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
|
@ -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 AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
private readonly IBindable<bool> gameActive = new Bindable<bool>(true);
|
private readonly IBindable<bool> gameActive = new Bindable<bool>(true);
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
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));
|
public void ApplyToBackground(Action<BackgroundScreenBeatmap> action) => base.ApplyToBackground(b => action.Invoke((BackgroundScreenBeatmap)b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
|
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user