【角色信息】修复角色信息界面滑动立绘报错的问题

gaoxin 2020-11-06 16:54:38 +08:00
parent 39e8e1f894
commit 3baf785576
1 changed files with 60 additions and 53 deletions

View File

@ -301,9 +301,8 @@ function this:RightBtnOnClick()
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"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList() this:UpdateLiveList()
this:UpdateHeroInfoData()
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil this.curLiveObj = nil
end end
Util.ClearChild(this.leftObj.transform) Util.ClearChild(this.leftObj.transform)
@ -314,6 +313,8 @@ function this:RightBtnOnClick()
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.rightBtn:GetComponent("Button").enabled = true this.rightBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true isClickLeftOrRightBtn = true
-- 更新显示,以及拖动组件目标
this:UpdateHeroInfoData()
end):SetEase(Ease.Linear) end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.heroConfig) this:SetPanelBg(curHeroData.heroConfig)
end end
@ -328,6 +329,7 @@ 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
@ -336,20 +338,25 @@ function this:LeftBtnOnClick()
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"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.5, false):OnComplete(function ()
-- 更新数据
this:UpdateLiveList() this:UpdateLiveList()
this:UpdateHeroInfoData() -- 销毁
if this.curLiveObj then if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj) poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil this.curLiveObj = nil
end end
Util.ClearChild(this.rightObj.transform) Util.ClearChild(this.rightObj.transform)
-- 创建新的live
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj) this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj)
this.curLiveObj = this.leftLiveObj this.curLiveObj = this.leftLiveObj
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj) this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj)
-- 播放一次动画
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.leftBtn:GetComponent("Button").enabled = true this.leftBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true isClickLeftOrRightBtn = true
-- 更新显示,以及拖动组件目标
this:UpdateHeroInfoData()
end):SetEase(Ease.Linear) end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.heroConfig) this:SetPanelBg(curHeroData.heroConfig)
end end