1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 09:42:55 +08:00

Move IGameplaySettings override to compose screen to keep test mode unaffected

This commit is contained in:
Salman Ahmed 2022-11-17 01:32:54 +03:00
parent ee6fffec5f
commit 7a28a7f2a0
4 changed files with 15 additions and 30 deletions

View File

@ -8,7 +8,7 @@ namespace osu.Game.Configuration
{ {
/// <summary> /// <summary>
/// A settings provider which generally sources from <see cref="OsuConfigManager"/> (global user settings) /// A settings provider which generally sources from <see cref="OsuConfigManager"/> (global user settings)
/// but can allow overriding settings by caching more locally. For instance, in the editor. /// but can allow overriding settings by caching more locally. For instance, in the editor compose screen.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// More settings can be moved into this interface as required. /// More settings can be moved into this interface as required.

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.IO.Serialization; using osu.Game.IO.Serialization;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -19,7 +20,7 @@ using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Screens.Edit.Compose namespace osu.Game.Screens.Edit.Compose
{ {
public class ComposeScreen : EditorScreenWithTimeline public class ComposeScreen : EditorScreenWithTimeline, IGameplaySettings
{ {
[Resolved] [Resolved]
private GameHost host { get; set; } private GameHost host { get; set; }
@ -27,6 +28,9 @@ namespace osu.Game.Screens.Edit.Compose
[Resolved] [Resolved]
private EditorClock clock { get; set; } private EditorClock clock { get; set; }
[Resolved]
private IGameplaySettings globalGameplaySettings { get; set; }
private Bindable<string> clipboard { get; set; } private Bindable<string> clipboard { get; set; }
private HitObjectComposer composer; private HitObjectComposer composer;
@ -157,5 +161,12 @@ namespace osu.Game.Screens.Edit.Compose
} }
#endregion #endregion
// Combo colour normalisation should not be applied in the editor.
// Note this doesn't affect editor test mode.
IBindable<float> IGameplaySettings.ComboColourNormalisationAmount => new Bindable<float>();
// Arguable.
IBindable<float> IGameplaySettings.PositionalHitsoundsLevel => globalGameplaySettings.PositionalHitsoundsLevel;
} }
} }

View File

@ -58,8 +58,7 @@ namespace osu.Game.Screens.Edit
{ {
[Cached(typeof(IBeatSnapProvider))] [Cached(typeof(IBeatSnapProvider))]
[Cached] [Cached]
public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IKeyBindingHandler<PlatformAction>, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider, public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IKeyBindingHandler<PlatformAction>, IBeatSnapProvider, ISamplePlaybackDisabler, IBeatSyncProvider
IGameplaySettings
{ {
public override float BackgroundParallaxAmount => 0.1f; public override float BackgroundParallaxAmount => 0.1f;
@ -99,9 +98,6 @@ namespace osu.Game.Screens.Edit
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private INotificationOverlay notifications { get; set; } private INotificationOverlay notifications { get; set; }
[Resolved]
private IGameplaySettings globalGameplaySettings { get; set; }
public readonly Bindable<EditorScreenMode> Mode = new Bindable<EditorScreenMode>(); public readonly Bindable<EditorScreenMode> Mode = new Bindable<EditorScreenMode>();
public IBindable<bool> SamplePlaybackDisabled => samplePlaybackDisabled; public IBindable<bool> SamplePlaybackDisabled => samplePlaybackDisabled;
@ -1045,11 +1041,5 @@ namespace osu.Game.Screens.Edit
{ {
} }
} }
// Combo colour normalisation should not be applied in the editor.
IBindable<float> IGameplaySettings.ComboColourNormalisationAmount => new Bindable<float>();
// Arguable.
IBindable<float> IGameplaySettings.PositionalHitsoundsLevel => globalGameplaySettings.PositionalHitsoundsLevel;
} }
} }

View File

@ -2,16 +2,14 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
namespace osu.Game.Screens.Edit.GameplayTest namespace osu.Game.Screens.Edit.GameplayTest
{ {
public class EditorPlayer : Player, IGameplaySettings public class EditorPlayer : Player
{ {
private readonly Editor editor; private readonly Editor editor;
private readonly EditorState editorState; private readonly EditorState editorState;
@ -19,8 +17,6 @@ namespace osu.Game.Screens.Edit.GameplayTest
[Resolved] [Resolved]
private MusicController musicController { get; set; } = null!; private MusicController musicController { get; set; } = null!;
private OsuConfigManager config = null!;
public EditorPlayer(Editor editor) public EditorPlayer(Editor editor)
: base(new PlayerConfiguration { ShowResults = false }) : base(new PlayerConfiguration { ShowResults = false })
{ {
@ -28,14 +24,6 @@ namespace osu.Game.Screens.Edit.GameplayTest
editorState = editor.GetState(); editorState = editor.GetState();
} }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
// needs to be populated before BDL to work correctly.
config = parent.Get<OsuConfigManager>();
return base.CreateChildDependencies(parent);
}
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
{ {
var masterGameplayClockContainer = new MasterGameplayClockContainer(beatmap, gameplayStart); var masterGameplayClockContainer = new MasterGameplayClockContainer(beatmap, gameplayStart);
@ -84,9 +72,5 @@ namespace osu.Game.Screens.Edit.GameplayTest
editor.RestoreState(editorState); editor.RestoreState(editorState);
return base.OnExiting(e); return base.OnExiting(e);
} }
// Editor overrides but we actually want to use game-wide settings here.
public IBindable<float> ComboColourNormalisationAmount => ((IGameplaySettings)config).ComboColourNormalisationAmount;
public IBindable<float> PositionalHitsoundsLevel => ((IGameplaySettings)config).PositionalHitsoundsLevel;
} }
} }