1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 04:37:51 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/Colour/Data/AlternatingMonoPattern.cs

50 lines
2.1 KiB
C#
Raw Normal View History

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.
using System.Collections.Generic;
using osu.Game.Rulesets.Taiko.Objects;
2022-07-15 19:07:01 +08:00
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
{
/// <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.
/// </summary>
2022-08-19 15:31:03 +08:00
public class AlternatingMonoPattern
{
/// <summary>
2022-08-19 15:31:03 +08:00
/// <see cref="MonoStreak"/>s that are grouped together within this <see cref="AlternatingMonoPattern"/>.
/// </summary>
2022-08-19 15:45:43 +08:00
public readonly List<MonoStreak> MonoStreaks = new List<MonoStreak>();
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-19 15:31:03 +08:00
public RepeatingHitPatterns? Parent;
/// <summary>
2022-08-19 15:45:43 +08:00
/// Index of this <see cref="AlternatingMonoPattern"/> within it's parent <see cref="RepeatingHitPatterns"/>
/// </summary>
public int Index;
/// <summary>
2022-08-19 15:31:03 +08:00
/// 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.
/// </summary>
2022-08-19 15:31:03 +08:00
public bool IsRepetitionOf(AlternatingMonoPattern other)
{
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;
}
/// <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"/>.
/// </summary>
2022-08-19 15:31:03 +08:00
public bool HasIdenticalMonoLength(AlternatingMonoPattern other)
{
2022-08-19 15:45:43 +08:00
return other.MonoStreaks[0].RunLength == MonoStreaks[0].RunLength;
}
}
2022-07-15 19:07:01 +08:00
}