From 5b43ae2f27aa3a38ffc98aa25cf8e2678af03f45 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 26 Apr 2023 16:01:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_result_ui.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 3deb90c8..34b2617f 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -65,10 +65,12 @@ end function BattleResultUI:refreshVictoryNode() local uiMap = self.root:genAllChildren() - uiMap["battle_result_ui.mask_v"]:setActive(true) - uiMap["battle_result_ui.mask_d"]:setActive(false) - uiMap["battle_result_ui.defeat_node"]:setActive(false) - uiMap["battle_result_ui.victory_node"]:setActive(true) + uiMap["battle_result_ui.mask_v"]:setVisible(true) + uiMap["battle_result_ui.mask_d"]:setVisible(false) + uiMap["battle_result_ui.defeat_node"]:setVisible(false) + uiMap["battle_result_ui.victory_node"]:setVisible(true) + uiMap["battle_result_ui.report_img_v"]:setVisible(true) + uiMap["battle_result_ui.report_img_d"]:setVisible(false) uiMap["battle_result_ui.victory_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5)) uiMap["battle_result_ui.victory_node.ui_spine_obj"]:playAnimComplete("born", true, true, function() uiMap["battle_result_ui.victory_node.ui_spine_obj"]:playAnim("idle", true, true) @@ -77,10 +79,12 @@ end function BattleResultUI:refreshDefeatNode() local uiMap = self.root:genAllChildren() - uiMap["battle_result_ui.mask_v"]:setActive(true) - uiMap["battle_result_ui.mask_d"]:setActive(false) - uiMap["battle_result_ui.defeat_node"]:setActive(true) - uiMap["battle_result_ui.victory_node"]:setActive(false) + uiMap["battle_result_ui.mask_v"]:setVisible(false) + uiMap["battle_result_ui.mask_d"]:setVisible(true) + uiMap["battle_result_ui.defeat_node"]:setVisible(true) + uiMap["battle_result_ui.victory_node"]:setVisible(false) + uiMap["battle_result_ui.report_img_v"]:setVisible(false) + uiMap["battle_result_ui.report_img_d"]:setVisible(true) uiMap["battle_result_ui.defeat_node.title_bg.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_6)) uiMap["battle_result_ui.defeat_node.ui_spine_obj"]:playAnim("idle", false, true) end From 5ac0c46c82359eec49cdc77ce3a6b69fbfea18e1 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 26 Apr 2023 16:58:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_result_ui.lua | 36 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index 34b2617f..c8d0a314 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -90,21 +90,43 @@ function BattleResultUI:refreshDefeatNode() end function BattleResultUI:refreshRewards() - if self.scrollRect then - self.scrollRect:updateAllCell() + if self.scrollRectComp then + self.scrollRectComp:updateAllCell() return end local uiMap = self.root:genAllChildren() - self.scrollRect = uiMap["battle_result_ui.scroll_rect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) - self.scrollRect:addInitCallback(function() + local scrollRect = uiMap["battle_result_ui.scroll_rect"] + self.scrollRectComp = scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.scrollRectComp:addInitCallback(function() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL end) - self.scrollRect:addRefreshCallback(function(index, cell) + self.scrollRectComp:addRefreshCallback(function(index, cell) cell:refresh(self.rewards[index]) end) - self.scrollRect:clearCells() - self.scrollRect:refillCells(#self.rewards) + self.scrollRectComp:setFadeArgs(0.05, 0.3) + self.scrollRectComp:clearCells() + local rewardCount = #self.rewards + if rewardCount > 10 then + local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT) + comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic + self.scrollRectComp:setPerLineNum(5) + scrollRect:setSizeDeltaX(560) + else + local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT) + comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Clamped + if rewardCount >= 5 then + self.scrollRectComp:setPerLineNum(5) + scrollRect:setSizeDeltaX(560) + elseif rewardCount <= 0 then + self.scrollRectComp:setPerLineNum(1) + scrollRect:setSizeDeltaX(560) + else + self.scrollRectComp:setPerLineNum(rewardCount) + scrollRect:setSizeDeltaX(112*rewardCount) + end + end + self.scrollRectComp:refillCells(rewardCount, true) end function BattleResultUI:refreshUnitInfo() From eb6cbe169f18918131c842a90888b76a6ace88e8 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 26 Apr 2023 18:07:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=88=98=E6=96=97buff=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_ui.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 9a061920..22e63a7b 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -145,7 +145,6 @@ function BattleUI:initBuff() self.uiMap["battle_ui.top_node.buff_l.buff_2"], self.uiMap["battle_ui.top_node.buff_l.buff_3"], self.uiMap["battle_ui.top_node.buff_l.buff_4"], - self.uiMap["battle_ui.top_node.buff_l.buff_5"], } for k, v in ipairs(self.atkBuffIconList) do v:addClickListener(function() @@ -158,7 +157,6 @@ function BattleUI:initBuff() self.uiMap["battle_ui.top_node.buff_l.text_2"], self.uiMap["battle_ui.top_node.buff_l.text_3"], self.uiMap["battle_ui.top_node.buff_l.text_4"], - self.uiMap["battle_ui.top_node.buff_l.text_5"], } for k, v in ipairs(self.atkBuffTextList) do v:setText(GConst.EMPTY_STRING) @@ -168,7 +166,6 @@ function BattleUI:initBuff() self.uiMap["battle_ui.top_node.buff_r.buff_2"], self.uiMap["battle_ui.top_node.buff_r.buff_3"], self.uiMap["battle_ui.top_node.buff_r.buff_4"], - self.uiMap["battle_ui.top_node.buff_r.buff_5"], } for k, v in ipairs(self.defBuffIconList) do v:addClickListener(function() @@ -181,7 +178,6 @@ function BattleUI:initBuff() self.uiMap["battle_ui.top_node.buff_r.text_2"], self.uiMap["battle_ui.top_node.buff_r.text_3"], self.uiMap["battle_ui.top_node.buff_r.text_4"], - self.uiMap["battle_ui.top_node.buff_r.text_5"], } for k, v in ipairs(self.defBuffTextList) do v:setText(GConst.EMPTY_STRING) @@ -326,9 +322,9 @@ function BattleUI:showBuffTips(buffList) descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate() local height = descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedHeight if height > 30 then - addY = addY + 46 + height - 30 + addY = addY + 56 + height - 30 else - addY = addY + 46 + addY = addY + 56 end index = index + 1 end @@ -336,7 +332,7 @@ function BattleUI:showBuffTips(buffList) for i = index, #self.battleBuffTipsBuffList do self.battleBuffTipsBuffList[i]:setLocalScale(0, 0, 0) end - self.battleBuffTipsBg:setSizeDeltaY(addY + 20) + self.battleBuffTipsBg:setSizeDeltaY(addY + 10) end function BattleUI:getBattleBuffTipsObj(index)