From ea2a5642e0a541400e1f783ccc1fc0c3ec4fbd04 Mon Sep 17 00:00:00 2001 From: jiulinxiri Date: Tue, 24 Dec 2024 09:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9E=E5=87=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Twinmoji/ContentView.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Twinmoji/ContentView.swift b/Twinmoji/ContentView.swift index 3555cc0..2ecc251 100644 --- a/Twinmoji/ContentView.swift +++ b/Twinmoji/ContentView.swift @@ -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) } }