2022-07-05 14:41:40 +08:00
|
|
|
using System.Collections.Generic;
|
2022-07-14 16:29:23 +08:00
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2022-07-05 14:41:40 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|
|
|
{
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Encodes a list of <see cref="MonoEncoding"/>s.
|
|
|
|
/// <see cref="MonoEncoding"/>s with the same <see cref="MonoEncoding.RunLength"/> are grouped together.
|
|
|
|
/// </summary>
|
2022-07-05 14:41:40 +08:00
|
|
|
public class ColourEncoding
|
|
|
|
{
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
|
|
|
/// <see cref="MonoEncoding"/>s that are grouped together within this <see cref="ColourEncoding"/>.
|
|
|
|
/// </summary>
|
2022-07-05 14:41:40 +08:00
|
|
|
public List<MonoEncoding> Payload { get; private set; } = new List<MonoEncoding>();
|
|
|
|
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Determine if this <see cref="ColourEncoding"/> is a repetition of another <see cref="ColourEncoding"/>. This
|
|
|
|
/// is a strict comparison and is true if and only if the colour sequence is exactly the same.
|
|
|
|
/// This does not require the <see cref="ColourEncoding"/>s to have the same amount of <see cref="MonoEncoding"/>s.
|
|
|
|
/// </summary>
|
2022-07-07 16:04:46 +08:00
|
|
|
public bool isRepetitionOf(ColourEncoding other)
|
2022-07-05 14:41:40 +08:00
|
|
|
{
|
2022-07-05 17:01:11 +08:00
|
|
|
return hasIdenticalMonoLength(other) &&
|
|
|
|
other.Payload.Count == Payload.Count &&
|
2022-07-14 16:29:23 +08:00
|
|
|
(other.Payload[0].EncodedData[0].BaseObject as Hit)?.Type ==
|
|
|
|
(Payload[0].EncodedData[0].BaseObject as Hit)?.Type;
|
2022-07-05 14:41:40 +08:00
|
|
|
}
|
|
|
|
|
2022-07-14 16:29:23 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Determine if this <see cref="ColourEncoding"/> has the same mono length of another <see cref="ColourEncoding"/>.
|
|
|
|
/// </summary>
|
2022-07-05 14:41:40 +08:00
|
|
|
public bool hasIdenticalMonoLength(ColourEncoding other)
|
|
|
|
{
|
|
|
|
return other.Payload[0].RunLength == Payload[0].RunLength;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|