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
|
2023-05-19 10:08:36 +08:00
|
|
|
import Fk
|
|
|
|
import Fk.RoomElement
|
2022-03-23 19:40:28 +08:00
|
|
|
|
|
|
|
Column {
|
2022-04-30 15:27:56 +08:00
|
|
|
id: root
|
|
|
|
property int maxValue: 4
|
|
|
|
property int value: 4
|
|
|
|
property var colors: ["#F4180E", "#F4180E", "#E3B006", "#25EC27"]
|
2023-04-13 20:17:39 +08:00
|
|
|
property int shieldNum: 0
|
|
|
|
|
|
|
|
Shield {
|
|
|
|
id: shield
|
|
|
|
value: shieldNum
|
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Repeater {
|
|
|
|
id: repeater
|
2023-04-13 20:17:39 +08:00
|
|
|
model: column.visible ? 0 : maxValue
|
2022-04-30 15:27:56 +08:00
|
|
|
Magatama {
|
2024-01-25 03:23:29 +08:00
|
|
|
state: {
|
|
|
|
if (maxValue - 1 - index >= value) {
|
|
|
|
return 0;
|
|
|
|
} else if (value >= 3 || value >= maxValue) {
|
|
|
|
return 3;
|
|
|
|
} else if (value <= 0) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Column {
|
2023-04-13 20:17:39 +08:00
|
|
|
id: column
|
2024-01-25 03:23:29 +08:00
|
|
|
visible: maxValue > 4 || value > maxValue ||
|
|
|
|
(shieldNum > 0 && maxValue > 3)
|
2022-04-30 15:27:56 +08:00
|
|
|
spacing: -4
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
Magatama {
|
|
|
|
state: (value >= 3 || value >= maxValue) ? 3 : (value <= 0 ? 0 : value)
|
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
GlowText {
|
|
|
|
id: hpItem
|
|
|
|
width: root.width
|
|
|
|
text: value
|
2024-01-25 03:23:29 +08:00
|
|
|
color: {
|
|
|
|
let idx;
|
|
|
|
if (value >= 3 || value >= maxValue) {
|
|
|
|
idx = 3;
|
|
|
|
} else if (value <= 0) {
|
|
|
|
idx = 0;
|
|
|
|
} else {
|
|
|
|
idx = value;
|
|
|
|
}
|
|
|
|
return root.colors[idx];
|
|
|
|
}
|
2022-05-01 18:37:13 +08:00
|
|
|
font.family: fontLibian.name
|
2022-04-30 15:27:56 +08:00
|
|
|
font.pixelSize: 22
|
|
|
|
font.bold: true
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
glow.color: "#3E3F47"
|
|
|
|
glow.spread: 0.8
|
|
|
|
glow.radius: 8
|
2022-09-14 13:01:10 +08:00
|
|
|
//glow.samples: 12
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
GlowText {
|
|
|
|
id: splitter
|
2023-04-13 20:17:39 +08:00
|
|
|
height: 12
|
2022-04-30 15:27:56 +08:00
|
|
|
width: root.width
|
|
|
|
text: "/"
|
|
|
|
z: -10
|
2023-04-13 20:17:39 +08:00
|
|
|
rotation: 40
|
2022-04-30 15:27:56 +08:00
|
|
|
color: hpItem.color
|
2023-04-13 20:17:39 +08:00
|
|
|
font.family: fontLibian.name
|
|
|
|
font.pixelSize: 14
|
|
|
|
font.bold: true
|
2022-04-30 15:27:56 +08:00
|
|
|
horizontalAlignment: hpItem.horizontalAlignment
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
glow.color: hpItem.glow.color
|
|
|
|
glow.spread: hpItem.glow.spread
|
|
|
|
glow.radius: hpItem.glow.radius
|
2022-09-14 13:01:10 +08:00
|
|
|
//glow.samples: hpItem.glow.samples
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
GlowText {
|
|
|
|
id: maxHpItem
|
|
|
|
width: root.width
|
|
|
|
text: maxValue
|
|
|
|
color: hpItem.color
|
|
|
|
font: hpItem.font
|
|
|
|
horizontalAlignment: hpItem.horizontalAlignment
|
2022-03-23 19:40:28 +08:00
|
|
|
|
2022-04-30 15:27:56 +08:00
|
|
|
glow.color: hpItem.glow.color
|
|
|
|
glow.spread: hpItem.glow.spread
|
|
|
|
glow.radius: hpItem.glow.radius
|
2022-09-14 13:01:10 +08:00
|
|
|
//glow.samples: hpItem.glow.samples
|
2022-03-23 19:40:28 +08:00
|
|
|
}
|
2022-04-30 15:27:56 +08:00
|
|
|
}
|
2022-03-23 19:40:28 +08:00
|
|
|
}
|