Added croupier as a "Player".
This commit is contained in:
parent
14009e8a5d
commit
af6401ddd5
4 changed files with 65 additions and 13 deletions
|
@ -20,7 +20,10 @@ Item {
|
||||||
border.width: 0
|
border.width: 0
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
if (rouletteTable.numberOfBets < 2 || border.width == 3) {
|
if (PlayerAreaModel.focusedPlayer == 0 && rouletteTable.numberOfBets == 1 && border.width != 3) {
|
||||||
|
"#00000000"
|
||||||
|
} else if (rouletteTable.numberOfBets < 2 || border.width == 3) {
|
||||||
|
if ((PlayerAreaModel.focusedPlayer == 0 && rouletteTable.numberOfBets < 1) || PlayerAreaModel.focusedPlayer != 0 || border.width == 3) {
|
||||||
if (tapHandler.pressed) {
|
if (tapHandler.pressed) {
|
||||||
"#88999999"
|
"#88999999"
|
||||||
} else if (hoverHandler.hovered) {
|
} else if (hoverHandler.hovered) {
|
||||||
|
@ -31,6 +34,9 @@ Item {
|
||||||
} else {
|
} else {
|
||||||
"#00000000"
|
"#00000000"
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
"#00000000"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
|
@ -40,10 +46,19 @@ Item {
|
||||||
id: tapHandler
|
id: tapHandler
|
||||||
|
|
||||||
onTapped: {
|
onTapped: {
|
||||||
if (rouletteTable.numberOfBets < 2 && parent.border.width == 0) {
|
if (PlayerAreaModel.focusedPlayer == 0 && rouletteTable.numberOfBets == 1 && parent.border.width != 3) {
|
||||||
|
|
||||||
|
} else if (rouletteTable.numberOfBets < 2 && parent.border.width == 0) {
|
||||||
parent.border.width = 3
|
parent.border.width = 3
|
||||||
|
|
||||||
|
/* Don't show this dialog for the croupier */
|
||||||
|
if (PlayerAreaModel.focusedPlayer != 0) {
|
||||||
roulette.showBetInputDialog(betType, index_, betButton.parent.x + offsetX,
|
roulette.showBetInputDialog(betType, index_, betButton.parent.x + offsetX,
|
||||||
betButton.parent.y + offsetY)
|
betButton.parent.y + offsetY)
|
||||||
|
} else {
|
||||||
|
rouletteTable.numberOfBets = 1
|
||||||
|
PlayerAreaModel.bet(betType, index_, 0)
|
||||||
|
}
|
||||||
} else if (parent.border.width == 3) {
|
} else if (parent.border.width == 3) {
|
||||||
parent.border.width = 0
|
parent.border.width = 0
|
||||||
PlayerAreaModel.removeBet(betType, index_)
|
PlayerAreaModel.removeBet(betType, index_)
|
||||||
|
|
|
@ -4,7 +4,7 @@ PlayerAreaModel::PlayerAreaModel(QObject *parent)
|
||||||
{
|
{
|
||||||
Player defaultValues;
|
Player defaultValues;
|
||||||
|
|
||||||
for(int i = 0; i < 7; i++){
|
for(int i = 0; i < 8; i++){
|
||||||
players.append(defaultValues);
|
players.append(defaultValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,38 @@ Item {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: croupier
|
id: croupier
|
||||||
|
font.pointSize: 18
|
||||||
text: "Croupier"
|
text: "Croupier"
|
||||||
|
color: {
|
||||||
|
if (tapHandler.pressed) {
|
||||||
|
"#99000000"
|
||||||
|
} else {
|
||||||
|
"#000000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
id: tapHandler
|
||||||
|
|
||||||
|
onSingleTapped: {
|
||||||
|
PlayerAreaModel.focusedPlayer = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: indicator
|
||||||
|
color: "red"
|
||||||
|
height: 10
|
||||||
|
width: 10
|
||||||
|
opacity: 0.5
|
||||||
|
visible: PlayerAreaModel.focusedPlayer == 0
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
right: parent.left
|
||||||
|
rightMargin: 5
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
@ -47,7 +78,7 @@ Item {
|
||||||
* This check will run once when the object is created, but then only refresh
|
* This check will run once when the object is created, but then only refresh
|
||||||
* when the NOTIFY signal for .focusedPlayer is sent
|
* when the NOTIFY signal for .focusedPlayer is sent
|
||||||
*/
|
*/
|
||||||
visible: PlayerAreaModel.focusedPlayer == index
|
visible: PlayerAreaModel.focusedPlayer - 1 == index
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -69,7 +100,7 @@ Item {
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
/* focusReason 0, 1 and 2 are mouse, tab forward, and tab backward, respectively */
|
/* focusReason 0, 1 and 2 are mouse, tab forward, and tab backward, respectively */
|
||||||
if (activeFocus && (focusReason == 0 || focusReason == 1 || focusReason == 2)) {
|
if (activeFocus && (focusReason == 0 || focusReason == 1 || focusReason == 2)) {
|
||||||
PlayerAreaModel.focusedPlayer = index
|
PlayerAreaModel.focusedPlayer = index + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +139,7 @@ Item {
|
||||||
target: PlayerAreaModel
|
target: PlayerAreaModel
|
||||||
|
|
||||||
function onBetChanged(b, n, bet) {
|
function onBetChanged(b, n, bet) {
|
||||||
if (PlayerAreaModel.focusedPlayer == index) {
|
if (PlayerAreaModel.focusedPlayer - 1 == index) {
|
||||||
if (currentBet1.text == "") {
|
if (currentBet1.text == "") {
|
||||||
currentBet1.betType = b
|
currentBet1.betType = b
|
||||||
currentBet1.n = n
|
currentBet1.n = n
|
||||||
|
@ -184,7 +215,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBetRemoved(b, n) {
|
function onBetRemoved(b, n) {
|
||||||
if (PlayerAreaModel.focusedPlayer == index) {
|
if (PlayerAreaModel.focusedPlayer - 1 == index) {
|
||||||
if (currentBet1.betType == b && currentBet1.n == n) {
|
if (currentBet1.betType == b && currentBet1.n == n) {
|
||||||
currentBet1.text = ""
|
currentBet1.text = ""
|
||||||
} else if (currentBet2.betType == b && currentBet2.n == n) {
|
} else if (currentBet2.betType == b && currentBet2.n == n) {
|
||||||
|
|
6
Root.qml
6
Root.qml
|
@ -12,6 +12,12 @@ Window {
|
||||||
Pane {
|
Pane {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
onClicked: focus = true
|
||||||
|
}
|
||||||
|
|
||||||
PlayerAreaView {
|
PlayerAreaView {
|
||||||
id: playerAreaView
|
id: playerAreaView
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue