mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 02:37:25 +08:00
51 lines
2.1 KiB
C#
51 lines
2.1 KiB
C#
// 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;
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|
{
|
|
/// <summary>
|
|
/// Encodes a list of <see cref="MonoStreak"/>s.
|
|
/// <see cref="MonoStreak"/>s with the same <see cref="MonoStreak.RunLength"/> are grouped together.
|
|
/// </summary>
|
|
public class AlternatingMonoPattern
|
|
{
|
|
/// <summary>
|
|
/// <see cref="MonoStreak"/>s that are grouped together within this <see cref="AlternatingMonoPattern"/>.
|
|
/// </summary>
|
|
public readonly List<MonoStreak> Payload = new List<MonoStreak>();
|
|
|
|
/// <summary>
|
|
/// The parent <see cref="RepeatingHitPatterns"/> that contains this <see cref="AlternatingMonoPattern"/>
|
|
/// </summary>
|
|
public RepeatingHitPatterns? Parent;
|
|
|
|
/// <summary>
|
|
/// Index of this encoding within it's parent encoding
|
|
/// </summary>
|
|
public int Index;
|
|
|
|
/// <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.
|
|
/// </summary>
|
|
public bool IsRepetitionOf(AlternatingMonoPattern other)
|
|
{
|
|
return HasIdenticalMonoLength(other) &&
|
|
other.Payload.Count == Payload.Count &&
|
|
(other.Payload[0].EncodedData[0].BaseObject as Hit)?.Type ==
|
|
(Payload[0].EncodedData[0].BaseObject as Hit)?.Type;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determine if this <see cref="AlternatingMonoPattern"/> has the same mono length of another <see cref="AlternatingMonoPattern"/>.
|
|
/// </summary>
|
|
public bool HasIdenticalMonoLength(AlternatingMonoPattern other)
|
|
{
|
|
return other.Payload[0].RunLength == Payload[0].RunLength;
|
|
}
|
|
}
|
|
}
|