diff --git a/src/main/kotlin/Room.kt b/src/main/kotlin/Room.kt index e672f93..07787c7 100644 --- a/src/main/kotlin/Room.kt +++ b/src/main/kotlin/Room.kt @@ -25,6 +25,7 @@ class Room( val lastGetTime = longArrayOf(0, 0) // 上次收卡时间 var totalPauseMs: Long = 0 // 累计暂停时长,毫秒 var pauseBeginMs: Long = 0 // 开始暂停时刻,毫秒,0表示没暂停 + var pauseEndMs: Long = 0 // 上一次结束暂停的时刻,毫秒,0表示从未暂停过 var lastWinner: Int = 0 // 上一场是谁赢,1或2 var bpData: BpData? = null var linkData: LinkData? = null diff --git a/src/main/kotlin/message/GetSpellsCs.kt b/src/main/kotlin/message/GetSpellsCs.kt index a072250..9355fab 100644 --- a/src/main/kotlin/message/GetSpellsCs.kt +++ b/src/main/kotlin/message/GetSpellsCs.kt @@ -23,6 +23,7 @@ class GetSpellsCs : Handler { banPick = room.bpData?.banPick ?: 0, totalPauseTime = room.totalPauseMs, pauseBeginMs = room.pauseBeginMs, + pauseEndMs = room.pauseEndMs, status = IntArray(room.spellStatus!!.size) { i -> room.spellStatus!![i].value }, linkData = room.linkData, phase = room.phase, diff --git a/src/main/kotlin/message/PauseCs.kt b/src/main/kotlin/message/PauseCs.kt index 0ce6b7e..02ebc4b 100644 --- a/src/main/kotlin/message/PauseCs.kt +++ b/src/main/kotlin/message/PauseCs.kt @@ -23,8 +23,11 @@ class PauseCs(val pause: Boolean) : Handler { room.pauseBeginMs = now } else { if (room.pauseBeginMs != 0L) { - room.totalPauseMs += now - room.pauseBeginMs + val delta = now - room.pauseBeginMs + room.totalPauseMs += delta + room.lastGetTime.forEachIndexed { i, v -> if (v > 0) room.lastGetTime[i] = v + delta } room.pauseBeginMs = 0 + room.pauseEndMs = now } } Store.putRoom(room) diff --git a/src/main/kotlin/message/SpellListSc.kt b/src/main/kotlin/message/SpellListSc.kt index 8c9e9f8..57dc37b 100644 --- a/src/main/kotlin/message/SpellListSc.kt +++ b/src/main/kotlin/message/SpellListSc.kt @@ -11,6 +11,7 @@ class SpellListSc( val banPick: Int, val totalPauseTime: Long, val pauseBeginMs: Long, + val pauseEndMs: Long, val status: IntArray?, val phase: Int, val linkData: LinkData?, diff --git a/src/main/kotlin/message/StartGameCs.kt b/src/main/kotlin/message/StartGameCs.kt index 637810b..9727d29 100644 --- a/src/main/kotlin/message/StartGameCs.kt +++ b/src/main/kotlin/message/StartGameCs.kt @@ -49,6 +49,7 @@ class StartGameCs : Handler { linkData = room.linkData, phase = room.phase, pauseBeginMs = 0L, + pauseEndMs = 0L, status = null, totalPauseTime = 0L, lastGetTime = room.lastGetTime diff --git a/src/main/kotlin/message/StopGameCs.kt b/src/main/kotlin/message/StopGameCs.kt index 4894c56..9037116 100644 --- a/src/main/kotlin/message/StopGameCs.kt +++ b/src/main/kotlin/message/StopGameCs.kt @@ -29,6 +29,7 @@ class StopGameCs(val winner: Int) : Handler { room.spellStatus = null room.totalPauseMs = 0 room.pauseBeginMs = 0 + room.pauseEndMs = 0 room.bpData = null Store.putRoom(room) if (winner == -1)