mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
d4bb4e21bb
- 将Utility如canUseCardTo的一些函数搬运到了本体 - 为技能添加hooked_piles属性,当失去技能时自动弃置hooked_piles内的所有私人牌堆 - 修复了添加技能没写source_skill的bug - 修复了ActiveSkill的interaction不传入Skill本身而是metatable的bug - 修复了主动询问canUse时没有传入extra_data的bug - 修复了多选时按钮选项变回空白的bug - 修复了判定阶段被中途拿走判定牌后报错的bug
110 lines
2.3 KiB
QML
110 lines
2.3 KiB
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import Fk.Pages
|
|
|
|
GraphicsBox {
|
|
property var options: []
|
|
property var all_options: []
|
|
property bool cancelable: false
|
|
property int min_num: 0
|
|
property int max_num: 0
|
|
property string skill_name: ""
|
|
property var result: []
|
|
|
|
id: root
|
|
title.text: luatr("$Choice").arg(luatr(skill_name))
|
|
width: Math.max(140, body.width + 20)
|
|
height: buttons.height + body.height + title.height + 20
|
|
|
|
ListView {
|
|
id: body
|
|
x: 10
|
|
y: title.height + 5
|
|
width: Math.min(700, 220 * model.length)
|
|
height: 300
|
|
orientation: ListView.Horizontal
|
|
clip: true
|
|
spacing: 20
|
|
|
|
model: all_options
|
|
|
|
delegate: Item {
|
|
width: 200
|
|
height: 290
|
|
|
|
MetroToggleButton {
|
|
id: choicetitle
|
|
width: parent.width
|
|
text: luatr(modelData)
|
|
triggered: root.result.includes(index)
|
|
enabled: options.indexOf(modelData) !== -1
|
|
&& (root.result.length < max_num || triggered)
|
|
textFont.pixelSize: 24
|
|
anchors.top: choiceDetail.bottom
|
|
anchors.topMargin: 8
|
|
|
|
onClicked: {
|
|
if (triggered) {
|
|
root.result.push(index);
|
|
} else {
|
|
root.result.splice(root.result.indexOf(index), 1);
|
|
}
|
|
root.result = root.result;
|
|
}
|
|
}
|
|
|
|
Flickable {
|
|
id: choiceDetail
|
|
x: 4
|
|
height: parent.height - choicetitle.height
|
|
contentHeight: detail.height
|
|
width: parent.width
|
|
clip: true
|
|
Text {
|
|
id: detail
|
|
width: parent.width
|
|
text: luatr(":" + modelData)
|
|
color: "white"
|
|
wrapMode: Text.WordWrap
|
|
font.pixelSize: 16
|
|
textFormat: TextEdit.RichText
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Row {
|
|
id: buttons
|
|
anchors.margins: 8
|
|
anchors.bottom: root.bottom
|
|
anchors.horizontalCenter: root.horizontalCenter
|
|
spacing: 32
|
|
|
|
MetroButton {
|
|
width: 120
|
|
height: 35
|
|
text: luatr("OK")
|
|
enabled: root.result.length >= min_num
|
|
|
|
onClicked: {
|
|
root.close();
|
|
}
|
|
}
|
|
|
|
MetroButton {
|
|
width: 120
|
|
height: 35
|
|
text: luatr("Cancel")
|
|
visible: root.cancelable
|
|
|
|
onClicked: {
|
|
result = [];
|
|
root.close();
|
|
}
|
|
}
|
|
}
|
|
}
|