summaryrefslogtreecommitdiff
path: root/sw-common-model/src/commonMain/kotlin/org
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model/src/commonMain/kotlin/org')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/events/Events.kt30
1 files changed, 30 insertions, 0 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/events/Events.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/events/Events.kt
new file mode 100644
index 00000000..d8c05e91
--- /dev/null
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/api/events/Events.kt
@@ -0,0 +1,30 @@
+package org.luxons.sevenwonders.model.api.events
+
+import kotlinx.serialization.Serializable
+import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.PlayerTurnInfo
+import org.luxons.sevenwonders.model.cards.PreparedCard
+
+// workaround for https://github.com/Kotlin/kotlinx.serialization/issues/1194
+@Serializable
+data class GameEventWrapper(
+ val event: GameEvent
+)
+
+fun GameEvent.wrap() = GameEventWrapper(this)
+
+@Serializable
+sealed class GameEvent {
+
+ @Serializable
+ data class NewTurnStarted(val turnInfo: PlayerTurnInfo) : GameEvent()
+
+ @Serializable
+ data class MovePrepared(val move: PlayerMove) : GameEvent()
+
+ @Serializable
+ data class CardPrepared(val preparedCard: PreparedCard) : GameEvent()
+
+ @Serializable
+ data class PlayerIsReady(val username: String) : GameEvent()
+}
bgstack15