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

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

View File

@ -300,10 +300,9 @@ function this:RightBtnOnClick()
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:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
this:UpdateHeroInfoData()
this:UpdateLiveList()
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj)
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.leftObj.transform)
@ -314,6 +313,8 @@ function this:RightBtnOnClick()
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.rightBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
-- 更新显示,以及拖动组件目标
this:UpdateHeroInfoData()
end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.heroConfig)
end
@ -328,6 +329,7 @@ function this:LeftBtnOnClick()
local oldIndexConfigData = heroDatas[index]
index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index]
--
if this.rightLiveObj then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
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.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:UpdateLiveList()
this:UpdateHeroInfoData()
-- 更新数据
this:UpdateLiveList()
-- 销毁
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj)
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.rightObj.transform)
-- 创建新的live
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj)
this.curLiveObj = this.leftLiveObj
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj)
-- 播放一次动画
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.leftBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
-- 更新显示,以及拖动组件目标
this:UpdateHeroInfoData()
end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.heroConfig)
end
@ -466,56 +473,56 @@ function this:UpdateHeroInfoData()
this:OnPageTabChange(_CurPageIndex)
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock
if teamHero[curHeroData.dynamicId] then
isUpZhen = true
this.equipBtnRedPoint:SetActive(#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 0)
this.talismanBtnRedPoint:SetActive(HeroManager.GetIsShowTalismanRedPoint(curHeroData))
this.soulPrintBtnRedPoint:SetActive(HeroManager.GetIsShowSoulPrintRedPoint(curHeroData))
else
isUpZhen = false
this.equipBtnRedPoint:SetActive(false)
this.talismanBtnRedPoint:SetActive(false)
this.soulPrintBtnRedPoint:SetActive(false)
if teamHero[curHeroData.dynamicId] then
isUpZhen = true
this.equipBtnRedPoint:SetActive(#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 0)
this.talismanBtnRedPoint:SetActive(HeroManager.GetIsShowTalismanRedPoint(curHeroData))
this.soulPrintBtnRedPoint:SetActive(HeroManager.GetIsShowSoulPrintRedPoint(curHeroData))
else
isUpZhen = false
this.equipBtnRedPoint:SetActive(false)
this.talismanBtnRedPoint:SetActive(false)
this.soulPrintBtnRedPoint:SetActive(false)
end
--角色定位按钮
this.posBtn.gameObject:SetActive(curHeroData.heroConfig.ShowHeroLocation==1)
--法宝按钮逻辑
this.talismanBtn.gameObject:SetActive(TalismanManager.CheckTalismanIsInConfig(curHeroData))
if TalismanManager.CheckTalismanIsInConfig(curHeroData) then
talismanIsOpen = TalismanManager.GetCurHeroIsOpenTalisman(curHeroData)
this.talismanInfo.gameObject:SetActive(not talismanIsOpen)
Util.SetGray(this.talismanClick, not talismanIsOpen)
Util.GetGameObject(this.talismanClick.transform, "lock"):SetActive(not talismanIsOpen)
if not talismanIsOpen then
Util.GetGameObject(this.talismanClick, "lock/Text"):GetComponent("Text").text = TalismanManager.GetCurHeroIsOpenTalismanStr()
end
--角色定位按钮
this.posBtn.gameObject:SetActive(curHeroData.heroConfig.ShowHeroLocation==1)
--法宝按钮逻辑
this.talismanBtn.gameObject:SetActive(TalismanManager.CheckTalismanIsInConfig(curHeroData))
if TalismanManager.CheckTalismanIsInConfig(curHeroData) then
talismanIsOpen = TalismanManager.GetCurHeroIsOpenTalisman(curHeroData)
this.talismanInfo.gameObject:SetActive(not talismanIsOpen)
Util.SetGray(this.talismanClick, not talismanIsOpen)
Util.GetGameObject(this.talismanClick.transform, "lock"):SetActive(not talismanIsOpen)
if not talismanIsOpen then
Util.GetGameObject(this.talismanClick, "lock/Text"):GetComponent("Text").text = TalismanManager.GetCurHeroIsOpenTalismanStr()
end
end
--魂印按钮逻辑
if curHeroData.heroConfig.RankupConsumeMaterial then
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and (#curHeroData.heroConfig.RankupConsumeMaterial + curHeroData.heroConfig.Star) >= EquipSignUnlock[2][2])
else
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and curHeroData.heroConfig.Star >= EquipSignUnlock[2][2])
end
end
--魂印按钮逻辑
if curHeroData.heroConfig.RankupConsumeMaterial then
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and (#curHeroData.heroConfig.RankupConsumeMaterial + curHeroData.heroConfig.Star) >= EquipSignUnlock[2][2])
else
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and curHeroData.heroConfig.Star >= EquipSignUnlock[2][2])
end
if this.curLiveObj then
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
else
this.dragView.gameObject:SetActive(false)
end
if this.curLiveObj then
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
else
this.dragView.gameObject:SetActive(false)
end
local starSize = Vector2.New(60,60)
SetHeroStars(this.starGrid, curHeroData.star,2,starSize,-10,Vector2.New(0.5,0.5))
this.posImage.sprite =Util.LoadSprite(curHeroData.professionIcon)
this.posText.text = GetJobStrByJobNum(curHeroData.profession)
this.heroName.text = curHeroData.name
this.profession.sprite =Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
--定位描述相关
this.posBgImage.sprite=Util.LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posImage.sprite=Util.LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.posText.text=curHeroData.heroConfig.HeroLocation
this.unlockImage:SetActive(curHeroData.lockState == 0)
this.lockImage:SetActive(curHeroData.lockState == 1)
local starSize = Vector2.New(60,60)
SetHeroStars(this.starGrid, curHeroData.star,2,starSize,-10,Vector2.New(0.5,0.5))
this.posImage.sprite =Util.LoadSprite(curHeroData.professionIcon)
this.posText.text = GetJobStrByJobNum(curHeroData.profession)
this.heroName.text = curHeroData.name
this.profession.sprite =Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
--定位描述相关
this.posBgImage.sprite=Util.LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posImage.sprite=Util.LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.posText.text=curHeroData.heroConfig.HeroLocation
this.unlockImage:SetActive(curHeroData.lockState == 0)
this.lockImage:SetActive(curHeroData.lockState == 1)
--魂印
soulPrintIsOpen=SoulPrintManager.GetSoulPrintIsOpen(curHeroData)
Util.GetGameObject(this.soulPrintBtn, "lock"):SetActive(not soulPrintIsOpen)