2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-04-04 16:49:54 +00:00
|
|
|
import QtQuick
|
|
|
|
import "../.."
|
|
|
|
|
|
|
|
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.source = "RoomElement/ChoiceBox.qml";
|
|
|
|
let box = roomScene.popupBox.item;
|
|
|
|
box.options = choices;
|
|
|
|
box.accepted.connect(() => {
|
|
|
|
answer = choices[box.result];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|