修复连击问题
This commit is contained in:
@@ -109,7 +109,8 @@ struct ContentView: View {
|
|||||||
runClock()
|
runClock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func timeOut() {
|
func timeOut(for emoji: [String]) {
|
||||||
|
guard currentEmoji == emoji else { return }
|
||||||
if gameState == .player1Answering {
|
if gameState == .player1Answering {
|
||||||
player1Score -= 1
|
player1Score -= 1
|
||||||
} else if gameState == .player2Answering {
|
} else if gameState == .player2Answering {
|
||||||
@@ -121,11 +122,11 @@ struct ContentView: View {
|
|||||||
|
|
||||||
func runClock() {
|
func runClock() {
|
||||||
answerScale = 1
|
answerScale = 1
|
||||||
|
let checkEmoji = currentEmoji
|
||||||
withAnimation(.linear(duration: answerTime)) {
|
withAnimation(.linear(duration: answerTime)) {
|
||||||
answerScale = 0
|
answerScale = 0
|
||||||
} completion: {
|
} completion: {
|
||||||
timeOut()
|
timeOut(for: checkEmoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user