diff --git a/Main.qml b/Main.qml index c97c59d..7a009d9 100644 --- a/Main.qml +++ b/Main.qml @@ -64,8 +64,16 @@ ApplicationWindow { model: Math.min(GameState.throwawayPile.length, 3) delegate: CardModel { required property int index // passed from repeater - card: GameState.throwawayPile[GameState.throwawayPile.length - 1 - index] + property int reversedIndex: Math.min(GameState.throwawayPile.length, 3) - 1 - index; + card: GameState.throwawayPile[GameState.throwawayPile.length - 1 - reversedIndex] isFaceDown: false + onClicked: { + // Only auto-move the last card in the throwaway pile + // cards below it are shown, but shouldn't have a click effect + if (reversedIndex == 0) { + GameState.autoMoveThrownCard() + } + } } } } @@ -74,6 +82,9 @@ ApplicationWindow { CardModel { card: GameState.drawPile.length > 0 ? GameState.drawPile[GameState.drawPile.length - 1] : null isFaceDown: true + onClicked: { + GameState.drawNextCard() + } } } } @@ -102,6 +113,11 @@ ApplicationWindow { card: col.card isFaceDown: !col.revealed + onClicked: { + if (col.revealed) { + GameState.autoMoveColumnCard(parent.index, index) + } + } } } }