1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 03:25:03 +08:00

Add FirstHitObject as a property of encoding classes

This commit is contained in:
vun 2022-08-19 16:13:36 +08:00
parent a26de0a10f
commit 684efefb50
6 changed files with 25 additions and 7 deletions

View File

@ -58,8 +58,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
difficulty += EvaluateDifficultyOf(colour.MonoStreak); difficulty += EvaluateDifficultyOf(colour.MonoStreak);
if (colour.AlternatingMonoPattern != null) // Difficulty for AlternatingMonoPattern if (colour.AlternatingMonoPattern != null) // Difficulty for AlternatingMonoPattern
difficulty += EvaluateDifficultyOf(colour.AlternatingMonoPattern); difficulty += EvaluateDifficultyOf(colour.AlternatingMonoPattern);
if (colour.RepeatingHitPatterns != null) // Difficulty for RepeatingHitPattern if (colour.RepeatingHitPattern != null) // Difficulty for RepeatingHitPattern
difficulty += EvaluateDifficultyOf(colour.RepeatingHitPatterns); difficulty += EvaluateDifficultyOf(colour.RepeatingHitPattern);
return difficulty; return difficulty;
} }

View File

@ -27,6 +27,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
/// </summary> /// </summary>
public int Index; public int Index;
/// <summary>
/// The first <see cref="TaikoDifficultyHitObject"/> in this <see cref="AlternatingMonoPattern"/>.
/// </summary>
public TaikoDifficultyHitObject FirstHitObject => MonoStreaks[0].FirstHitObject;
/// <summary> /// <summary>
/// Determine if this <see cref="AlternatingMonoPattern"/> is a repetition of another <see cref="AlternatingMonoPattern"/>. This /// Determine if this <see cref="AlternatingMonoPattern"/> is a repetition of another <see cref="AlternatingMonoPattern"/>. This
/// is a strict comparison and is true if and only if the colour sequence is exactly the same. /// is a strict comparison and is true if and only if the colour sequence is exactly the same.

View File

@ -28,6 +28,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
/// </summary> /// </summary>
public int Index; public int Index;
/// <summary>
/// The first <see cref="TaikoDifficultyHitObject"/> in this <see cref="MonoStreak"/>.
/// </summary>
public TaikoDifficultyHitObject FirstHitObject => HitObjects[0];
/// <summary>
/// The hit type of all objects encoded within this <see cref="MonoStreak"/>
/// </summary>
public HitType? HitType => (HitObjects[0].BaseObject as Hit)?.Type; public HitType? HitType => (HitObjects[0].BaseObject as Hit)?.Type;
/// <summary> /// <summary>

View File

@ -22,6 +22,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
/// </summary> /// </summary>
public readonly List<AlternatingMonoPattern> AlternatingMonoPatterns = new List<AlternatingMonoPattern>(); public readonly List<AlternatingMonoPattern> AlternatingMonoPatterns = new List<AlternatingMonoPattern>();
/// <summary>
/// The parent <see cref="TaikoDifficultyHitObject"/> in this <see cref="RepeatingHitPatterns"/>
/// </summary>
public TaikoDifficultyHitObject FirstHitObject => AlternatingMonoPatterns[0].FirstHitObject;
/// <summary> /// <summary>
/// The previous <see cref="RepeatingHitPatterns"/>. This is used to determine the repetition interval. /// The previous <see cref="RepeatingHitPatterns"/>. This is used to determine the repetition interval.
/// </summary> /// </summary>

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
// assigned with the relevant encodings. // assigned with the relevant encodings.
foreach (var repeatingHitPattern in hitPatterns) foreach (var repeatingHitPattern in hitPatterns)
{ {
repeatingHitPattern.AlternatingMonoPatterns[0].MonoStreaks[0].HitObjects[0].Colour.RepeatingHitPatterns = repeatingHitPattern; repeatingHitPattern.FirstHitObject.Colour.RepeatingHitPattern = repeatingHitPattern;
// The outermost loop is kept a ForEach loop since it doesn't need index information, and we want to // The outermost loop is kept a ForEach loop since it doesn't need index information, and we want to
// keep i and j for AlternatingMonoPattern's and MonoStreak's index respectively, to keep it in line with // keep i and j for AlternatingMonoPattern's and MonoStreak's index respectively, to keep it in line with
@ -36,14 +36,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
AlternatingMonoPattern monoPattern = repeatingHitPattern.AlternatingMonoPatterns[i]; AlternatingMonoPattern monoPattern = repeatingHitPattern.AlternatingMonoPatterns[i];
monoPattern.Parent = repeatingHitPattern; monoPattern.Parent = repeatingHitPattern;
monoPattern.Index = i; monoPattern.Index = i;
monoPattern.MonoStreaks[0].HitObjects[0].Colour.AlternatingMonoPattern = monoPattern; monoPattern.FirstHitObject.Colour.AlternatingMonoPattern = monoPattern;
for (int j = 0; j < monoPattern.MonoStreaks.Count; ++j) for (int j = 0; j < monoPattern.MonoStreaks.Count; ++j)
{ {
MonoStreak monoStreak = monoPattern.MonoStreaks[j]; MonoStreak monoStreak = monoPattern.MonoStreaks[j];
monoStreak.Parent = monoPattern; monoStreak.Parent = monoPattern;
monoStreak.Index = j; monoStreak.Index = j;
monoStreak.HitObjects[0].Colour.MonoStreak = monoStreak; monoStreak.FirstHitObject.Colour.MonoStreak = monoStreak;
} }
} }
} }

View File

@ -21,8 +21,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
public AlternatingMonoPattern? AlternatingMonoPattern; public AlternatingMonoPattern? AlternatingMonoPattern;
/// <summary> /// <summary>
/// The <see cref="RepeatingHitPatterns"/> that encodes this note, only present if this is the first note within a <see cref="RepeatingHitPatterns"/> /// The <see cref="RepeatingHitPattern"/> that encodes this note, only present if this is the first note within a <see cref="RepeatingHitPattern"/>
/// </summary> /// </summary>
public RepeatingHitPatterns? RepeatingHitPatterns; public RepeatingHitPatterns? RepeatingHitPattern;
} }
} }