Improved code for showing player bets next to name
Also added this functionality to the croupier "player".
This commit is contained in:
parent
af6401ddd5
commit
91ea5543a2
2 changed files with 45 additions and 64 deletions
|
@ -44,6 +44,39 @@ Item {
|
|||
rightMargin: 5
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: roll
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 8
|
||||
left: parent.right
|
||||
leftMargin: 5
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PlayerAreaModel
|
||||
|
||||
function onBetChanged(b, n, bet) {
|
||||
if (PlayerAreaModel.focusedPlayer == 0) {
|
||||
const betTypes = ["NONE", "Red", "Black", "Odd", "Even", "Low", "High",
|
||||
"Dozen", "Street", "Single", "Column", "Split"]
|
||||
if (b < 7) {
|
||||
roll.text = betTypes[b]
|
||||
} else {
|
||||
roll.text = betTypes[b] + " " + (n + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onBetRemoved(b, n) {
|
||||
if (PlayerAreaModel.focusedPlayer == 0) {
|
||||
roll.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
@ -140,75 +173,23 @@ Item {
|
|||
|
||||
function onBetChanged(b, n, bet) {
|
||||
if (PlayerAreaModel.focusedPlayer - 1 == index) {
|
||||
const betTypes = ["NONE", "Red", "Black", "Odd", "Even", "Low", "High",
|
||||
"Dozen", "Street", "Single", "Column", "Split"]
|
||||
if (currentBet1.text == "") {
|
||||
currentBet1.betType = b
|
||||
currentBet1.n = n
|
||||
switch(b) {
|
||||
case 1:
|
||||
currentBet1.text = "Red: " + bet + "g"
|
||||
break;
|
||||
case 2:
|
||||
currentBet1.text = "Black: " + bet + "g"
|
||||
break;
|
||||
case 3:
|
||||
currentBet1.text = "Odd: " + bet + "g"
|
||||
break;
|
||||
case 4:
|
||||
currentBet1.text = "Even: " + bet + "g"
|
||||
break;
|
||||
case 5:
|
||||
currentBet1.text = "Low: " + bet + "g"
|
||||
break;
|
||||
case 6:
|
||||
currentBet1.text = "High: " + bet + "g"
|
||||
break;
|
||||
case 7:
|
||||
currentBet1.text = "Dozen " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 8:
|
||||
currentBet1.text = "Street " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 9:
|
||||
currentBet1.text = "Single " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 10:
|
||||
currentBet1.text = "Column " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
if (b < 7) {
|
||||
currentBet1.text = betTypes[b] + ": " + bet + "g"
|
||||
} else {
|
||||
currentBet1.text = betTypes[b] + " " + (n + 1) + ": " + bet + "g"
|
||||
}
|
||||
} else {
|
||||
currentBet2.betType = b
|
||||
currentBet2.n = n
|
||||
switch(b) {
|
||||
case 1:
|
||||
currentBet2.text = "Red: " + bet + "g"
|
||||
break;
|
||||
case 2:
|
||||
currentBet2.text = "Black: " + bet + "g"
|
||||
break;
|
||||
case 3:
|
||||
currentBet2.text = "Odd: " + bet + "g"
|
||||
break;
|
||||
case 4:
|
||||
currentBet2.text = "Even: " + bet + "g"
|
||||
break;
|
||||
case 5:
|
||||
currentBet2.text = "Low: " + bet + "g"
|
||||
break;
|
||||
case 6:
|
||||
currentBet2.text = "High: " + bet + "g"
|
||||
break;
|
||||
case 7:
|
||||
currentBet2.text = "Dozen " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 8:
|
||||
currentBet2.text = "Street " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 9:
|
||||
currentBet2.text = "Single " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 10:
|
||||
currentBet2.text = "Column " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
if (b < 7) {
|
||||
currentBet2.text = betTypes[b] + ": " + bet + "g"
|
||||
} else {
|
||||
currentBet2.text = betTypes[b] + " " + (n + 1) + ": " + bet + "g"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ Item {
|
|||
topMargin: 68
|
||||
}
|
||||
|
||||
rowSpacing: 0
|
||||
rowSpacing: 1
|
||||
columnSpacing: 1.8
|
||||
|
||||
Repeater {
|
||||
model: 36
|
||||
|
||||
Item {
|
||||
height: 45
|
||||
height: 44
|
||||
width: 35
|
||||
|
||||
BetButton {
|
||||
|
|
Loading…
Reference in a new issue