2022-07-15 19:07:01 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-07-05 14:41:40 +08:00
|
|
|
using System.Collections.Generic;
|
2022-09-29 15:27:26 +08:00
|
|
|
using System.Linq;
|
2022-07-05 14:41:40 +08:00
|
|
|
|
2022-07-15 19:07:01 +08:00
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
2022-07-05 14:41:40 +08:00
|
|
|
{
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
/// Encodes a list of <see cref="MonoStreak"/>s.
|
|
|
|
/// <see cref="MonoStreak"/>s with the same <see cref="MonoStreak.RunLength"/> are grouped together.
|
2022-07-14 16:29:23 +08:00
|
|
|
/// </summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
public class AlternatingMonoPattern
|
2022-07-05 14:41:40 +08:00
|
|
|
{
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
/// <see cref="MonoStreak"/>s that are grouped together within this <see cref="AlternatingMonoPattern"/>.
|
2022-07-14 16:29:23 +08:00
|
|
|
/// </summary>
|
2022-08-19 15:45:43 +08:00
|
|
|
public readonly List<MonoStreak> MonoStreaks = new List<MonoStreak>();
|
2022-07-05 14:41:40 +08:00
|
|
|
|
2022-07-22 18:20:35 +08:00
|
|
|
/// <summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
/// The parent <see cref="RepeatingHitPatterns"/> that contains this <see cref="AlternatingMonoPattern"/>
|
2022-07-22 18:20:35 +08:00
|
|
|
/// </summary>
|
2022-08-24 08:57:13 +08:00
|
|
|
public RepeatingHitPatterns Parent = null!;
|
2022-07-21 19:15:22 +08:00
|
|
|
|
|
|
|
/// <summary>
|
2022-08-19 15:45:43 +08:00
|
|
|
/// Index of this <see cref="AlternatingMonoPattern"/> within it's parent <see cref="RepeatingHitPatterns"/>
|
2022-07-21 19:15:22 +08:00
|
|
|
/// </summary>
|
|
|
|
public int Index;
|
|
|
|
|
2022-08-19 16:13:36 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The first <see cref="TaikoDifficultyHitObject"/> in this <see cref="AlternatingMonoPattern"/>.
|
|
|
|
/// </summary>
|
|
|
|
public TaikoDifficultyHitObject FirstHitObject => MonoStreaks[0].FirstHitObject;
|
|
|
|
|
2022-09-29 15:27:26 +08:00
|
|
|
/// <summary>
|
|
|
|
/// All <see cref="TaikoDifficultyHitObject"/>s in this <see cref="AlternatingMonoPattern"/>.
|
|
|
|
/// </summary>
|
|
|
|
public IEnumerable<TaikoDifficultyHitObject> AllHitObjects => MonoStreaks.SelectMany(streak => streak.HitObjects);
|
|
|
|
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
/// Determine if this <see cref="AlternatingMonoPattern"/> is a repetition of another <see cref="AlternatingMonoPattern"/>. This
|
2022-07-14 16:29:23 +08:00
|
|
|
/// is a strict comparison and is true if and only if the colour sequence is exactly the same.
|
|
|
|
/// </summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
public bool IsRepetitionOf(AlternatingMonoPattern other)
|
2022-07-05 14:41:40 +08:00
|
|
|
{
|
2022-07-15 19:07:01 +08:00
|
|
|
return HasIdenticalMonoLength(other) &&
|
2022-08-19 15:45:43 +08:00
|
|
|
other.MonoStreaks.Count == MonoStreaks.Count &&
|
2022-08-19 16:05:34 +08:00
|
|
|
other.MonoStreaks[0].HitType == MonoStreaks[0].HitType;
|
2022-07-05 14:41:40 +08:00
|
|
|
}
|
|
|
|
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
/// Determine if this <see cref="AlternatingMonoPattern"/> has the same mono length of another <see cref="AlternatingMonoPattern"/>.
|
2022-07-14 16:29:23 +08:00
|
|
|
/// </summary>
|
2022-08-19 15:31:03 +08:00
|
|
|
public bool HasIdenticalMonoLength(AlternatingMonoPattern other)
|
2022-07-05 14:41:40 +08:00
|
|
|
{
|
2022-08-19 15:45:43 +08:00
|
|
|
return other.MonoStreaks[0].RunLength == MonoStreaks[0].RunLength;
|
2022-07-05 14:41:40 +08:00
|
|
|
}
|
|
|
|
}
|
2022-07-15 19:07:01 +08:00
|
|
|
}
|