mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:52:55 +08:00
Propagate clock state from editor to gameplay test
This commit is contained in:
parent
ca239ca40a
commit
d2ddc25ab3
@ -325,6 +325,19 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
|
public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an <see cref="EditorState"/> instance representing the current state of the editor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="nextBeatmap">
|
||||||
|
/// The next beatmap to be shown, in the case of difficulty switch.
|
||||||
|
/// <see langword="null"/> indicates that the beatmap will not be changing.
|
||||||
|
/// </param>
|
||||||
|
private EditorState getState([CanBeNull] BeatmapInfo nextBeatmap = null) => new EditorState
|
||||||
|
{
|
||||||
|
Time = clock.CurrentTimeAccurate,
|
||||||
|
ClipboardContent = nextBeatmap == null || editorBeatmap.BeatmapInfo.RulesetID == nextBeatmap.RulesetID ? Clipboard.Content.Value : string.Empty
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restore the editor to a provided state.
|
/// Restore the editor to a provided state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -780,11 +793,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
return new DifficultyMenuItem(beatmapInfo, isCurrentDifficulty, SwitchToDifficulty);
|
return new DifficultyMenuItem(beatmapInfo, isCurrentDifficulty, SwitchToDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SwitchToDifficulty(BeatmapInfo nextBeatmap) => loader?.ScheduleDifficultySwitch(nextBeatmap, new EditorState
|
protected void SwitchToDifficulty(BeatmapInfo nextBeatmap) => loader?.ScheduleDifficultySwitch(nextBeatmap, getState(nextBeatmap));
|
||||||
{
|
|
||||||
Time = clock.CurrentTimeAccurate,
|
|
||||||
ClipboardContent = editorBeatmap.BeatmapInfo.RulesetID == nextBeatmap.RulesetID ? Clipboard.Content.Value : string.Empty
|
|
||||||
});
|
|
||||||
|
|
||||||
private void cancelExit()
|
private void cancelExit()
|
||||||
{
|
{
|
||||||
@ -807,7 +816,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
pushEditorPlayer();
|
pushEditorPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushEditorPlayer() => this.Push(new EditorPlayerLoader());
|
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
|
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -10,14 +11,20 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
{
|
{
|
||||||
public class EditorPlayer : Player
|
public class EditorPlayer : Player
|
||||||
{
|
{
|
||||||
public EditorPlayer()
|
private readonly EditorState editorState;
|
||||||
: base(new PlayerConfiguration { ShowResults = false })
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController musicController { get; set; }
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
|
public EditorPlayer(EditorState editorState)
|
||||||
|
: base(new PlayerConfiguration { ShowResults = false })
|
||||||
|
{
|
||||||
|
this.editorState = editorState;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
|
||||||
|
=> new MasterGameplayClockContainer(beatmap, editorState.Time, true);
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuLogo osuLogo { get; set; }
|
private OsuLogo osuLogo { get; set; }
|
||||||
|
|
||||||
public EditorPlayerLoader()
|
public EditorPlayerLoader(EditorState editorState)
|
||||||
: base(() => new EditorPlayer())
|
: base(() => new EditorPlayer(editorState))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user