mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
be03b04ef0
- 修复了虚拟牌点数相加的bug - 修复cleaner出错直接爆炸 - QML的代码将宽度控制到80以内
41 lines
964 B
QML
41 lines
964 B
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import Fk
|
|
import Fk.Pages
|
|
|
|
MetroButton {
|
|
id: root
|
|
property string skill
|
|
property var choices: []
|
|
property var all_choices: []
|
|
property string default_choice
|
|
property string answer: default_choice
|
|
property bool detailed: false
|
|
|
|
text: Util.processPrompt(answer)
|
|
|
|
onAnswerChanged: {
|
|
if (!answer) return;
|
|
lcall("SetInteractionDataOfSkill", skill, JSON.stringify(answer));
|
|
roomScene.dashboard.startPending(skill);
|
|
}
|
|
|
|
onClicked: {
|
|
if (detailed) {
|
|
roomScene.popupBox.sourceComponent =
|
|
Qt.createComponent("../RoomElement/DetailedChoiceBox.qml");
|
|
} else {
|
|
roomScene.popupBox.sourceComponent =
|
|
Qt.createComponent("../RoomElement/ChoiceBox.qml");
|
|
}
|
|
const box = roomScene.popupBox.item;
|
|
box.options = choices;
|
|
box.all_options = all_choices;
|
|
box.accepted.connect(() => {
|
|
answer = all_choices[box.result];
|
|
});
|
|
}
|
|
|
|
}
|