From 1b328c6cfc313ee2c345acc7a2dbb53df206ab13 Mon Sep 17 00:00:00 2001 From: NoMathExpectation <85624722+NoMathExpectation@users.noreply.github.com> Date: Thu, 2 Jul 2026 01:04:00 +0800 Subject: [PATCH] Added FlashEvent. --- .../rdkt/core/events/CustomFlashEvent.kt | 2 +- .../cn/rdlevel/rdkt/core/events/FlashEvent.kt | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/FlashEvent.kt diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/CustomFlashEvent.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/CustomFlashEvent.kt index 6d9abcd..d1dc4b1 100644 --- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/CustomFlashEvent.kt +++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/CustomFlashEvent.kt @@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable /** - * Emits a flash with custom settings. + * Emits a flash with custom settings. For more simplified one, see [FlashEvent]. * @property startColor The start color of the flash. * @property startOpacity The start opacity of the flash. * @property endColor The end color of the flash. diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/FlashEvent.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/FlashEvent.kt new file mode 100644 index 0000000..9fe83c1 --- /dev/null +++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/FlashEvent.kt @@ -0,0 +1,36 @@ +package cn.rdlevel.rdkt.core.events + + +import cn.rdlevel.rdkt.core.data.ROOM1 +import cn.rdlevel.rdkt.core.data.RoomsOrTopLayer +import cn.rdlevel.rdkt.core.data.roomsOf +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlin.jvm.JvmOverloads + +/** + * Emits a white flash with a specified duration. For more advanced one, see [CustomFlashEvent]. + * @property duration The duration of the flash. + */ +@Serializable +@SerialName("Flash") +public data class FlashEvent @JvmOverloads constructor( + var duration: Duration, + override var rooms: RoomsOrTopLayer = roomsOf(ROOM1), +) : ActionEvent(), MutableRoomsOrTopLayerSpecificEvent { + /** + * Represent the duration of the flash. + * @property beats The time corresponding to the duration in beats. + */ + @Serializable + public enum class Duration(public val beats: Double) { + @SerialName("Short") + SHORT(1.0), + + @SerialName("Medium") + MEDIUM(2.0), + + @SerialName("Long") + LONG(4.0) + } +} \ No newline at end of file