mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 10:47:22 +09: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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||||
{
|
{
|
||||||
@ -32,11 +31,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TaikoDifficultyHitObject FirstHitObject => MonoStreaks[0].FirstHitObject;
|
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>
|
/// <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.
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
||||||
@ -28,11 +27,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TaikoDifficultyHitObject FirstHitObject => AlternatingMonoPatterns[0].FirstHitObject;
|
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>
|
/// <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>
|
||||||
|
@ -24,11 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
// Assign indexing and encoding data to all relevant objects.
|
// Assign indexing and encoding data to all relevant objects.
|
||||||
foreach (var repeatingHitPattern in hitPatterns)
|
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
|
// 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
|
||||||
// documentation.
|
// documentation.
|
||||||
@ -38,11 +33,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
monoPattern.Parent = repeatingHitPattern;
|
monoPattern.Parent = repeatingHitPattern;
|
||||||
monoPattern.Index = i;
|
monoPattern.Index = i;
|
||||||
|
|
||||||
foreach (var hitObject in monoPattern.AllHitObjects)
|
|
||||||
{
|
|
||||||
hitObject.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];
|
||||||
@ -51,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
|
|
||||||
foreach (var hitObject in monoStreak.HitObjects)
|
foreach (var hitObject in monoStreak.HitObjects)
|
||||||
{
|
{
|
||||||
|
hitObject.Colour.RepeatingHitPattern = repeatingHitPattern;
|
||||||
|
hitObject.Colour.AlternatingMonoPattern = monoPattern;
|
||||||
hitObject.Colour.MonoStreak = monoStreak;
|
hitObject.Colour.MonoStreak = monoStreak;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user