Merge branch 'fang/victory_anim' into dev

This commit is contained in:
Fang 2023-06-05 17:17:50 +08:00
commit 2b9970188d
2 changed files with 53 additions and 10 deletions

View File

@ -70,10 +70,10 @@ end
function BattleResultUI:refreshFixedInfo()
local uiMap = self.root:genAllChildren()
local icon = uiMap["battle_result_ui.icon"]
local desc1 = uiMap["battle_result_ui.desc_1"]
local desc2 = uiMap["battle_result_ui.desc_2"]
local desc3 = uiMap["battle_result_ui.desc_3"]
local icon = uiMap["battle_result_ui.unit_node.icon"]
local desc1 = uiMap["battle_result_ui.unit_node.desc_1"]
local desc2 = uiMap["battle_result_ui.unit_node.desc_2"]
local desc3 = uiMap["battle_result_ui.unit_node.desc_3"]
local rewardTitle = uiMap["battle_result_ui.reward_node.reward_title"]
local continue = uiMap["battle_result_ui.continue"]
desc1:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_4))
@ -90,12 +90,13 @@ function BattleResultUI:refreshVictoryNode()
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.unit_node.report_img_v"]:setVisible(true)
uiMap["battle_result_ui.defeat_node.unit_node.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)
end)
self:refreshUnitNodeAnim(uiMap["battle_result_ui.victory_node.unit_node"])
end
function BattleResultUI:refreshDefeatNode()
@ -104,10 +105,30 @@ function BattleResultUI:refreshDefeatNode()
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.victory_node.unit_node.report_img_v"]:setVisible(false)
uiMap["battle_result_ui.defeat_node.unit_node.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)
self:refreshUnitNodeAnim(uiMap["battle_result_ui.defeat_node.unit_node"])
end
function BattleResultUI:refreshUnitNodeAnim(parent)
local uiMap = self.root:genAllChildren()
uiMap["battle_result_ui.unit_node"]:setParent(parent, true)
local canvasNodeUnit = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
if self.animUnit == nil then
self.animUnit = self.root:createBindTweenSequence()
self.animUnit:Insert(0, canvasNodeUnit:DOFade(0, 0))
self.animUnit:Insert(0.1, canvasNodeUnit:DOFade(1, 0))
self.animUnit:Insert(0, parent:getTransform():DOScale(0, 0))
self.animUnit:Insert(0.1, parent:getTransform():DOScale(0.35, 0))
self.animUnit:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16))
self.animUnit:Insert(0.26, parent:getTransform():DOScale(1, 0.14))
self.animUnit:SetAutoKill(false)
else
self.animUnit:Restart()
end
end
function BattleResultUI:refreshRewards()
@ -126,6 +147,7 @@ function BattleResultUI:refreshRewards()
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.rewards[index])
cell:showAppearAnim(index)
cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
end)
self.scrollRectComp:setFadeArgs(0.05, 0.3)
@ -150,7 +172,7 @@ function BattleResultUI:refreshRewards()
scrollRect:setSizeDeltaX(112*rewardCount)
end
end
self.scrollRectComp:refillCells(rewardCount, true)
self.scrollRectComp:refillCells(rewardCount)
end
function BattleResultUI:refreshUnitInfo()
@ -158,7 +180,7 @@ function BattleResultUI:refreshUnitInfo()
if not self.unitResultReportCells then
self.unitResultReportCells = {}
for index = 1, 5 do
self.unitResultReportCells[index] = CellManager:addCellComp(uiMap["battle_result_ui.unit_result_report_cell_" .. index], UNIT_RESULT_RERPORT_CELL)
self.unitResultReportCells[index] = CellManager:addCellComp(uiMap["battle_result_ui.unit_node.unit_result_report_cell_" .. index], UNIT_RESULT_RERPORT_CELL)
end
end

View File

@ -20,6 +20,7 @@ function RewardCell:init()
ModuleManager.TipsManager:showRewardTips(self.rewardId, self.rewardType, self.baseObject)
end
end)
self.canvasGroup = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
end
function RewardCell:refresh(reward)
@ -155,4 +156,24 @@ function RewardCell:showRightUpIcon(show, atlas, iconName)
self.rightUpIcon:setSprite(atlas, iconName)
end
-- 展示结算奖励的出现动画
function RewardCell:showAppearAnim(idx)
local selfObj = self.baseObject
local delay = (idx - 1) * 0.05
local scaleX = self.baseObject:fastGetLocalScale()
if self.animAppear == nil then
self.animAppear = selfObj:createBindTweenSequence()
self.animAppear:Insert(0, self.canvasGroup:DOFade(0, 0))
self.animAppear:Insert(0, selfObj:getTransform():DOScale(scaleX * 0.6, 0))
self.animAppear:Insert(0.3 + delay, selfObj:getTransform():DOScale(scaleX * 1.1, 0.1))
self.animAppear:Insert(0.3 + delay, self.canvasGroup:DOFade(1, 0.1))
self.animAppear:Insert(0.4 + delay, selfObj:getTransform():DOScale(scaleX * 1, 0.13))
self.animAppear:SetAutoKill(false)
else
self.animAppear:Restart()
end
end
return RewardCell