2023-04-09 13:35:35 +08:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
import QtQuick
|
2022-04-14 18:22:00 +08:00
|
|
|
import ".."
|
|
|
|
import "../../../util.js" as Utility
|
|
|
|
import "../../skin-bank.js" as SkinBank
|
|
|
|
|
|
|
|
Item {
|
2022-04-30 15:27:56 +08:00
|
|
|
property int cid: 0
|
|
|
|
property string name: ""
|
|
|
|
property string suit: ""
|
|
|
|
property int number: 0
|
|
|
|
|
|
|
|
property string icon: ""
|
|
|
|
property alias text: textItem.text
|
|
|
|
|
|
|
|
id: root
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: iconItem
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
x: 3
|
|
|
|
|
2023-04-05 02:21:59 +08:00
|
|
|
source: icon ? SkinBank.getEquipIcon(cid, icon) : ""
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: suitItem
|
|
|
|
anchors.right: parent.right
|
|
|
|
source: suit ? SkinBank.CARD_SUIT_DIR + suit : ""
|
|
|
|
width: implicitWidth / implicitHeight * height
|
|
|
|
height: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
GlowText {
|
|
|
|
id: numberItem
|
|
|
|
visible: number > 0 && number < 14
|
|
|
|
text: Utility.convertNumber(number)
|
|
|
|
color: "white"
|
2022-05-01 18:37:13 +08:00
|
|
|
font.family: fontLibian.name
|
2022-04-30 15:27:56 +08:00
|
|
|
font.pixelSize: 16
|
|
|
|
glow.color: "black"
|
|
|
|
glow.spread: 0.75
|
|
|
|
glow.radius: 2
|
2022-09-14 13:01:10 +08:00
|
|
|
//glow.samples: 4
|
2022-04-30 15:27:56 +08:00
|
|
|
x: parent.width - 24
|
|
|
|
y: 1
|
|
|
|
}
|
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
Text {
|
2022-04-30 15:27:56 +08:00
|
|
|
id: textItem
|
2022-05-01 18:37:13 +08:00
|
|
|
font.family: fontLibian.name
|
2022-04-30 15:27:56 +08:00
|
|
|
color: "white"
|
|
|
|
font.pixelSize: 18
|
|
|
|
anchors.left: iconItem.right
|
|
|
|
anchors.leftMargin: -8
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
id: showAnime
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
target: root
|
|
|
|
property: "x"
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
from: 10
|
|
|
|
to: 0
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
NumberAnimation {
|
|
|
|
target: root
|
|
|
|
property: "opacity"
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
from: 0
|
|
|
|
to: 1
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ParallelAnimation {
|
|
|
|
id: hideAnime
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
target: root
|
|
|
|
property: "x"
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
from: 0
|
|
|
|
to: 10
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
NumberAnimation {
|
|
|
|
target: root
|
|
|
|
property: "opacity"
|
|
|
|
duration: 200
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
from: 1
|
|
|
|
to: 0
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function reset()
|
|
|
|
{
|
|
|
|
cid = 0;
|
|
|
|
name = "";
|
|
|
|
suit = "";
|
|
|
|
number = 0;
|
|
|
|
text = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
function setCard(card)
|
|
|
|
{
|
|
|
|
cid = card.cid;
|
|
|
|
name = card.name;
|
|
|
|
suit = card.suit;
|
|
|
|
number = card.number;
|
|
|
|
if (card.subtype === "defensive_horse") {
|
|
|
|
text = "+1";
|
|
|
|
icon = "horse";
|
|
|
|
} else if (card.subtype === "offensive_horse") {
|
|
|
|
text = "-1"
|
|
|
|
icon = "horse";
|
|
|
|
} else {
|
|
|
|
text = Backend.translate(name);
|
2023-02-15 21:20:40 +08:00
|
|
|
if (card.virt_name) {
|
|
|
|
icon = card.virt_name;
|
|
|
|
} else {
|
|
|
|
icon = name;
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
function show()
|
|
|
|
{
|
|
|
|
showAnime.start();
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
function hide()
|
|
|
|
{
|
|
|
|
hideAnime.start();
|
|
|
|
}
|
2022-04-14 18:22:00 +08:00
|
|
|
}
|