mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-17 23:55:21 +01:00
Update MainActivity.kt
This commit is contained in:
parent
08c9f8a1ce
commit
dbaebb8b60
1 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue