Propagate clock state from gameplay test back to editor

This commit is contained in:
Bartłomiej Dach
2021-11-12 13:12:25 +01:00
parent d2ddc25ab3
commit 2562412125
3 changed files with 12 additions and 7 deletions

View File

@ -11,15 +11,17 @@ namespace osu.Game.Screens.Edit.GameplayTest
{
public class EditorPlayer : Player
{
private readonly Editor editor;
private readonly EditorState editorState;
[Resolved]
private MusicController musicController { get; set; }
public EditorPlayer(EditorState editorState)
public EditorPlayer(Editor editor)
: base(new PlayerConfiguration { ShowResults = false })
{
this.editorState = editorState;
this.editor = editor;
editorState = editor.GetState();
}
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
@ -45,6 +47,9 @@ namespace osu.Game.Screens.Edit.GameplayTest
public override bool OnExiting(IScreen next)
{
musicController.Stop();
editorState.Time = GameplayClockContainer.CurrentTime;
editor.RestoreState(editorState);
return base.OnExiting(next);
}
}