Skeleton for displaying player bets next to name.
This commit is contained in:
parent
d56584ce26
commit
e482529d67
5 changed files with 74 additions and 6 deletions
|
@ -59,9 +59,9 @@ Dialog {
|
|||
* A solution for the indexes is to rotate the layout 180º, but that will mess up
|
||||
* the x and y coordinates which is even more annoying to fix.
|
||||
*/
|
||||
//if (betType == 9 && n < 35) {
|
||||
// n = 35 - n
|
||||
//}
|
||||
if (betType == 9 && n <= 35) {
|
||||
n = 35 - n
|
||||
}
|
||||
PlayerAreaModel.bet(betType, n, input.text)
|
||||
rouletteTable.numberOfBets += 1
|
||||
}
|
||||
|
|
|
@ -43,10 +43,12 @@ void PlayerAreaModel::bet(BetType b, int n, int bet)
|
|||
player->bet1.betType = b;
|
||||
player->bet1.betValue = bet;
|
||||
player->bet1.betSpot = n;
|
||||
emit betChanged(b, n, bet);
|
||||
} else if (player->bet2.betType == NONE) {
|
||||
player->bet2.betType = b;
|
||||
player->bet2.betValue = bet;
|
||||
player->bet2.betSpot = n;
|
||||
emit betChanged(b, n, bet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,8 +57,10 @@ void PlayerAreaModel::removeBet(BetType b, int n)
|
|||
Player *player = &players[focusedPlayer_];
|
||||
if (player->bet1.betType != NONE) {
|
||||
player->bet1.betType = NONE;
|
||||
emit betRemoved(b, n);
|
||||
} else {
|
||||
player->bet2.betType = NONE;
|
||||
emit betRemoved(b, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
|
||||
signals:
|
||||
void focusedPlayerChanged(BetType b1, uint n1, BetType b2, uint n2);
|
||||
void betChanged(BetType b, int n, int bet);
|
||||
void betRemoved(BetType b, int n);
|
||||
void betCanceled(BetType b, uint n);
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -59,8 +59,11 @@ Item {
|
|||
|
||||
TextField {
|
||||
id: inputField
|
||||
anchors.top: label.bottom
|
||||
anchors.topMargin: 6
|
||||
|
||||
anchors {
|
||||
top: label.bottom
|
||||
topMargin: 6
|
||||
}
|
||||
|
||||
onTextEdited: PlayerAreaModel.setPlayerName(text, index)
|
||||
onActiveFocusChanged: {
|
||||
|
@ -70,6 +73,65 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: currentBet
|
||||
|
||||
anchors {
|
||||
verticalCenter: inputField.verticalCenter
|
||||
left: inputField.right
|
||||
leftMargin: 5
|
||||
}
|
||||
|
||||
text: ""
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PlayerAreaModel
|
||||
|
||||
function onBetChanged(b, n, bet) {
|
||||
if (PlayerAreaModel.focusedPlayer == index) {
|
||||
switch(b) {
|
||||
case 1:
|
||||
currentBet.text = "Red: " + bet + "g"
|
||||
break;
|
||||
case 2:
|
||||
currentBet.text = "Black: " + bet + "g"
|
||||
break;
|
||||
case 3:
|
||||
currentBet.text = "Odd: " + bet + "g"
|
||||
break;
|
||||
case 4:
|
||||
currentBet.text = "Even: " + bet + "g"
|
||||
break;
|
||||
case 5:
|
||||
currentBet.text = "Low: " + bet + "g"
|
||||
break;
|
||||
case 6:
|
||||
currentBet.text = "High: " + bet + "g"
|
||||
break;
|
||||
case 7:
|
||||
currentBet.text = "Dozen " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 8:
|
||||
currentBet.text = "Street " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 9:
|
||||
currentBet.text = "Single " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
case 10:
|
||||
currentBet.text = "Column " + (n + 1) + ": " + bet + "g"
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onBetRemoved(b, n, bet) {
|
||||
if (PlayerAreaModel.focusedPlayer == index) {
|
||||
currentBet.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ Item {
|
|||
x: 60
|
||||
y: 136
|
||||
BetButton {
|
||||
index_: 38
|
||||
index_: 36
|
||||
betType: 9
|
||||
height: 66
|
||||
width: 28
|
||||
|
|
Loading…
Reference in a new issue