2023-10-02 16:19:12 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
|
|
|
import Qt5Compat.GraphicalEffects
|
|
|
|
|
2023-12-06 13:07:35 +00:00
|
|
|
ColumnLayout {
|
2023-10-02 16:19:12 +00:00
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
property var extra_data: ({}) // unused
|
|
|
|
signal finish()
|
|
|
|
property var cards: []
|
|
|
|
|
|
|
|
Text {
|
2024-01-24 19:23:29 +00:00
|
|
|
text: luatr("Handcard selector")
|
2023-12-06 13:07:35 +00:00
|
|
|
Layout.fillWidth: true
|
2023-10-02 16:19:12 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2023-12-06 13:07:35 +00:00
|
|
|
font.pixelSize: 18
|
|
|
|
color: "#E4D5A0"
|
2023-10-02 16:19:12 +00:00
|
|
|
}
|
|
|
|
|
2023-12-06 13:07:35 +00:00
|
|
|
GridView {
|
|
|
|
id: cardsList
|
|
|
|
cellWidth: 93 * 0.9 + 4
|
|
|
|
cellHeight: 130 * 0.9 + 4
|
|
|
|
Layout.preferredWidth: root.width - root.width % 88
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-10-02 16:19:12 +00:00
|
|
|
clip: true
|
|
|
|
|
2023-12-06 13:07:35 +00:00
|
|
|
model: cards
|
|
|
|
|
|
|
|
delegate: CardItem {
|
|
|
|
width: 93 * 0.9
|
|
|
|
height: 130 * 0.9
|
|
|
|
chosenInBox: modelData.chosen
|
|
|
|
onClicked: {
|
|
|
|
const clist = roomScene.dashboard.handcardArea.cards;
|
|
|
|
for (let cd of clist) {
|
|
|
|
if (cd.cid == cid) {
|
|
|
|
cd.selected = !cd.selected;
|
|
|
|
cd.clicked();
|
|
|
|
finish();
|
2023-10-02 16:19:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-06 13:07:35 +00:00
|
|
|
Component.onCompleted: {
|
2024-01-24 19:23:29 +00:00
|
|
|
setData(lcall("GetCardData", modelData.cid));
|
2023-12-06 13:07:35 +00:00
|
|
|
}
|
2023-10-02 16:19:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
cards = roomScene.dashboard.handcardArea.cards
|
|
|
|
.filter(c => c.selectable)
|
|
|
|
.map(c => { return { cid: c.cid, chosen: c.selected }; });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|