FreeKill/Fk/SkillInteraction/SkillCombo.qml
notify be03b04ef0
小修复&Qml美化 (#308)
- 修复了虚拟牌点数相加的bug
- 修复cleaner出错直接爆炸
- QML的代码将宽度控制到80以内
2024-01-25 03:23:29 +08:00

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];
});
}
}