Added FlashEvent.

This commit is contained in:
2026-07-02 01:04:00 +08:00
parent c5a9fcc7f3
commit 1b328c6cfc
2 changed files with 37 additions and 1 deletions
@@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable 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 startColor The start color of the flash.
* @property startOpacity The start opacity of the flash. * @property startOpacity The start opacity of the flash.
* @property endColor The end color of the flash. * @property endColor The end color of the flash.
@@ -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)
}
}