Update MainActivity.kt

This commit is contained in:
cmclark00 2025-03-31 08:30:59 -04:00
parent 08c9f8a1ce
commit dbaebb8b60

View file

@ -325,11 +325,13 @@ class MainActivity : AppCompatActivity(),
}
}
// Track pieces placed using callback
gameView.onPieceLock = {
if (isSoundEnabled) {
gameHaptics.vibrateForPieceLock()
}
// Increment pieces placed counter
piecesPlaced++
// Provide haptic feedback
gameHaptics.vibrateForPieceLock()
}
// Set up button click listeners with haptic feedback
@ -668,6 +670,7 @@ class MainActivity : AppCompatActivity(),
binding.scoreText.text = "$currentScore"
binding.currentLevelText.text = "$currentLevel"
binding.linesText.text = "0"
binding.comboText.text = "0"
// Reset game view and game board
gameView.reset()
@ -680,6 +683,7 @@ class MainActivity : AppCompatActivity(),
binding.scoreText.text = "$score"
binding.currentLevelText.text = "$level"
binding.linesText.text = "$lines"
binding.comboText.text = gameBoard.getCombo().toString()
}
gameView.onGameOver = { finalScore ->
@ -720,6 +724,9 @@ class MainActivity : AppCompatActivity(),
// Vibrate gamepad if connected
gamepadController.vibrateForLineClear(lineCount)
// Record line clear in stats
statsManager.recordLineClear(lineCount)
}
// Start the game
@ -731,8 +738,7 @@ class MainActivity : AppCompatActivity(),
gameMusic.start()
}
gameStartTime = System.currentTimeMillis()
piecesPlaced = 0
// Reset session stats
statsManager.startNewSession()
progressionManager.startNewSession()
gameBoard.updateLevel(selectedLevel)