From c666429143c472da58a3bac2dff6b9da1357e226 Mon Sep 17 00:00:00 2001 From: NoMathExpectation <85624722+NoMathExpectation@users.noreply.github.com> Date: Thu, 2 Jul 2026 16:51:26 +0800 Subject: [PATCH] Added MoveCameraEvent. --- .../cn/rdlevel/rdkt/core/data/Vector2.kt | 1 + .../rdkt/core/events/MoveCameraEvent.kt | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/MoveCameraEvent.kt diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Vector2.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Vector2.kt index ef4fbd7..31189ea 100644 --- a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Vector2.kt +++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/data/Vector2.kt @@ -54,6 +54,7 @@ public data class Vector2(val x: Double, val y: Double) { public companion object { public val ZERO: Vector2 = Vector2(0.0, 0.0) public val ONE: Vector2 = Vector2(1.0, 1.0) + public val CENTER: Vector2 = Vector2(50.0, 50.0) } public object Serializer : diff --git a/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/MoveCameraEvent.kt b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/MoveCameraEvent.kt new file mode 100644 index 0000000..d68ddb1 --- /dev/null +++ b/core/src/commonMain/kotlin/cn/rdlevel/rdkt/core/events/MoveCameraEvent.kt @@ -0,0 +1,25 @@ +package cn.rdlevel.rdkt.core.events + + +import cn.rdlevel.rdkt.core.data.* +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * Moves, zooms, or rotates the camera of the specific rooms. + * @property cameraPosition The new position of the camera. + * @property zoom The new zoom level of the camera. + * @property angle The new rotation angle of the camera clockwise. + * @property real Whether to use the camera in the real view. Usually this affects the visibility of contents outside the original view. + */ +@Serializable +@SerialName("MoveCamera") +public data class MoveCameraEvent( + var cameraPosition: Vector2? = Vector2.CENTER, + var zoom: Int? = 100, + var angle: Double? = 0.0, + override var duration: Double = 1.0, + override var ease: Easing = Easing.LINEAR, + var real: Boolean = false, + override var rooms: RoomsOrTopLayer = roomsOf(ROOM1), +) : ActionEvent(), MutableRoomsOrTopLayerSpecificEvent, DurationEaseSpecificEvent \ No newline at end of file