mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 05:22:54 +08:00
Avoid passing beatmap in from editor when it's already present
This commit is contained in:
parent
16e2fa2c6a
commit
d2c86b0813
@ -452,7 +452,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
pushEditorPlayer();
|
pushEditorPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this, playableBeatmap));
|
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,19 +21,17 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
{
|
{
|
||||||
private readonly Editor editor;
|
private readonly Editor editor;
|
||||||
private readonly EditorState editorState;
|
private readonly EditorState editorState;
|
||||||
private readonly IBeatmap playableBeatmap;
|
|
||||||
|
|
||||||
protected override UserActivity InitialActivity => new UserActivity.TestingBeatmap(Beatmap.Value.BeatmapInfo);
|
protected override UserActivity InitialActivity => new UserActivity.TestingBeatmap(Beatmap.Value.BeatmapInfo);
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController musicController { get; set; } = null!;
|
private MusicController musicController { get; set; } = null!;
|
||||||
|
|
||||||
public EditorPlayer(Editor editor, IBeatmap playableBeatmap)
|
public EditorPlayer(Editor editor)
|
||||||
: base(new PlayerConfiguration { ShowResults = false })
|
: base(new PlayerConfiguration { ShowResults = false })
|
||||||
{
|
{
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
editorState = editor.GetState();
|
editorState = editor.GetState();
|
||||||
this.playableBeatmap = playableBeatmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
|
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
|
||||||
@ -52,17 +50,7 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
var frame = new ReplayFrame { Header = new FrameHeader(new ScoreInfo(), new ScoreProcessorStatistics()) };
|
markPreviousObjectsHit();
|
||||||
|
|
||||||
foreach (var hitObject in enumerateHitObjects(playableBeatmap.HitObjects.Where(h => h.StartTime < editorState.Time)))
|
|
||||||
{
|
|
||||||
var judgement = hitObject.CreateJudgement();
|
|
||||||
frame.Header.Statistics.TryAdd(judgement.MaxResult, 0);
|
|
||||||
frame.Header.Statistics[judgement.MaxResult]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
HealthProcessor.ResetFromReplayFrame(frame);
|
|
||||||
ScoreProcessor.ResetFromReplayFrame(frame);
|
|
||||||
|
|
||||||
ScoreProcessor.HasCompleted.BindValueChanged(completed =>
|
ScoreProcessor.HasCompleted.BindValueChanged(completed =>
|
||||||
{
|
{
|
||||||
@ -75,6 +63,22 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
}, RESULTS_DISPLAY_DELAY);
|
}, RESULTS_DISPLAY_DELAY);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markPreviousObjectsHit()
|
||||||
|
{
|
||||||
|
var frame = new ReplayFrame { Header = new FrameHeader(new ScoreInfo(), new ScoreProcessorStatistics()) };
|
||||||
|
|
||||||
|
foreach (var hitObject in enumerateHitObjects(DrawableRuleset.Objects.Where(h => h.StartTime < editorState.Time)))
|
||||||
|
{
|
||||||
|
var judgement = hitObject.CreateJudgement();
|
||||||
|
|
||||||
|
frame.Header.Statistics.TryAdd(judgement.MaxResult, 0);
|
||||||
|
frame.Header.Statistics[judgement.MaxResult]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
HealthProcessor.ResetFromReplayFrame(frame);
|
||||||
|
ScoreProcessor.ResetFromReplayFrame(frame);
|
||||||
|
|
||||||
static IEnumerable<HitObject> enumerateHitObjects(IEnumerable<HitObject> hitObjects)
|
static IEnumerable<HitObject> enumerateHitObjects(IEnumerable<HitObject> hitObjects)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
@ -15,8 +14,8 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuLogo osuLogo { get; set; } = null!;
|
private OsuLogo osuLogo { get; set; } = null!;
|
||||||
|
|
||||||
public EditorPlayerLoader(Editor editor, IBeatmap playableBeatmap)
|
public EditorPlayerLoader(Editor editor)
|
||||||
: base(() => new EditorPlayer(editor, playableBeatmap))
|
: base(() => new EditorPlayer(editor))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user