1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Fix combo colour normalisation setting not applying to editor test play

This commit is contained in:
Dean Herbert 2022-11-16 17:54:49 +09:00
parent f1b031de9b
commit ee6fffec5f

View File

@ -1,23 +1,25 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable disable
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 public class EditorPlayer : Player, IGameplaySettings
{ {
private readonly Editor editor; private readonly Editor editor;
private readonly EditorState editorState; private readonly EditorState editorState;
[Resolved] [Resolved]
private MusicController musicController { get; set; } 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 })
@ -26,6 +28,14 @@ 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);
@ -74,5 +84,9 @@ 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;
} }
} }