mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-17 23:45:22 +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 = {
|
gameView.onPieceLock = {
|
||||||
if (isSoundEnabled) {
|
// Increment pieces placed counter
|
||||||
gameHaptics.vibrateForPieceLock()
|
|
||||||
}
|
|
||||||
piecesPlaced++
|
piecesPlaced++
|
||||||
|
|
||||||
|
// Provide haptic feedback
|
||||||
|
gameHaptics.vibrateForPieceLock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up button click listeners with haptic feedback
|
// Set up button click listeners with haptic feedback
|
||||||
|
@ -668,6 +670,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
binding.scoreText.text = "$currentScore"
|
binding.scoreText.text = "$currentScore"
|
||||||
binding.currentLevelText.text = "$currentLevel"
|
binding.currentLevelText.text = "$currentLevel"
|
||||||
binding.linesText.text = "0"
|
binding.linesText.text = "0"
|
||||||
|
binding.comboText.text = "0"
|
||||||
|
|
||||||
// Reset game view and game board
|
// Reset game view and game board
|
||||||
gameView.reset()
|
gameView.reset()
|
||||||
|
@ -680,6 +683,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
binding.scoreText.text = "$score"
|
binding.scoreText.text = "$score"
|
||||||
binding.currentLevelText.text = "$level"
|
binding.currentLevelText.text = "$level"
|
||||||
binding.linesText.text = "$lines"
|
binding.linesText.text = "$lines"
|
||||||
|
binding.comboText.text = gameBoard.getCombo().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
gameView.onGameOver = { finalScore ->
|
gameView.onGameOver = { finalScore ->
|
||||||
|
@ -720,6 +724,9 @@ class MainActivity : AppCompatActivity(),
|
||||||
|
|
||||||
// Vibrate gamepad if connected
|
// Vibrate gamepad if connected
|
||||||
gamepadController.vibrateForLineClear(lineCount)
|
gamepadController.vibrateForLineClear(lineCount)
|
||||||
|
|
||||||
|
// Record line clear in stats
|
||||||
|
statsManager.recordLineClear(lineCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the game
|
// Start the game
|
||||||
|
@ -731,8 +738,7 @@ class MainActivity : AppCompatActivity(),
|
||||||
gameMusic.start()
|
gameMusic.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
gameStartTime = System.currentTimeMillis()
|
// Reset session stats
|
||||||
piecesPlaced = 0
|
|
||||||
statsManager.startNewSession()
|
statsManager.startNewSession()
|
||||||
progressionManager.startNewSession()
|
progressionManager.startNewSession()
|
||||||
gameBoard.updateLevel(selectedLevel)
|
gameBoard.updateLevel(selectedLevel)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue