mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
66 lines
1.3 KiB
QML
66 lines
1.3 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
|
|
GraphicsBox {
|
|
property int spacing: 5
|
|
property string currentPlayerName: ""
|
|
property bool interactive: false
|
|
|
|
id: root
|
|
title.text: luatr("Please choose cards")
|
|
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) => {
|
|
let data = lcall("GetCardData", id);
|
|
data.selectable = true;
|
|
data.footnote = "";
|
|
cards.append(data);
|
|
});
|
|
}
|
|
|
|
function takeAG(g, cid) {
|
|
for (let i = 0; i < cards.count; i++) {
|
|
const item = cards.get(i);
|
|
if (item.cid !== cid) continue;
|
|
item.footnote = g;
|
|
item.selectable = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|