1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Move TaikoDifficultyHitObject creation back to TaikoDifficultyCalculator

This commit is contained in:
vun 2022-07-21 15:45:03 +08:00
parent b7567f7db2
commit 7917a60e3c
2 changed files with 18 additions and 24 deletions

View File

@ -3,7 +3,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour; using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour;
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
@ -11,31 +10,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
public class TaikoDifficultyPreprocessor public class TaikoDifficultyPreprocessor
{ {
/// <summary> /// <summary>
/// Creates a list of <see cref="TaikoDifficultyHitObject"/>s from a <see cref="IBeatmap"/>s. /// Does preprocessing on a list of <see cref="TaikoDifficultyHitObject"/>s.
/// This is placed here in a separate class to avoid <see cref="TaikoDifficultyCalculator"/> having to know /// TODO: Review this - this is currently only a one-step process, but will potentially be expanded in the future.
/// too much implementation details of the preprocessing, and avoid <see cref="TaikoDifficultyHitObject"/>
/// having circular dependencies with various preprocessing and evaluator classes.
/// </summary> /// </summary>
/// <param name="beatmap">The beatmap from which the list of <see cref="TaikoDifficultyHitObject"/> is created.</param> public static List<DifficultyHitObject> Process(List<DifficultyHitObject> difficultyHitObjects)
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
public static List<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
{ {
List<DifficultyHitObject> difficultyHitObjects = new List<DifficultyHitObject>();
List<TaikoDifficultyHitObject> centreObjects = new List<TaikoDifficultyHitObject>();
List<TaikoDifficultyHitObject> rimObjects = new List<TaikoDifficultyHitObject>();
List<TaikoDifficultyHitObject> noteObjects = new List<TaikoDifficultyHitObject>();
for (int i = 2; i < beatmap.HitObjects.Count; i++)
{
difficultyHitObjects.Add(
new TaikoDifficultyHitObject(
beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, difficultyHitObjects,
centreObjects, rimObjects, noteObjects, difficultyHitObjects.Count)
);
}
TaikoColourDifficultyPreprocessor.ProcessAndAssign(difficultyHitObjects); TaikoColourDifficultyPreprocessor.ProcessAndAssign(difficultyHitObjects);
return difficultyHitObjects; return difficultyHitObjects;
} }
} }

View File

@ -47,7 +47,21 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
{ {
return TaikoDifficultyPreprocessor.CreateDifficultyHitObjects(beatmap, clockRate); List<DifficultyHitObject> difficultyHitObjects = new List<DifficultyHitObject>();
List<TaikoDifficultyHitObject> centreObjects = new List<TaikoDifficultyHitObject>();
List<TaikoDifficultyHitObject> rimObjects = new List<TaikoDifficultyHitObject>();
List<TaikoDifficultyHitObject> noteObjects = new List<TaikoDifficultyHitObject>();
for (int i = 2; i < beatmap.HitObjects.Count; i++)
{
difficultyHitObjects.Add(
new TaikoDifficultyHitObject(
beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, difficultyHitObjects,
centreObjects, rimObjects, noteObjects, difficultyHitObjects.Count)
);
}
return TaikoDifficultyPreprocessor.Process(difficultyHitObjects);
} }
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)