mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 19:58:13 +08:00
2acec5f20a
重组qml文件,使用qmldir文件实现模块化
67 lines
1.4 KiB
QML
67 lines
1.4 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: Backend.translate("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 = Backend.callLuaFunction("GetCardData", [id]);
|
|
data = JSON.parse(data);
|
|
data.selectable = true;
|
|
data.footnote = "";
|
|
cards.append(data);
|
|
});
|
|
}
|
|
|
|
function takeAG(g, cid) {
|
|
for (let i = 0; i < cards.count; i++) {
|
|
let item = cards.get(i);
|
|
if (item.cid !== cid) continue;
|
|
item.footnote = g;
|
|
item.selectable = false;
|
|
break;
|
|
}
|
|
}
|
|
}
|