FreeKill/Fk/RoomElement/MiscStatus.qml
notify be03b04ef0
小修复&Qml美化 (#308)
- 修复了虚拟牌点数相加的bug
- 修复cleaner出错直接爆炸
- QML的代码将宽度控制到80以内
2024-01-25 03:23:29 +08:00

71 lines
1.4 KiB
QML

import QtQuick
import Fk
Item {
id: root
property int pileNum: 0
property int roundNum: 0
property int playedTime: 0
visible: roundNum || pileNum
function getTimeString(time) {
let s = time % 60;
s < 10 && (s = '0' + s);
const m = (time - s) / 60;
const h = (time - s - m * 60) / 3600;
return h ? `${h}:${m}:${s}` : `${m}:${s}`;
}
Text {
id: roundTxt
anchors.right: parent.right
text: luatr("#currentRoundNum").arg(roundNum)
color: "#F0E5DA"
font.pixelSize: 18
font.family: fontLibian.name
style: Text.Outline
styleColor: "#3D2D1C"
}
Text {
id: timeTxt
anchors.right: roundTxt.left
anchors.rightMargin: 12
color: "#F0E5DA"
font.pixelSize: 18
font.family: fontLibian.name
style: Text.Outline
styleColor: "#3D2D1C"
}
Timer {
interval: 1000
running: roomScene.isStarted
repeat: true
onTriggered: {
playedTime++;
timeTxt.text = getTimeString(playedTime);
}
}
Image {
id: deckImg
anchors.top: timeTxt.bottom
anchors.topMargin: 8
anchors.right: parent.right
anchors.rightMargin: 12
source: SkinBank.CARD_DIR + "card-back"
width: 32
height: 42
}
Text {
anchors.centerIn: deckImg
font.family: fontLibian.name
font.pixelSize: 32
color: "white"
style: Text.Outline
text: pileNum.toString()
}
}