2023-05-19 07:45:21 +08:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
property var extra_data: ({})
|
|
|
|
|
|
|
|
signal finish()
|
|
|
|
|
|
|
|
contentHeight: details.height
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: details
|
|
|
|
width: parent.width - 40
|
|
|
|
x: 20
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: skillDesc
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
font.pixelSize: 18
|
|
|
|
|
|
|
|
readOnly: true
|
|
|
|
selectByKeyboard: true
|
|
|
|
selectByMouse: false
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
textFormat: TextEdit.RichText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onExtra_dataChanged: {
|
|
|
|
if (!extra_data.generals) return;
|
|
|
|
skillDesc.text = "";
|
|
|
|
|
|
|
|
extra_data.generals.forEach((g) => {
|
2023-07-02 13:21:13 +08:00
|
|
|
const data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [g]));
|
2023-05-19 07:45:21 +08:00
|
|
|
skillDesc.append(Backend.translate(data.kingdom) + " " + Backend.translate(g) + " " + data.hp + "/" + data.maxHp);
|
2023-08-24 21:37:06 +08:00
|
|
|
if (data.companions.length > 0){
|
|
|
|
let ret = '';
|
|
|
|
ret += "<font color=\"slategrey\"><b>" + Backend.translate("Companions") + "</b>: ";
|
|
|
|
data.companions.forEach(t => {
|
|
|
|
ret += Backend.translate(t) + ' '
|
|
|
|
});
|
|
|
|
skillDesc.append(ret)
|
|
|
|
}
|
2023-05-19 07:45:21 +08:00
|
|
|
data.skill.forEach(t => {
|
|
|
|
skillDesc.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
|
|
|
});
|
|
|
|
data.related_skill.forEach(t => {
|
|
|
|
skillDesc.append("<font color=\"purple\"><b>" + Backend.translate(t.name) + "</b>: " + t.description + "</font>")
|
|
|
|
});
|
|
|
|
skillDesc.append("\n");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|