1
0
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:
Dean Herbert 2024-05-29 21:32:52 +09:00
parent 16e2fa2c6a
commit d2c86b0813
No known key found for this signature in database
3 changed files with 21 additions and 18 deletions

View File

@ -452,7 +452,7 @@ namespace osu.Game.Screens.Edit
pushEditorPlayer();
}
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this, playableBeatmap));
void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this));
}
/// <summary>

View File

@ -21,19 +21,17 @@ namespace osu.Game.Screens.Edit.GameplayTest
{
private readonly Editor editor;
private readonly EditorState editorState;
private readonly IBeatmap playableBeatmap;
protected override UserActivity InitialActivity => new UserActivity.TestingBeatmap(Beatmap.Value.BeatmapInfo);
[Resolved]
private MusicController musicController { get; set; } = null!;
public EditorPlayer(Editor editor, IBeatmap playableBeatmap)
public EditorPlayer(Editor editor)
: base(new PlayerConfiguration { ShowResults = false })
{
this.editor = editor;
editorState = editor.GetState();
this.playableBeatmap = playableBeatmap;
}
protected override GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart)
@ -52,17 +50,7 @@ namespace osu.Game.Screens.Edit.GameplayTest
{
base.LoadComplete();
var frame = new ReplayFrame { Header = new FrameHeader(new ScoreInfo(), new ScoreProcessorStatistics()) };
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);
markPreviousObjectsHit();
ScoreProcessor.HasCompleted.BindValueChanged(completed =>
{
@ -75,6 +63,22 @@ namespace osu.Game.Screens.Edit.GameplayTest
}, 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)
{

View File

@ -4,7 +4,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
@ -15,8 +14,8 @@ namespace osu.Game.Screens.Edit.GameplayTest
[Resolved]
private OsuLogo osuLogo { get; set; } = null!;
public EditorPlayerLoader(Editor editor, IBeatmap playableBeatmap)
: base(() => new EditorPlayer(editor, playableBeatmap))
public EditorPlayerLoader(Editor editor)
: base(() => new EditorPlayer(editor))
{
}