summaryrefslogtreecommitdiff
path: root/sw-common-model/src/commonMain/kotlin/org
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@gmail.com>2021-02-23 00:01:00 +0100
committerJoffrey Bion <joffrey.bion@gmail.com>2021-02-23 18:38:24 +0100
commite2957be6c0f2dea09d0633cd7ee7549311b9b923 (patch)
tree97b3dcbf09501ac2bd00d9ac8e0a1f1f280ecf0a /sw-common-model/src/commonMain/kotlin/org
parentFix player re-order animation (diff)
downloadseven-wonders-e2957be6c0f2dea09d0633cd7ee7549311b9b923.tar.gz
seven-wonders-e2957be6c0f2dea09d0633cd7ee7549311b9b923.tar.bz2
seven-wonders-e2957be6c0f2dea09d0633cd7ee7549311b9b923.zip
Funnel game events into a single client subscription
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