修复连击问题

This commit is contained in:
2024-12-24 09:33:21 +08:00
parent b653ee2eee
commit ea2a5642e0

View File

@@ -109,7 +109,8 @@ struct ContentView: View {
runClock()
}
func timeOut() {
func timeOut(for emoji: [String]) {
guard currentEmoji == emoji else { return }
if gameState == .player1Answering {
player1Score -= 1
} else if gameState == .player2Answering {
@@ -121,11 +122,11 @@ struct ContentView: View {
func runClock() {
answerScale = 1
let checkEmoji = currentEmoji
withAnimation(.linear(duration: answerTime)) {
answerScale = 0
} completion: {
timeOut()
timeOut(for: checkEmoji)
}
}