Merge branch 'fang/anim' into dev

This commit is contained in:
Fang 2023-06-05 18:30:49 +08:00
commit bbcc762928

View File

@ -197,10 +197,13 @@ function BattleResultUI:initGoldPig()
local uiMap = self.root:genAllChildren()
self.goldPigRoot = uiMap["battle_result_ui.gold_pig"]
self.goldPigRoot:setVisible(false)
self.goldPigGem = uiMap["battle_result_ui.gold_pig.gem_bg"]
self.goldPigGemTx = uiMap["battle_result_ui.gold_pig.gem_bg.gem_tx"]
self.goldPigGemImg = uiMap["battle_result_ui.gold_pig.gem_bg.gem_img"]
self.goldPigGemSliderComp = uiMap["battle_result_ui.gold_pig.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.goldPigGemSliderTx = uiMap["battle_result_ui.gold_pig.slider_bg.text"]
self.goldPigSpine = uiMap["battle_result_ui.gold_pig.spine_pig"]
self.canvasGroupPigGem = self.goldPigGem:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
end
function BattleResultUI:tryShowGoldPig()
@ -219,6 +222,17 @@ function BattleResultUI:tryShowGoldPig()
if lastGemCount > currGemCount then
lastGemCount = currGemCount
end
if self.animPig == nil then
self.animPig = self.root:createBindTweenSequence()
self.animPig:Insert(0, self.canvasGroupPigGem:DOFade(0, 0))
self.animPig:Insert(1.5, self.canvasGroupPigGem:DOFade(1, 0.3))
self.animPig:SetAutoKill(false)
else
self.animPig:Restart()
end
self.goldPigSpine:playAnimComplete("idle1", false, false, function()
self.goldPigSpine:playAnim("idle2", true, false)
end)
self.goldPigGemTx:setText("+" .. currGemCount - lastGemCount)
GFunc.centerImgAndTx(self.goldPigGemImg, self.goldPigGemTx, 0, -4)
if currGemCount > lastGemCount then