FreeKill/Fk/RoomElement/ChooseHandcard.qml
notify f97df65ac6
Enhancement (#274)
- 修复录像负数时间bug
- 修复域名无法读取服务器信息bug
- 加入服务器界面的UI稍微优化
- 大厅聊天的UI稍微优化
- 添加时机“出牌阶段空闲时间点开始时”,可以在此时设置一些提示性标记
- 修复请求处理协程只要遇到error直接炸服的bug
- 添加手牌选择器,能在手牌非常多时帮助玩家选卡
2023-10-03 00:19:12 +08:00

72 lines
1.7 KiB
QML

// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Qt5Compat.GraphicalEffects
Item {
id: root
anchors.fill: parent
property var extra_data: ({}) // unused
signal finish()
property var cards: []
Text {
text: Backend.translate("Handcard selector")
width: parent.width
anchors.topMargin: 6
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 16
}
Flickable {
id: flickableContainer
ScrollBar.vertical: ScrollBar {}
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 40
flickableDirection: Flickable.VerticalFlick
width: parent.width - 20
height: parent.height - 40
contentWidth: cardsList.width
contentHeight: cardsList.height
clip: true
GridLayout {
id: cardsList
columns: Math.floor(flickableContainer.width / 90)
Repeater {
model: cards
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();
}
}
}
Component.onCompleted: {
setData(JSON.parse(Backend.callLuaFunction("GetCardData", [modelData.cid])));
}
}
}
}
}
Component.onCompleted: {
cards = roomScene.dashboard.handcardArea.cards
.filter(c => c.selectable)
.map(c => { return { cid: c.cid, chosen: c.selected }; });
}
}