结算界面

This commit is contained in:
chenxi 2023-04-26 16:58:44 +08:00
parent 5b43ae2f27
commit 5ac0c46c82

View File

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