【动画】神将切换动画优化

gaoxin 2021-12-31 01:45:13 +08:00
parent 26dc765925
commit 17394f79a0
3 changed files with 35 additions and 10 deletions

View File

@ -408,9 +408,13 @@ function HandBookHeroInfoPanel:RightBtnOnClick()
this.leftLiveObj = nil this.leftLiveObj = nil
end end
this.curLiveObj.transform:SetParent(self.leftObj.transform) this.curLiveObj.transform:SetParent(self.leftObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.Position[1],oldIndexConfigData.Position[2]), 0.5, false):SetEase(Ease.Linear) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.Position[1],oldIndexConfigData.Position[2]), 0.5, false):SetEase(Ease.Linear)
this.rightLiveObj.transform:SetParent(self.curObj.transform) this.rightLiveObj.transform:SetParent(this.curObj.transform)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.Position[1],rightHeroData.Position[2]), 0.5, false):OnComplete(function () this.rightLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(rightHeroData.Position[1]+200,rightHeroData.Position[2])
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.Position[1],rightHeroData.Position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
this:UpdateLiveList() this:UpdateLiveList()
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj)
@ -449,9 +453,13 @@ function HandBookHeroInfoPanel:LeftBtnOnClick()
this.rightLiveObj = nil this.rightLiveObj = nil
end end
this.curLiveObj.transform:SetParent(self.rightObj.transform) this.curLiveObj.transform:SetParent(self.rightObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.Position[1],oldIndexConfigData.Position[2]), 0.5, false):SetEase(Ease.Linear) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.Position[1],oldIndexConfigData.Position[2]), 0.5, false):SetEase(Ease.Linear)
this.leftLiveObj.transform:SetParent(self.curObj.transform) this.leftLiveObj.transform:SetParent(this.curObj.transform)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.Position[1],leftHeroData.Position[2]), 0.5, false):OnComplete(function () this.leftLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(leftHeroData.Position[1]-200,leftHeroData.Position[2])
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.Position[1],leftHeroData.Position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
this:UpdateLiveList() this:UpdateLiveList()
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj)

View File

@ -428,9 +428,13 @@ function HeroLikeAbilityPanel:RightBtnOnClick()
self.leftLiveObj = nil self.leftLiveObj = nil
end end
self.curLiveObj.transform:SetParent(self.leftObj.transform) self.curLiveObj.transform:SetParent(self.leftObj.transform)
self.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector3.New(curHeroData.Position[1],curHeroData.Position[2],0), 0.5, false):SetEase(Ease.Linear) self.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
self.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(curHeroData.Position[1],curHeroData.Position[2]), 0.5, false):SetEase(Ease.Linear)
self.rightLiveObj.transform:SetParent(self.curObj.transform) self.rightLiveObj.transform:SetParent(self.curObj.transform)
self.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector3.New(rightHeroData.Position[1],rightHeroData.Position[2],0), 0.5, false):OnComplete(function () self.rightLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(rightHeroData.Position[1]+200,rightHeroData.Position[2])
self.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
self.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
self.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.Position[1],rightHeroData.Position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
lastindex = curindex lastindex = curindex
leftHeroData = herosDatas[lastindex] leftHeroData = herosDatas[lastindex]
curindex = nextindex curindex = nextindex
@ -478,9 +482,13 @@ function HeroLikeAbilityPanel:LeftBtnOnClick()
self.rightLiveObj = nil self.rightLiveObj = nil
end end
self.curLiveObj.transform:SetParent(self.rightObj.transform) self.curLiveObj.transform:SetParent(self.rightObj.transform)
self.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector3.New(curHeroData.Position[1],curHeroData.Position[2],0), 0.5, false):SetEase(Ease.Linear) self.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
self.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(curHeroData.Position[1],curHeroData.Position[2]), 0.5, false):SetEase(Ease.Linear)
self.leftLiveObj.transform:SetParent(self.curObj.transform) self.leftLiveObj.transform:SetParent(self.curObj.transform)
self.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector3.New(leftHeroData.Position[1],leftHeroData.Position[2],0), 0.5, false):OnComplete(function () self.leftLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(leftHeroData.Position[1]-200,leftHeroData.Position[2])
self.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
self.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
self.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.Position[1],leftHeroData.Position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
nextindex = curindex nextindex = curindex
rightHeroData = herosDatas[nextindex] rightHeroData = herosDatas[nextindex]
curindex = lastindex curindex = lastindex

View File

@ -399,9 +399,13 @@ function this:RightBtnOnClick()
this.leftLiveObj = nil this.leftLiveObj = nil
end end
this.curLiveObj.transform:SetParent(this.leftObj.transform) this.curLiveObj.transform:SetParent(this.leftObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
this.rightLiveObj.transform:SetParent(this.curObj.transform) this.rightLiveObj.transform:SetParent(this.curObj.transform)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function () this.rightLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(rightHeroData.position[1]+200,rightHeroData.position[2])
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
this:UpdateLiveList() this:UpdateLiveList()
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj)
@ -458,14 +462,19 @@ function this:LeftBtnOnClick()
local oldIndexConfigData = heroDatas[index] local oldIndexConfigData = heroDatas[index]
index = (index - 1 > 0 and index - 1 or #heroDatas) index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index] curHeroData = heroDatas[index]
-- 卸载右侧角色
if this.rightLiveObj then if this.rightLiveObj then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj) poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
this.rightLiveObj = nil this.rightLiveObj = nil
end end
this.curLiveObj.transform:SetParent(this.rightObj.transform) this.curLiveObj.transform:SetParent(this.rightObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
this.leftLiveObj.transform:SetParent(this.curObj.transform) this.leftLiveObj.transform:SetParent(this.curObj.transform)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.5, false):OnComplete(function () this.leftLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(leftHeroData.position[1]-200,leftHeroData.position[2])
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.3, false):SetDelay(0.2):OnComplete(function ()
this:UpdateLiveList() this:UpdateLiveList()
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj)