Skip to content

Commit

Permalink
Fix combo colour normalisation setting not applying to editor test play
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Nov 16, 2022
1 parent f1b031d commit ee6fffe
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions osu.Game/Screens/Edit/GameplayTest/EditorPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. 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 })
Expand All @@ -26,6 +28,14 @@ public EditorPlayer(Editor editor)
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);
Expand Down Expand Up @@ -74,5 +84,9 @@ public override bool OnExiting(ScreenExitEvent e)
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;
}
}

0 comments on commit ee6fffe

Please sign in to comment.