mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +00:00
Make restoring state a public
call on Editor
This commit is contained in:
parent
2a894e7a3f
commit
f8bdca542d
@ -317,6 +317,16 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
|
public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restore the editor to a provided state.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">The state to restore.</param>
|
||||||
|
public void RestoreState([NotNull] EditorState state) => Schedule(() =>
|
||||||
|
{
|
||||||
|
clock.Seek(state.Time);
|
||||||
|
clipboard.Value = state.ClipboardContent;
|
||||||
|
});
|
||||||
|
|
||||||
protected void Save()
|
protected void Save()
|
||||||
{
|
{
|
||||||
// no longer new after first user-triggered save.
|
// no longer new after first user-triggered save.
|
||||||
@ -476,8 +486,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
});
|
});
|
||||||
|
|
||||||
resetTrack(true);
|
resetTrack(true);
|
||||||
if (loader?.State != null)
|
|
||||||
restoreState(loader.State);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -745,17 +753,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
protected void SwitchToDifficulty(BeatmapInfo nextBeatmap) => loader?.ScheduleDifficultySwitch(nextBeatmap, new EditorState
|
protected void SwitchToDifficulty(BeatmapInfo nextBeatmap) => loader?.ScheduleDifficultySwitch(nextBeatmap, new EditorState
|
||||||
{
|
{
|
||||||
Time = clock.CurrentTimeAccurate,
|
Time = clock.CurrentTimeAccurate,
|
||||||
ClipboardContent = editorBeatmap.BeatmapInfo.RulesetID == nextBeatmap.RulesetID ? clipboard.Value : null
|
ClipboardContent = editorBeatmap.BeatmapInfo.RulesetID == nextBeatmap.RulesetID ? clipboard.Value : string.Empty
|
||||||
});
|
});
|
||||||
|
|
||||||
private void restoreState([NotNull] EditorState state)
|
|
||||||
{
|
|
||||||
if (state.Time != null)
|
|
||||||
clock.Seek(state.Time.Value);
|
|
||||||
|
|
||||||
clipboard.Value = state.ClipboardContent ?? clipboard.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelExit() => loader?.CancelPendingDifficultySwitch();
|
private void cancelExit() => loader?.CancelPendingDifficultySwitch();
|
||||||
|
|
||||||
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
|
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
|
||||||
|
@ -91,7 +91,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private void pushEditor()
|
private void pushEditor()
|
||||||
{
|
{
|
||||||
this.Push(CreateEditor());
|
var editor = CreateEditor();
|
||||||
|
|
||||||
|
this.Push(editor);
|
||||||
|
|
||||||
|
if (state != null)
|
||||||
|
editor.RestoreState(state);
|
||||||
|
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user