mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 10:25:19 +01:00
Fix: Add piece placement tracking to update session stats correctly
This commit is contained in:
parent
6958a864c1
commit
5cf8aec02a
2 changed files with 7 additions and 0 deletions
|
@ -267,6 +267,9 @@ class MainActivity : AppCompatActivity(),
|
|||
gameBoard.onPieceMove = {
|
||||
binding.holdPieceView.invalidate()
|
||||
}
|
||||
gameBoard.onPiecePlaced = {
|
||||
piecesPlaced++
|
||||
}
|
||||
|
||||
// Set up music toggle
|
||||
binding.musicToggle.setOnClickListener {
|
||||
|
|
|
@ -60,6 +60,7 @@ class GameBoard(
|
|||
var onPieceLock: (() -> Unit)? = null
|
||||
var onNextPieceChanged: (() -> Unit)? = null
|
||||
var onLineClear: ((Int, List<Int>) -> Unit)? = null
|
||||
var onPiecePlaced: (() -> Unit)? = null // New callback for when a piece is placed
|
||||
|
||||
// Store the last cleared lines
|
||||
private val lastClearedLines = mutableListOf<Int>()
|
||||
|
@ -414,6 +415,9 @@ class GameBoard(
|
|||
// Trigger the piece lock vibration
|
||||
onPieceLock?.invoke()
|
||||
|
||||
// Notify that a piece was placed
|
||||
onPiecePlaced?.invoke()
|
||||
|
||||
// Find and clear lines immediately
|
||||
findAndClearLines()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue