This commit is contained in:
xiekaidong 2023-04-26 18:12:52 +08:00
commit a9cd35f3c4
2 changed files with 44 additions and 22 deletions

View File

@ -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,30 +79,54 @@ 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
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()

View File

@ -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)