From efe78811f705ed9b12c2fd6d61787cc855e8704f Mon Sep 17 00:00:00 2001 From: YoumuKon <38815081+YoumuKon@users.noreply.github.com> Date: Sun, 27 Aug 2023 19:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E7=A7=8Dbugfix(=E4=BA=A1=E7=BE=8A?= =?UTF-8?q?=E8=A1=A5=E7=89=A2=E7=89=88)=20(#258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复了getSuitCompletedString不提前翻译内容的bug - 修复了死人算距离时的报错 - 为武将卡堆了detailed属性,用以控制武将牌其他信息是否可见 --- Fk/RoomElement/GeneralCardItem.qml | 11 ++++++++--- lua/core/card.lua | 2 +- lua/core/player.lua | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Fk/RoomElement/GeneralCardItem.qml b/Fk/RoomElement/GeneralCardItem.qml index 7ed4535b..0b0610cf 100644 --- a/Fk/RoomElement/GeneralCardItem.qml +++ b/Fk/RoomElement/GeneralCardItem.qml @@ -23,6 +23,7 @@ CardItem { property int maxHp property int shieldNum property string pkgName: "" + property bool detailed: true name: "" // description: Sanguosha.getGeneralDescription(name) suit: "" @@ -39,18 +40,21 @@ CardItem { scale: subkingdom ? 0.6 : 1 transformOrigin: Item.TopLeft source: SkinBank.getGeneralCardDir(kingdom) + kingdom + visible: detailed } Image { scale: 0.6; x: 9; y: 12 transformOrigin: Item.TopLeft source: subkingdom ? SkinBank.getGeneralCardDir(subkingdom) + subkingdom : "" + visible: detailed } Row { x: 34 y: 4 spacing: 1 + visible: detailed Repeater { id: hpRepeater model: (hp > 5 || hp !== maxHp) ? 1 : hp @@ -94,6 +98,7 @@ CardItem { } Shield { + visible: detailed anchors.right: parent.right anchors.top: parent.top anchors.topMargin: hpRepeater.model > 4 ? 16 : 0 @@ -107,7 +112,7 @@ CardItem { x: 2 y: lineCount > 6 ? 30 : 34 text: Backend.translate(name) - visible: Backend.translate(name).length <= 6 + visible: Backend.translate(name).length <= 6 && detailed color: "white" font.family: fontLibian.name font.pixelSize: 18 @@ -122,7 +127,7 @@ CardItem { rotation: 90 transformOrigin: Item.BottomLeft text: Backend.translate(name) - visible: Backend.translate(name).length > 6 + visible: Backend.translate(name).length > 6 && detailed color: "white" font.family: fontLibian.name font.pixelSize: 18 @@ -130,7 +135,7 @@ CardItem { } Rectangle { - visible: pkgName !== "" + visible: pkgName !== "" && detailed height: 16 width: childrenRect.width + 4 anchors.bottom: parent.bottom diff --git a/lua/core/card.lua b/lua/core/card.lua index 42eac902..908b754a 100644 --- a/lua/core/card.lua +++ b/lua/core/card.lua @@ -346,7 +346,7 @@ end ---@param symbol boolean @ 是否以符号形式显示花色 ---@return string @ 完整点数(字符串) function Card:getSuitCompletedString(symbol) - return self:getSuitString(symbol) .. getNumberStr(self.number) + return Fk:translate(self:getSuitString(symbol)) .. getNumberStr(self.number) end --- 判断卡牌是否为普通锦囊牌 diff --git a/lua/core/player.lua b/lua/core/player.lua index 28dcb81b..6f9e3acc 100644 --- a/lua/core/player.lua +++ b/lua/core/player.lua @@ -492,7 +492,7 @@ function Player:distanceTo(other, mode, ignore_dead) mode = mode or "both" if other == self then return 0 end if not ignore_dead and other.dead then - print(other.name .. " is dead!") + print(other.general .. " is dead!") return -1 end if self:isRemoved() or other:isRemoved() then