mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Minor refactoring to reduce amount of looping
This commit is contained in:
parent
16413fc608
commit
122064d03f
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
{
|
||||
@ -32,11 +31,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
/// </summary>
|
||||
public TaikoDifficultyHitObject FirstHitObject => MonoStreaks[0].FirstHitObject;
|
||||
|
||||
/// <summary>
|
||||
/// All <see cref="TaikoDifficultyHitObject"/>s in this <see cref="AlternatingMonoPattern"/>.
|
||||
/// </summary>
|
||||
public IEnumerable<TaikoDifficultyHitObject> AllHitObjects => MonoStreaks.SelectMany(streak => streak.HitObjects);
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
@ -28,11 +27,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||
/// </summary>
|
||||
public TaikoDifficultyHitObject FirstHitObject => AlternatingMonoPatterns[0].FirstHitObject;
|
||||
|
||||
/// <summary>
|
||||
/// All <see cref="TaikoDifficultyHitObject"/>s in this <see cref="RepeatingHitPatterns"/>.
|
||||
/// </summary>
|
||||
public IEnumerable<TaikoDifficultyHitObject> AllHitObjects => AlternatingMonoPatterns.SelectMany(pattern => pattern.AllHitObjects);
|
||||
|
||||
/// <summary>
|
||||
/// The previous <see cref="RepeatingHitPatterns"/>. This is used to determine the repetition interval.
|
||||
/// </summary>
|
||||
|
@ -24,11 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
// Assign indexing and encoding data to all relevant objects.
|
||||
foreach (var repeatingHitPattern in hitPatterns)
|
||||
{
|
||||
foreach (var hitObject in repeatingHitPattern.AllHitObjects)
|
||||
{
|
||||
hitObject.Colour.RepeatingHitPattern = repeatingHitPattern;
|
||||
}
|
||||
|
||||
// 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
|
||||
// documentation.
|
||||
@ -38,11 +33,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
monoPattern.Parent = repeatingHitPattern;
|
||||
monoPattern.Index = i;
|
||||
|
||||
foreach (var hitObject in monoPattern.AllHitObjects)
|
||||
{
|
||||
hitObject.Colour.AlternatingMonoPattern = monoPattern;
|
||||
}
|
||||
|
||||
for (int j = 0; j < monoPattern.MonoStreaks.Count; ++j)
|
||||
{
|
||||
MonoStreak monoStreak = monoPattern.MonoStreaks[j];
|
||||
@ -51,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
||||
|
||||
foreach (var hitObject in monoStreak.HitObjects)
|
||||
{
|
||||
hitObject.Colour.RepeatingHitPattern = repeatingHitPattern;
|
||||
hitObject.Colour.AlternatingMonoPattern = monoPattern;
|
||||
hitObject.Colour.MonoStreak = monoStreak;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user