2024-06-01 01:14:46 +01:00
|
|
|
import QtQuick
|
2024-06-01 14:46:10 +01:00
|
|
|
import QtQuick.Layouts
|
2024-06-01 01:14:46 +01:00
|
|
|
|
|
|
|
import roulette
|
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
/*
|
|
|
|
* The very important id 'rouletteTable'
|
|
|
|
* comes from Roulette.qml
|
|
|
|
*/
|
2024-06-01 01:14:46 +01:00
|
|
|
Item {
|
|
|
|
|
2024-06-01 14:46:10 +01:00
|
|
|
RowLayout {
|
2024-06-02 09:34:59 +01:00
|
|
|
id: layout
|
|
|
|
property int indexForDialog
|
|
|
|
|
2024-06-01 14:46:10 +01:00
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: 90
|
|
|
|
top: parent.top
|
|
|
|
topMargin: 22
|
|
|
|
}
|
2024-06-01 01:14:46 +01:00
|
|
|
|
2024-06-01 14:46:10 +01:00
|
|
|
spacing: 1.8
|
2024-06-01 01:14:46 +01:00
|
|
|
|
2024-06-01 14:46:10 +01:00
|
|
|
Repeater {
|
2024-06-02 09:34:59 +01:00
|
|
|
id: repeater
|
2024-06-01 14:46:10 +01:00
|
|
|
model: 12
|
2024-06-01 01:14:46 +01:00
|
|
|
|
2024-06-02 09:34:59 +01:00
|
|
|
Item {
|
2024-06-02 21:13:43 +01:00
|
|
|
property alias selected: selected
|
|
|
|
|
|
|
|
id: betButton
|
2024-06-01 14:46:10 +01:00
|
|
|
height: 45
|
|
|
|
width: 35
|
|
|
|
|
2024-06-02 09:34:59 +01:00
|
|
|
Rectangle {
|
2024-06-02 21:13:43 +01:00
|
|
|
id: selected
|
2024-06-02 09:34:59 +01:00
|
|
|
visible: true
|
|
|
|
height: parent.height
|
|
|
|
width: parent.width
|
2024-06-02 21:13:43 +01:00
|
|
|
border.color: "blue"
|
|
|
|
border.width: 0
|
|
|
|
|
|
|
|
color: {
|
|
|
|
if (rouletteTable.numberOfBets < 2 || border.width == 2) {
|
|
|
|
if (tapHandler1.pressed) {
|
|
|
|
"#AA999999"
|
|
|
|
} else if (hoverHandler.hovered) {
|
|
|
|
"#AAEEEEEE"
|
|
|
|
} else {
|
|
|
|
"#00000000"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
"#00000000"
|
|
|
|
}
|
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
|
|
|
|
HoverHandler {
|
|
|
|
id: hoverHandler
|
|
|
|
}
|
|
|
|
TapHandler {
|
|
|
|
id: tapHandler1
|
2024-06-01 01:14:46 +01:00
|
|
|
|
2024-06-02 09:34:59 +01:00
|
|
|
onTapped: {
|
2024-06-02 21:13:43 +01:00
|
|
|
if (rouletteTable.numberOfBets < 2 && parent.border.width == 0) {
|
2024-06-02 09:34:59 +01:00
|
|
|
parent.border.width = 2
|
|
|
|
layout.indexForDialog = index
|
2024-06-02 21:13:43 +01:00
|
|
|
roulette.showBetInputDialog(PlayerAreaModel.STREET, index, betButton.x, betButton.y)
|
|
|
|
} else if (parent.border.width == 2) {
|
2024-06-02 09:34:59 +01:00
|
|
|
parent.border.width = 0
|
2024-06-02 21:13:43 +01:00
|
|
|
PlayerAreaModel.removeBet(PlayerAreaModel.STREET, index)
|
|
|
|
rouletteTable.numberOfBets -= 1
|
2024-06-02 09:34:59 +01:00
|
|
|
}
|
2024-06-01 14:46:10 +01:00
|
|
|
}
|
2024-06-01 01:14:46 +01:00
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
Connections {
|
|
|
|
target: PlayerAreaModel
|
2024-06-02 09:34:59 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
function onFocusedPlayerChanged(b1, n1, b2, n2) {
|
|
|
|
if (b1 == PlayerAreaModel.STREET && n1 == index) {
|
|
|
|
if (selected.border.width != 0) {
|
|
|
|
rouletteTable.numberOfBets -=1
|
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
selected.border.width = 2;
|
|
|
|
rouletteTable.numberOfBets += 1
|
|
|
|
} else if (b2 == PlayerAreaModel.STREET && n2 == index) {
|
|
|
|
if (selected.border.width != 0) {
|
|
|
|
rouletteTable.numberOfBets -=1
|
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
selected.border.width = 2;
|
|
|
|
rouletteTable.numberOfBets += 1
|
|
|
|
} else {
|
|
|
|
if (selected.border.width != 0) {
|
|
|
|
rouletteTable.numberOfBets -=1
|
|
|
|
}
|
|
|
|
selected.border.width = 0;
|
|
|
|
}
|
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
|
2024-06-02 21:13:43 +01:00
|
|
|
function onBetCanceled(n) {
|
|
|
|
if (index == n) {
|
|
|
|
selected.border.width = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-02 09:34:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-01 01:14:46 +01:00
|
|
|
}
|