mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
2acec5f20a
重组qml文件,使用qmldir文件实现模块化
33 lines
725 B
QML
33 lines
725 B
QML
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import Fk.Pages
|
|
|
|
MetroButton {
|
|
id: root
|
|
property string skill
|
|
property var choices: []
|
|
property string default_choice
|
|
property string answer: default_choice
|
|
text: Backend.translate(answer)
|
|
|
|
onAnswerChanged: {
|
|
if (!answer) return;
|
|
Backend.callLuaFunction(
|
|
"SetInteractionDataOfSkill",
|
|
[skill, JSON.stringify(answer)]
|
|
);
|
|
roomScene.dashboard.startPending(skill);
|
|
}
|
|
|
|
onClicked: {
|
|
roomScene.popupBox.sourceComponent = Qt.createComponent("Fk.RoomElement", "ChoiceBox");
|
|
let box = roomScene.popupBox.item;
|
|
box.options = choices;
|
|
box.accepted.connect(() => {
|
|
answer = choices[box.result];
|
|
});
|
|
}
|
|
|
|
}
|