2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-03-01 13:41:16 +00:00
|
|
|
import QtQuick
|
|
|
|
|
|
|
|
GraphicsBox {
|
|
|
|
property int spacing: 5
|
|
|
|
property string currentPlayerName: ""
|
|
|
|
property bool interactive: false
|
|
|
|
|
|
|
|
id: root
|
2024-01-24 19:23:29 +00:00
|
|
|
title.text: luatr("Please choose cards")
|
2023-03-01 13:41:16 +00:00
|
|
|
width: cards.count * 100 + spacing * (cards.count - 1) + 25
|
|
|
|
height: 180
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: cards
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
x: 20
|
|
|
|
y: 35
|
|
|
|
spacing: root.spacing
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: cards
|
|
|
|
|
|
|
|
CardItem {
|
|
|
|
cid: model.cid
|
|
|
|
name: model.name
|
|
|
|
suit: model.suit
|
|
|
|
number: model.number
|
|
|
|
autoBack: false
|
|
|
|
selectable: model.selectable
|
|
|
|
footnote: model.footnote
|
|
|
|
footnoteVisible: true
|
|
|
|
onClicked: {
|
|
|
|
if (root.interactive && selectable) {
|
|
|
|
root.interactive = false;
|
|
|
|
roomScene.state = "notactive";
|
|
|
|
ClientInstance.replyToServer("", cid.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addIds(ids) {
|
|
|
|
ids.forEach((id) => {
|
2024-01-24 19:23:29 +00:00
|
|
|
let data = lcall("GetCardData", id);
|
2023-03-01 13:41:16 +00:00
|
|
|
data.selectable = true;
|
|
|
|
data.footnote = "";
|
|
|
|
cards.append(data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function takeAG(g, cid) {
|
|
|
|
for (let i = 0; i < cards.count; i++) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const item = cards.get(i);
|
2023-03-01 13:41:16 +00:00
|
|
|
if (item.cid !== cid) continue;
|
|
|
|
item.footnote = g;
|
|
|
|
item.selectable = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|