FreeKill/Fk/RoomElement/ViewPile.qml
Ho-spair 1c6304f0f7
UI modify (#158)
- 实现移动场上一张牌;
- 实现用作记录牌名并可查看的mark;
- 将askForChoice和interaction的文本解析方式改为prompt;
- 新增属性将牌移至牌堆指定索引位置;
- 修改时机“游戏开始时”至正确位置;
- 优化衍生牌逻辑;
- 新增“卡牌展示后”时机。
2023-05-20 16:00:03 +08:00

101 lines
2.2 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: ({})
signal finish()
Rectangle {
anchors.fill: parent
color: "black"
GlowText {
id: pileName
text: Backend.translate(extra_data.name)
width: parent.width
anchors.topMargin: 10
horizontalAlignment: Text.AlignHCenter
font.family: fontLibian.name
color: "#E4D5A0"
font.pixelSize: 30
font.weight: Font.Medium
glow.color: "black"
glow.spread: 0.3
glow.radius: 5
}
LinearGradient {
anchors.fill: pileName
source: pileName
gradient: Gradient {
GradientStop {
position: 0
color: "#FEF7C2"
}
GradientStop {
position: 0.5
color: "#D2AD4A"
}
GradientStop {
position: 1
color: "#BE9878"
}
}
}
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
ColumnLayout {
id: cardsList
GridLayout {
columns: 4
Repeater {
model: extra_data.ids || extra_data.cardNames
CardItem {
id: cardItem
width: (flickableContainer.width - 15) / 4
height: cardItem.width * 1.4
autoBack: false
Component.onCompleted: {
let data = {}
if (extra_data.ids) {
data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData]));
} else {
data.cid = 0;
data.name = modelData;
data.suit = '';
data.number = 0;
data.color = '';
}
setData(data);
}
}
}
}
}
}
}
}