mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
1c6304f0f7
- 实现移动场上一张牌; - 实现用作记录牌名并可查看的mark; - 将askForChoice和interaction的文本解析方式改为prompt; - 新增属性将牌移至牌堆指定索引位置; - 修改时机“游戏开始时”至正确位置; - 优化衍生牌逻辑; - 新增“卡牌展示后”时机。
46 lines
1.3 KiB
QML
46 lines
1.3 KiB
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
|
|
|
|
function processPrompt(prompt) {
|
|
const data = prompt.split(":");
|
|
let raw = Backend.translate(data[0]);
|
|
const src = parseInt(data[1]);
|
|
const dest = parseInt(data[2]);
|
|
if (raw.match("%src")) raw = raw.replace("%src", Backend.translate(getPhoto(src).general));
|
|
if (raw.match("%dest")) raw = raw.replace("%dest", Backend.translate(getPhoto(dest).general));
|
|
if (raw.match("%arg")) raw = raw.replace("%arg", Backend.translate(data[3]));
|
|
if (raw.match("%arg2")) raw = raw.replace("%arg2", Backend.translate(data[4]));
|
|
return raw;
|
|
}
|
|
|
|
text: processPrompt(answer)
|
|
|
|
onAnswerChanged: {
|
|
if (!answer) return;
|
|
Backend.callLuaFunction(
|
|
"SetInteractionDataOfSkill",
|
|
[skill, JSON.stringify(answer)]
|
|
);
|
|
roomScene.dashboard.startPending(skill);
|
|
}
|
|
|
|
onClicked: {
|
|
roomScene.popupBox.sourceComponent = Qt.createComponent("../RoomElement/ChoiceBox.qml");
|
|
let box = roomScene.popupBox.item;
|
|
box.options = choices;
|
|
box.accepted.connect(() => {
|
|
answer = choices[box.result];
|
|
});
|
|
}
|
|
|
|
}
|