2022-09-14 13:01:10 +08:00
|
|
|
import QtQuick
|
2022-03-30 14:14:40 +08:00
|
|
|
import "../skin-bank.js" as SkinBank
|
|
|
|
|
|
|
|
/* Layout of general card:
|
|
|
|
* +--------+
|
|
|
|
*kindom|wu 9999| <- hp
|
|
|
|
*name -|s |
|
|
|
|
* |q img |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* +--------+
|
|
|
|
* Inherit from CardItem to use common signal
|
|
|
|
*/
|
|
|
|
|
|
|
|
CardItem {
|
2022-05-01 18:37:13 +08:00
|
|
|
property string kingdom
|
|
|
|
property int hp
|
|
|
|
name: ""
|
2022-04-30 15:27:56 +08:00
|
|
|
// description: Sanguosha.getGeneralDescription(name)
|
|
|
|
suit: ""
|
|
|
|
number: 0
|
|
|
|
footnote: ""
|
|
|
|
card.source: SkinBank.GENERAL_DIR + name
|
|
|
|
glow.color: "white" //Engine.kingdomColor[kingdom]
|
2022-05-01 18:37:13 +08:00
|
|
|
|
|
|
|
Image {
|
|
|
|
source: SkinBank.GENERALCARD_DIR + "border"
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
source: SkinBank.GENERALCARD_DIR + kingdom
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
x: 34
|
|
|
|
y: 4
|
|
|
|
spacing: 1
|
|
|
|
Repeater {
|
|
|
|
model: hp > 5 ? 1 : hp
|
|
|
|
Image {
|
|
|
|
source: SkinBank.GENERALCARD_DIR + kingdom + "-magatama"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
visible: hp > 5
|
|
|
|
text: "x" + hp
|
|
|
|
color: "white"
|
|
|
|
font.pixelSize: 14
|
|
|
|
style: Text.Outline
|
|
|
|
y: -6
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
width: 20
|
|
|
|
height: 80
|
|
|
|
x: 2
|
|
|
|
y: lineCount > 6 ? 30 : 34
|
|
|
|
text: Backend.translate(name)
|
|
|
|
color: "white"
|
2023-01-29 18:11:41 +08:00
|
|
|
font.family: fontLibian.name
|
2022-05-01 18:37:13 +08:00
|
|
|
font.pixelSize: 18
|
|
|
|
lineHeight: Math.max(1.4 - lineCount / 10, 0.6)
|
|
|
|
style: Text.Outline
|
|
|
|
wrapMode: Text.WrapAnywhere
|
|
|
|
}
|
|
|
|
|
|
|
|
onNameChanged: {
|
|
|
|
let data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
|
|
|
kingdom = data.kingdom;
|
|
|
|
hp = data.hp;
|
|
|
|
}
|
2022-03-30 14:14:40 +08:00
|
|
|
}
|