2022-09-14 13:01:10 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2022-04-15 18:37:20 +08:00
|
|
|
import "RoomElement"
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 15:27:56 +08:00
|
|
|
id: root
|
2022-04-15 18:37:20 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
property bool loaded: false
|
2022-04-15 18:37:20 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
ListView {
|
|
|
|
width: Math.floor(root.width / 98) * 98
|
|
|
|
height: parent.height
|
|
|
|
anchors.centerIn: parent
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
model: ListModel {
|
|
|
|
id: packages
|
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
delegate: ColumnLayout {
|
|
|
|
Text { text: Backend.translate(name) }
|
|
|
|
GridLayout {
|
|
|
|
columns: root.width / 98
|
|
|
|
Repeater {
|
|
|
|
model: JSON.parse(Backend.callLuaFunction("GetGenerals", [name]))
|
|
|
|
GeneralCardItem {
|
|
|
|
autoBack: false
|
2022-05-01 18:37:13 +08:00
|
|
|
name: modelData
|
2023-02-15 19:54:35 +08:00
|
|
|
onClicked: {
|
|
|
|
generalText.clear();
|
|
|
|
generalText.general = modelData;
|
|
|
|
generalDetail.open();
|
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Button {
|
2022-05-01 18:37:13 +08:00
|
|
|
text: Backend.translate("Quit")
|
2022-04-30 15:27:56 +08:00
|
|
|
anchors.right: parent.right
|
|
|
|
onClicked: {
|
|
|
|
mainStack.pop();
|
2022-04-15 18:37:20 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
|
2023-02-15 19:54:35 +08:00
|
|
|
Drawer {
|
|
|
|
id: generalDetail
|
|
|
|
edge: Qt.RightEdge
|
|
|
|
width: parent.width * 0.4 / mainWindow.scale
|
|
|
|
height: parent.height / mainWindow.scale
|
|
|
|
dim: false
|
|
|
|
clip: true
|
|
|
|
dragMargin: 0
|
|
|
|
scale: mainWindow.scale
|
|
|
|
transformOrigin: Item.TopRight
|
|
|
|
|
|
|
|
Flickable {
|
|
|
|
flickableDirection: Flickable.VerticalFlick
|
|
|
|
contentWidth: generalText.width
|
|
|
|
contentHeight: generalText.height
|
|
|
|
width: parent.width * 0.8
|
|
|
|
height: parent.height * 0.8
|
|
|
|
clip: true
|
|
|
|
anchors.centerIn: parent
|
|
|
|
ScrollBar.vertical: ScrollBar {}
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
id: generalText
|
|
|
|
|
|
|
|
property string general: ""
|
|
|
|
width: generalDetail.width * 0.75
|
|
|
|
readOnly: true
|
|
|
|
selectByKeyboard: true
|
|
|
|
selectByMouse: true
|
|
|
|
wrapMode: TextEdit.WordWrap
|
|
|
|
textFormat: TextEdit.RichText
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
|
|
|
onGeneralChanged: {
|
|
|
|
let data = JSON.parse(Backend.callLuaFunction("GetGeneralDetail", [general]));
|
|
|
|
this.append(Backend.translate(data.kingdom) + " " + Backend.translate(general) + " " + data.hp + "/" + data.maxHp);
|
|
|
|
data.skill.forEach(t => {
|
|
|
|
this.append("<b>" + Backend.translate(t.name) + "</b>: " + t.description)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
function loadPackages() {
|
|
|
|
if (loaded) return;
|
|
|
|
let packs = JSON.parse(Backend.callLuaFunction("GetAllGeneralPack", []));
|
|
|
|
packs.forEach((name) => packages.append({ name: name }));
|
|
|
|
loaded = true;
|
|
|
|
}
|
2022-04-15 18:37:20 +08:00
|
|
|
}
|