各种bugfix(亡羊补牢版) (#258)

- 修复了getSuitCompletedString不提前翻译内容的bug
- 修复了死人算距离时的报错
- 为武将卡堆了detailed属性,用以控制武将牌其他信息是否可见
This commit is contained in:
YoumuKon 2023-08-27 19:48:15 +08:00 committed by GitHub
parent 7761aff053
commit efe78811f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -23,6 +23,7 @@ CardItem {
property int maxHp property int maxHp
property int shieldNum property int shieldNum
property string pkgName: "" property string pkgName: ""
property bool detailed: true
name: "" name: ""
// description: Sanguosha.getGeneralDescription(name) // description: Sanguosha.getGeneralDescription(name)
suit: "" suit: ""
@ -39,18 +40,21 @@ CardItem {
scale: subkingdom ? 0.6 : 1 scale: subkingdom ? 0.6 : 1
transformOrigin: Item.TopLeft transformOrigin: Item.TopLeft
source: SkinBank.getGeneralCardDir(kingdom) + kingdom source: SkinBank.getGeneralCardDir(kingdom) + kingdom
visible: detailed
} }
Image { Image {
scale: 0.6; x: 9; y: 12 scale: 0.6; x: 9; y: 12
transformOrigin: Item.TopLeft transformOrigin: Item.TopLeft
source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom : "" source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom : ""
visible: detailed
} }
Row { Row {
x: 34 x: 34
y: 4 y: 4
spacing: 1 spacing: 1
visible: detailed
Repeater { Repeater {
id: hpRepeater id: hpRepeater
model: (hp > 5 || hp !== maxHp) ? 1 : hp model: (hp > 5 || hp !== maxHp) ? 1 : hp
@ -94,6 +98,7 @@ CardItem {
} }
Shield { Shield {
visible: detailed
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: hpRepeater.model > 4 ? 16 : 0 anchors.topMargin: hpRepeater.model > 4 ? 16 : 0
@ -107,7 +112,7 @@ CardItem {
x: 2 x: 2
y: lineCount > 6 ? 30 : 34 y: lineCount > 6 ? 30 : 34
text: Backend.translate(name) text: Backend.translate(name)
visible: Backend.translate(name).length <= 6 visible: Backend.translate(name).length <= 6 && detailed
color: "white" color: "white"
font.family: fontLibian.name font.family: fontLibian.name
font.pixelSize: 18 font.pixelSize: 18
@ -122,7 +127,7 @@ CardItem {
rotation: 90 rotation: 90
transformOrigin: Item.BottomLeft transformOrigin: Item.BottomLeft
text: Backend.translate(name) text: Backend.translate(name)
visible: Backend.translate(name).length > 6 visible: Backend.translate(name).length > 6 && detailed
color: "white" color: "white"
font.family: fontLibian.name font.family: fontLibian.name
font.pixelSize: 18 font.pixelSize: 18
@ -130,7 +135,7 @@ CardItem {
} }
Rectangle { Rectangle {
visible: pkgName !== "" visible: pkgName !== "" && detailed
height: 16 height: 16
width: childrenRect.width + 4 width: childrenRect.width + 4
anchors.bottom: parent.bottom anchors.bottom: parent.bottom

View File

@ -346,7 +346,7 @@ end
---@param symbol boolean @ 是否以符号形式显示花色 ---@param symbol boolean @ 是否以符号形式显示花色
---@return string @ 完整点数(字符串) ---@return string @ 完整点数(字符串)
function Card:getSuitCompletedString(symbol) function Card:getSuitCompletedString(symbol)
return self:getSuitString(symbol) .. getNumberStr(self.number) return Fk:translate(self:getSuitString(symbol)) .. getNumberStr(self.number)
end end
--- 判断卡牌是否为普通锦囊牌 --- 判断卡牌是否为普通锦囊牌

View File

@ -492,7 +492,7 @@ function Player:distanceTo(other, mode, ignore_dead)
mode = mode or "both" mode = mode or "both"
if other == self then return 0 end if other == self then return 0 end
if not ignore_dead and other.dead then if not ignore_dead and other.dead then
print(other.name .. " is dead!") print(other.general .. " is dead!")
return -1 return -1
end end
if self:isRemoved() or other:isRemoved() then if self:isRemoved() or other:isRemoved() then