2022-09-14 05:01:10 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2022-04-15 10:37:20 +00:00
|
|
|
import "RoomElement"
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 07:27:56 +00:00
|
|
|
id: root
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
property bool loaded: false
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00: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 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
delegate: ColumnLayout {
|
|
|
|
Text { text: Backend.translate(name) }
|
|
|
|
GridLayout {
|
|
|
|
columns: root.width / 98
|
|
|
|
Repeater {
|
|
|
|
model: JSON.parse(Backend.callLuaFunction("GetGenerals", [name]))
|
2023-02-26 08:51:29 +00:00
|
|
|
GeneralCardItem {
|
2022-04-30 07:27:56 +00:00
|
|
|
autoBack: false
|
2022-05-01 10:37:13 +00:00
|
|
|
name: modelData
|
2023-02-15 11:54:35 +00:00
|
|
|
onClicked: {
|
|
|
|
generalText.clear();
|
|
|
|
generalText.general = modelData;
|
2023-03-18 07:34:42 +00:00
|
|
|
generalText.updateGeneral();
|
2023-02-15 11:54:35 +00:00
|
|
|
generalDetail.open();
|
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2022-04-30 07:27:56 +00:00
|
|
|
Button {
|
2022-05-01 10:37:13 +00:00
|
|
|
text: Backend.translate("Quit")
|
2022-04-30 07:27:56 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
onClicked: {
|
|
|
|
mainStack.pop();
|
2022-04-15 10:37:20 +00:00
|
|
|
}
|
2022-04-30 07:27:56 +00:00
|
|
|
}
|
2022-04-15 10:37:20 +00:00
|
|
|
|
2023-02-15 11:54:35 +00: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
|
|
|
|
|
2023-03-18 07:34:42 +00:00
|
|
|
function updateGeneral() {
|
2023-02-15 11:54:35 +00:00
|
|
|
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 07:27:56 +00: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 10:37:20 +00:00
|
|
|
}
|