mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Move MusicController
adjustment set to inside OsuScreen
itself (and result nullable
)
This commit is contained in:
parent
9057be1a02
commit
fa693bb8a8
@ -25,8 +25,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both };
|
stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both };
|
||||||
stack.ScreenPushed += screenChanged;
|
|
||||||
stack.ScreenExited += screenChanged;
|
|
||||||
|
|
||||||
Add(musicController);
|
Add(musicController);
|
||||||
Add(stack);
|
Add(stack);
|
||||||
@ -129,12 +127,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private class AllowScreen : OsuScreen
|
private class AllowScreen : OsuScreen
|
||||||
{
|
{
|
||||||
public override bool AllowTrackAdjustments => true;
|
public override bool? AllowTrackAdjustments => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DisallowScreen : OsuScreen
|
public class DisallowScreen : OsuScreen
|
||||||
{
|
{
|
||||||
public override bool AllowTrackAdjustments => false;
|
public override bool? AllowTrackAdjustments => false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InheritScreen : OsuScreen
|
private class InheritScreen : OsuScreen
|
||||||
@ -147,11 +145,5 @@ namespace osu.Game.Tests.Visual
|
|||||||
LoadComponent(screen);
|
LoadComponent(screen);
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenChanged(IScreen current, IScreen newScreen)
|
|
||||||
{
|
|
||||||
if (newScreen is IOsuScreen newOsuScreen)
|
|
||||||
musicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -59,10 +59,10 @@ namespace osu.Game.Screens
|
|||||||
Bindable<RulesetInfo> Ruleset { get; }
|
Bindable<RulesetInfo> Ruleset { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether mod track adjustments are allowed to be applied.
|
/// Whether mod track adjustments should be applied on entering this screen.
|
||||||
/// A <see langword="null"/> value means that the parent screen's value of this setting will be used.
|
/// A <see langword="null"/> value means that the parent screen's value of this setting will be used.
|
||||||
/// </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"/>.
|
||||||
|
@ -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.
|
||||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
{
|
{
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => false;
|
public override bool DisallowExternalBeatmapRulesetChanges => false;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => true;
|
public override bool? AllowTrackAdjustments => true;
|
||||||
|
|
||||||
public virtual string ShortTitle => Title;
|
public virtual string ShortTitle => Title;
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Screens.Menu;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Users;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
{
|
{
|
||||||
@ -84,9 +84,7 @@ namespace osu.Game.Screens
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController musicController { get; set; }
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
private bool? allowTrackAdjustments;
|
public virtual bool? AllowTrackAdjustments => null;
|
||||||
|
|
||||||
public virtual bool AllowTrackAdjustments => allowTrackAdjustments ??= (musicController?.AllowTrackAdjustments ?? false);
|
|
||||||
|
|
||||||
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
@ -96,6 +94,8 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
private OsuScreenDependencies screenDependencies;
|
private OsuScreenDependencies screenDependencies;
|
||||||
|
|
||||||
|
private bool trackAdjustmentStateAtSuspend;
|
||||||
|
|
||||||
internal void CreateLeasedDependencies(IReadOnlyDependencyContainer dependencies) => createDependencies(dependencies);
|
internal void CreateLeasedDependencies(IReadOnlyDependencyContainer dependencies) => createDependencies(dependencies);
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
@ -175,8 +175,11 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
if (PlayResumeSound)
|
if (PlayResumeSound)
|
||||||
sampleExit?.Play();
|
sampleExit?.Play();
|
||||||
|
|
||||||
applyArrivingDefaults(true);
|
applyArrivingDefaults(true);
|
||||||
|
|
||||||
|
musicController.AllowTrackAdjustments = trackAdjustmentStateAtSuspend;
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +187,8 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
|
||||||
|
trackAdjustmentStateAtSuspend = musicController.AllowTrackAdjustments;
|
||||||
|
|
||||||
onSuspendingLogo();
|
onSuspendingLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +196,9 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
applyArrivingDefaults(false);
|
applyArrivingDefaults(false);
|
||||||
|
|
||||||
|
if (AllowTrackAdjustments != null)
|
||||||
|
musicController.AllowTrackAdjustments = AllowTrackAdjustments.Value;
|
||||||
|
|
||||||
if (backgroundStack?.Push(ownedBackground = CreateBackground()) != true)
|
if (backgroundStack?.Push(ownedBackground = CreateBackground()) != true)
|
||||||
{
|
{
|
||||||
// If the constructed instance was not actually pushed to the background stack, we don't want to track it unnecessarily.
|
// If the constructed instance was not actually pushed to the background stack, we don't want to track it unnecessarily.
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected virtual bool DisplayStableImportPrompt => stableImportManager?.SupportsImportFromStable == true;
|
protected virtual bool DisplayStableImportPrompt => stableImportManager?.SupportsImportFromStable == true;
|
||||||
|
|
||||||
public override bool AllowTrackAdjustments => true;
|
public override bool? AllowTrackAdjustments => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||||
|
Loading…
Reference in New Issue
Block a user