using osu.Game.Rulesets.Difficulty.Preprocessing; using System.Collections.Generic; namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour { public class MonoEncoding { public List EncodedData { get; private set; } = new List(); public int RunLength => EncodedData.Count; public static List Encode(List data) { List encoded = new List(); MonoEncoding? lastEncoded = null; for (int i = 0; i < data.Count; i++) { TaikoDifficultyHitObject taikoObject = (TaikoDifficultyHitObject)data[i]; // This ignores all non-note objects, which may or may not be the desired behaviour TaikoDifficultyHitObject previousObject = (TaikoDifficultyHitObject)taikoObject.PreviousNote(0); if ( previousObject == null || lastEncoded == null || taikoObject.HitType != previousObject.HitType) { lastEncoded = new MonoEncoding(); lastEncoded.EncodedData.Add(taikoObject); encoded.Add(lastEncoded); continue; } lastEncoded.EncodedData.Add(taikoObject); } return encoded; } } }