From 89f3f8509f43b5c40bdf7b2c303de0c21299b38e Mon Sep 17 00:00:00 2001 From: NoMathExpectation <85624722+NoMathExpectation@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:33:02 +0800 Subject: [PATCH] Made RowPattern 7th beat compatible. --- .../kotlin/cn/rdlevel/rdkt/core/data/row/RowPattern.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/row/RowPattern.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/row/RowPattern.kt index bbe28a8..adff76c 100644 --- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/row/RowPattern.kt +++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/row/RowPattern.kt @@ -12,11 +12,17 @@ import kotlinx.serialization.builtins.serializer @Serializable(RowPattern.Serializer::class) public class RowPattern { /** - * The pattern string representing the pulse pattern of the row. It must be exactly 6 characters long, and each character must be one of the allowed characters defined in [ALLOWED_CHARS]. + * The pattern string representing the pulse pattern of the row in a 6 beat form. + * + * When setting this property, the value must be exactly 6 or 7 characters long, and each character, except for the 7th one, must be one of the allowed characters defined in [ALLOWED_CHARS]. */ public var pattern: String = DEFAULT_PATTERN_STRING set(value) { - require(value.length == 6) { "Pulse pattern must be 6 characters long." } + var value = value + if (value.length == 7) { + value = value.dropLast(1) + } + require(value.length == 6) { "Pulse pattern must either 6 or 7 characters long." } require(value.all { it in ALLOWED_CHARS }) { "Pulse pattern can only contain '$ALLOWED_CHARS', but incorrect pattern found: '$value'." }