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