显示fix

This commit is contained in:
Fang 2023-06-21 15:17:14 +08:00
parent 68f9a47e00
commit f47a35f2e7
2 changed files with 14 additions and 0 deletions

View File

@ -1355,6 +1355,18 @@ function GFunc.centerImgAndTx(imgObj, txObj, spacing, offset)
txObj:setAnchoredPositionX(w - txW / 2 + offset) txObj:setAnchoredPositionX(w - txW / 2 + offset)
end end
-- centerImgAndTx的位置反向版本
function GFunc.centerTxAndImg(txObj, imgObj, spacing, offset)
spacing = spacing or 0
offset = offset or 0
local imgW = imgObj:getSizeDelta().x
local txW = txObj:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
txObj:setSizeDeltaX(txW)
local w = (imgW + txW + spacing) / 2
txObj:setAnchoredPositionX(txW / 2 - w + offset)
imgObj:setAnchoredPositionX(w - imgW / 2 + offset)
end
function GFunc.centerTxAndTx(txObj1, txObj2, spacing) function GFunc.centerTxAndTx(txObj1, txObj2, spacing)
spacing = spacing or 0 spacing = spacing or 0
local txW = txObj1:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth local txW = txObj1:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth

View File

@ -138,6 +138,8 @@ function DungeonDifficultyUI:refreshDifficulty()
self.iconBuff:addClickListener(function() self.iconBuff:addClickListener(function()
ModuleManager.TipsManager:showDescTips(GFunc.getBuffDesc(buff.type, buff.num), self.iconBuff) ModuleManager.TipsManager:showDescTips(GFunc.getBuffDesc(buff.type, buff.num), self.iconBuff)
end) end)
GFunc.centerTxAndImg(self.txbuff, self.iconBuff, 5)
else else
self.buffObj:setActive(false) self.buffObj:setActive(false)
end end