1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 02:07:34 +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.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.Edit.GameplayTest
{
public class EditorPlayer : Player
public class EditorPlayer : Player, IGameplaySettings
{
private readonly Editor editor;
private readonly EditorState editorState;
[Resolved]
private MusicController musicController { get; set; }
private MusicController musicController { get; set; } = null!;
private OsuConfigManager config = null!;
public EditorPlayer(Editor editor)
: base(new PlayerConfiguration { ShowResults = false })
@ -26,6 +28,14 @@ namespace osu.Game.Screens.Edit.GameplayTest
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)
{
var masterGameplayClockContainer = new MasterGameplayClockContainer(beatmap, gameplayStart);
@ -74,5 +84,9 @@ namespace osu.Game.Screens.Edit.GameplayTest
editor.RestoreState(editorState);
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;
}
}