require("Base/BasePanel") HandBookHeroInfoPanel = Inherit(BasePanel) local this = HandBookHeroInfoPanel local tabs = { [RoleInfoPanelIndex.qingbao] = {default = "UI_hz_zhonghe01_83", lock = "UI_hz_gonghui_Lock", select = "UI_hz_zhonghe01_82",title = Language[11093], sub = SubUIConfig.HandBookRoleInfoLayout }, [RoleInfoPanelIndex.shenhun] = {default = "UI_hz_zhonghe01_83", lock = "UI_hz_gonghui_Lock", select = "UI_hz_zhonghe01_82",title = "神魂",sub = SubUIConfig.RoleGodSoulLayout }, [RoleInfoPanelIndex.chuanshuo] = {default = "UI_hz_zhonghe01_83", lock = "UI_hz_gonghui_Lock", select = "UI_hz_zhonghe01_82",title = Language[11095], sub = SubUIConfig.RoleStoryLayout }, [RoleInfoPanelIndex.pifu] = {default = "UI_hz_zhonghe01_83", lock = "UI_hz_gonghui_Lock", select = "UI_hz_zhonghe01_82",title = Language[11816], sub = SubUIConfig.HandBookRoleSkinPanel }, } local index = {1,2,3,4,5,6,9,10,11} local heroConFigData local leftHeroData local rightHeroData local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local heroLevelConfig = ConfigManager.GetConfig(ConfigName.HeroLevelConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) local isClickLeftOrRightBtn = true local index=0 local leftIndex=0 local rightIndex=0 local _leftStar=0 local _curStar=0 local _rightStar=0 local heroStar=0 local tabsList = {} local _CurPageIndex = 1 --初始化组件(用于子类重写) function HandBookHeroInfoPanel:InitComponent() this.spLoader = SpriteLoader.New() self.btnBack = Util.GetGameObject(self.transform, "btnBack") this.bgImageList = {} for i = 1, 5 do this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") end self.curObj= Util.GetGameObject(self.transform, "curObj") self.leftObj= Util.GetGameObject(self.transform, "leftObj") self.rightObj= Util.GetGameObject(self.transform, "rightObj") self.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject") self.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject") self.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform) self.dragView.transform:SetSiblingIndex(1) self.starGrid = Util.GetGameObject(self.transform, "info/sartAndLvLayout") self.heroName = Util.GetGameObject(self.transform, "info/nameAndPossLayout/heroName"):GetComponent("Text") self.profession = Util.GetGameObject(self.transform, "info/nameAndPossLayout/bg/proImage"):GetComponent("Image") --定位描述 self.layout=Util.GetGameObject(self.transform,"layout") self.PageList = {} this.trigger=Util.GetEventTriggerListener(self.dragView.gameObject) this.trigger.onBeginDrag = this.trigger.onBeginDrag + this.OnBeginDrag this.trigger.onDrag = this.trigger.onDrag + this.OnDrag this.trigger.onEndDrag = this.trigger.onEndDrag + this.OnEndDrag this.posBtn=Util.GetGameObject(self.gameObject,"btnGrid/posBtn")--定位按钮 this.laiiyuanBtn=Util.GetGameObject(self.gameObject,"btnGrid/laiiyuanBtn")--定位按钮 this.btnList = Util.GetGameObject(self.transform,"btnList") this.btnPre = Util.GetGameObject(self.transform,"btnInfo") this.select = Util.GetGameObject(self.transform, "selectBtn") this.btnMask = Util.GetGameObject(self.transform, "btnMask") this.btnMask.gameObject:SetActive(false) --神魂 this.godSoulBtn=Util.GetGameObject(self.transform,"godSoulBtn") this.godSoulBtnIcon=Util.GetGameObject(this.godSoulBtn,"icon"):GetComponent("Image") self.talismanBtn=Util.GetGameObject(self.gameObject,"TalismanBtn/panel") self.talismanObj=Util.GetGameObject(self.gameObject,"TalismanBtn") --self.talismanIcon=Util.GetGameObject(self.gameObject,"TalismanBtn/Icon"):GetComponent("Image") self.talentBtn=Util.GetGameObject(self.gameObject,"talentBtn/btn") self.talentObj=Util.GetGameObject(self.gameObject,"talentBtn") self.talentProgress=Util.GetGameObject(self.gameObject,"talentBtn/btn/progress"):GetComponent("Text") self.pizhiImg=Util.GetGameObject(self.gameObject,"pizhiImg"):GetComponent("Image") end --绑定事件(用于子类重写) function HandBookHeroInfoPanel:BindEvent() Util.AddOnceClick(this.laiiyuanBtn, function() PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout = true PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 = true UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,heroConFigData.Id) end) Util.AddClick(self.btnBack, function() self:ClosePanel() end) Util.AddClick(this.leftBtn, function() self:LeftBtnOnClick() end) Util.AddClick(this.rightBtn, function() self:RightBtnOnClick() end) Util.AddClick(this.posBtn, function() UIManager.OpenPanel(UIName.RolePosInfoPopup,heroConFigData,heroStar) end) Util.AddClick(this.godSoulBtn,function() UIManager.OpenPanel(UIName.RoleGodSoulLayout,heroConFigData,heroStar) end) end local heroDatas = {} --界面打开时调用(用于子类重写) 第一个参数 英雄数据 第二个参数 属性id local breakId=0 local upStarId=0 local _curLv=0 function HandBookHeroInfoPanel:OnOpen(...) local temp={...} heroDatas = {} heroConFigData = temp[1] if(temp[3]) then _curStar=temp[3] end if(temp[4]) then _curLv=temp[4] end if(temp[5]) then heroStar=temp[5] end _CurPageIndex = RoleInfoPanelIndex.qingbao heroDatas = PlayerManager.heroHandBookListData[_curStar] for i = 1, #heroDatas do if heroConFigData.Id == heroDatas[i].Id then index = i end end end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) function HandBookHeroInfoPanel:OnShow() --先清除之前的立绘 if this.leftLiveObj then poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj) this.leftLiveObj = nil end if this.rightLiveObj then poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj) this.rightLiveObj = nil end if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end Util.ClearChild(self.curObj.transform) Util.ClearChild(self.leftObj.transform) Util.ClearChild(self.rightObj.transform) self:RefreshHeroLive() if PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 then PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout = true PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 = true UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,heroConFigData.Id) end end --刷新英雄界面信息 function HandBookHeroInfoPanel:RefreshHeroLive() self:UpdateLiveList() --加载当前英雄的立绘 this.leftLiveObj = self:LoadHerolive(leftHeroData,self.leftObj) this.rightLiveObj = self:LoadHerolive(rightHeroData,self.rightObj) this.curLiveObj = self:LoadHerolive(heroConFigData,self.curObj) if this.curLiveObj then self.dragView.gameObject:SetActive(false) self.dragView:SetDragGO(this.curLiveObj) else self.dragView.gameObject:SetActive(false) end self:UpdateHeroInfoData() end --刷新左右两边的英雄星级和index function HandBookHeroInfoPanel:UpdateLiveList() local starIndex = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) and 11 or 10 if index - 1 > 0 then _leftStar = _curStar leftIndex = index - 1 leftHeroData=heroDatas[leftIndex] else _leftStar = _curStar + 1 while(not PlayerManager.heroHandBookListData[_leftStar] or #PlayerManager.heroHandBookListData[_leftStar] < 1) do if _leftStar >= starIndex then _leftStar = 0 end _leftStar = _leftStar + 1 end leftIndex = #PlayerManager.heroHandBookListData[_leftStar] leftHeroData = PlayerManager.heroHandBookListData[_leftStar][leftIndex] end if index + 1 <= #heroDatas then _rightStar = _curStar rightIndex = index + 1 rightHeroData=heroDatas[rightIndex] else _rightStar = _curStar - 1 while(not PlayerManager.heroHandBookListData[_rightStar] or #PlayerManager.heroHandBookListData[_rightStar] < 1) do if _rightStar < 1 then _rightStar = starIndex + 1 end _rightStar = _rightStar - 1 end rightIndex = 1 rightHeroData=PlayerManager.heroHandBookListData[_rightStar][rightIndex] end end function HandBookHeroInfoPanel:SetPanelBg(heroData) for i = 1, 5 do if heroData.PropertyName == i then this.bgImageList[i]:SetActive(true) else this.bgImageList[i]:SetActive(false) end end if heroConFigData.MaxRank > 5 then this.laiiyuanBtn.gameObject:SetActive(true) else this.laiiyuanBtn.gameObject:SetActive(false) end end --刷新页签数据 function this:UpdateHeroInfoData() for k,v in pairs(this.PageList) do v:OnHide() end --local starSize = Vector2.New(60,60) --SetHeroStars(this.spLoader, this.starGrid,heroConFigData.MaxRank) local starSize = Vector2.New(60,60) local starScale = -10 local starType=2 if heroConFigData.MaxRank > 11 then starSize = Vector2.New(1.2,1.84) starScale = 7 end SetHeroStars(this.spLoader, this.starGrid,heroConFigData.MaxRank,starType,starSize,starScale) SetParticleSortLayer(this.starGrid,this.sortingOrder+1) this.heroName.text = GetLanguageStrById(heroConFigData.ReadingName) this.profession.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(heroConFigData.PropertyName)) --定位描述相关 heroStar=heroConFigData.MaxRank --self.pizhiImg.sprite=this.spLoader:LoadSprite(GetHeroQualityStr(heroConFigData.Natural)) --self.pizhiImg.sprite=this.spLoader:LoadSprite(GetHeroQualityStr(_curStar)) self.pizhiImg.sprite=this.spLoader:LoadSprite(GetHeroHandBookNaturalImg(heroConFigData.Natural)) self.pizhiImg:SetNativeSize() if _CurPageIndex == RoleInfoPanelIndex.pifu then local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",heroConFigData.Id) local HeoSkin = {} for i = 1 ,#configs do if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then HeoSkin[configs[i].Type] = configs[i] end end if LengthOfTable(HeoSkin) < 2 then _CurPageIndex = RoleInfoPanelIndex.qingbao end elseif _CurPageIndex == RoleInfoPanelIndex.shenhun then if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) and heroConFigData.IsSoulOpen == 1 and heroStar > 10 then _CurPageIndex = RoleInfoPanelIndex.qingbao else _CurPageIndex = RoleInfoPanelIndex.qingbao end end self:SetPanelBg(heroConFigData) self:UpdateBtnList() self:SetSelectBtn(_CurPageIndex) self:OnPageTabChange(_CurPageIndex) this.godSoulBtn.gameObject:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.shenhun) and heroConFigData.IsSoulOpen) --角色定位按钮 this.posBtn.gameObject:SetActive(heroConFigData.ShowHeroLocation==1) this.posBtn.gameObject:SetActive(false) if heroConFigData.EquipTalismana then self.talismanObj.gameObject:SetActive(true) else self.talismanObj.gameObject:SetActive(false) end -- if heroConFigData.EquipTalismana~=nil then -- self.talismanIcon.sprite = this.spLoader:LoadSprite(GetResourcePath(itemConfig[heroConFigData.EquipTalismana[2]].ResourceID)) -- end for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.HeroRankupConfig)) do if v.OpenStar == heroStar and v.Star==heroConFigData.Star then if v.Type == 1 then breakId = v.Id end if v.Type == 2 then upStarId = v.Id end end end if breakId==0 then breakId=6 end --天赋 self.talentBtn:SetActive(true) local talentBtnImage ="r_hero_tianfu_zh" -- heroStar == HeroManager.awakeNextStarIndex and "r_hero_tianfu2_zh" or "r_hero_tianfu1_zh" -- self.talentBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(talentBtnImage) local OpenPassiveSkillRules = heroStar >= HeroManager.awakeNextStarIndex and heroConFigData.Awaken or heroConFigData.OpenPassiveSkillRules OpenPassiveSkillRules=GetPassiveByMaxStar(heroConFigData,OpenPassiveSkillRules) LogError("#OpenPassiveSkillRules=================="..#OpenPassiveSkillRules) if OpenPassiveSkillRules and #OpenPassiveSkillRules>0 then local openlists,compoundOpenNum,compoundNum = HeroManager.GetAllPassiveSkillIds(heroConFigData,breakId,upStarId) self.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum self.talentObj:SetActive(true) else self.talentObj:SetActive(false) end Util.AddOnceClick(self.talentBtn,function() if heroStar==11 then UIManager.OpenPanel(UIName.RoleAwakeTalentPopup,heroConFigData) else UIManager.OpenPanel(UIName.RoleTalentPopup,heroConFigData,breakId,upStarId) end end) --法宝 Util.AddOnceClick(self.talismanBtn.gameObject,function() -- if _starType == 1 then local aaa={ id="", equipId=heroConFigData.EquipTalismana[2], exp=50, } local data=FaLingManager.initSingleData(aaa) UIManager.OpenPanel(UIName.FaLingSingleShowPopup,this,data,0,false,false,nil) --UIManager.OpenPanel(UIName.TalismanInfoPopup,heroConFigData,1,1) -- else -- UIManager.OpenPanel(UIName.TalismanInfoPopup,heroConFigData,1,75) -- end end) end --加载页签内容 function HandBookHeroInfoPanel:UpdateBtnList() if not tabsList then tabsList = {} end for k,v in pairs(tabsList) do tabsList[k].gameObject:SetActive(false) end for k = 1,10 do if tabs[k] then if not tabsList[k] then tabsList[k] = newObjToParent(this.btnPre,this.btnList) end if k == RoleInfoPanelIndex.pifu then local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",heroConFigData.Id) local HeoSkin = {} for i = 1 ,#configs do if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then HeoSkin[configs[i].Type] = configs[i] end end if LengthOfTable(HeoSkin) > 1 then tabsList[k].gameObject:SetActive(true) else tabsList[k].gameObject:SetActive(false) end elseif k == RoleInfoPanelIndex.shenhun then if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) and heroConFigData.IsSoulOpen == 1 and heroStar > 10 then tabsList[k].gameObject:SetActive(false) else tabsList[k].gameObject:SetActive(false) end else tabsList[k].gameObject:SetActive(true) end local title = Util.GetGameObject(tabsList[k], "Text"):GetComponent("Text") Util.GetGameObject(tabsList[k], "Image"):GetComponent("Image").sprite=this.spLoader:LoadSprite(tabs[k].default) title.text = GetCurLanguage() == 0 and tabs[k].title or ""..tabs[k].title.."" Util.AddOnceClick(tabsList[k],function() if k == _CurPageIndex then else self:SetSelectBtn(k) self:OnPageTabChange(k) end end) end end end --页签选中效果设置 function HandBookHeroInfoPanel:SetSelectBtn(index) this.select.transform:SetParent(tabsList[index].transform) this.select.transform.localScale = Vector3.one this.select.transform.localPosition=Vector3.zero this.select.transform:SetSiblingIndex(4) end -- tab改变事件 function HandBookHeroInfoPanel:OnPageTabChange(index) self:ChangeCurentHeroSkinLive() if this.PageList[_CurPageIndex] then this.PageList[_CurPageIndex]:OnHide() end _CurPageIndex = index if not this.PageList[index] then this.PageList[index] = SubUIManager.Open(tabs[index].sub,self.layout.transform) end this.PageList[index]:OnShow() local showStar=heroConFigData.MaxRank if _curStar==6 then showStar=11 end Util.GetGameObject(self.transform, "info"):SetActive(index==1) this.PageList[index]:SetData(this.sortingOrder,self,heroConFigData,showStar,_curLv) end function HandBookHeroInfoPanel:ChangeCurentHeroSkinLive(herodata) if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end if herodata then this.curLiveObj=self:LoadHerolive(herodata,this.curObj) else this.curLiveObj=self:LoadHerolive(heroConFigData,this.curObj) end self:SetDragView() end function HandBookHeroInfoPanel:SetDragView() if this.curLiveObj then this.dragView.gameObject:SetActive(false) this.dragView:SetDragGO(this.curLiveObj) else this.dragView.gameObject:SetActive(false) end end function this:OnSortingOrderChange() this.sortingOrder = this.sortingOrder end --根据界面数据加载动态立绘 function HandBookHeroInfoPanel:LoadHerolive(_heroData, _objPoint) --TODO:动态加载立绘 local toward if _heroData.Type and _heroData.Type~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,_heroData.Type) if roleCon then toward=roleCon.Toward end else toward=_heroData.Toward end local icon = GetResourcePath(_heroData.Live) local testLive = poolManager:LoadLive(GetResourcePath(_heroData.Painting), _objPoint.transform, Vector3.one * _heroData.Scale, Vector3.New(_heroData.Position[1], _heroData.Position[2], 0)) local SkeletonGraphic = testLive:GetComponent("SkeletonGraphic") local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle poolManager:SetLiveClearCall(_heroData.Painting, testLive, function () SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle end) SetHEeroLiveToward(testLive,toward,_heroData.Position) return testLive end --右切换按钮点击 function HandBookHeroInfoPanel:RightBtnOnClick() if isClickLeftOrRightBtn == false then return end this.btnMask.gameObject:SetActive(true) isClickLeftOrRightBtn = false self.rightBtn:GetComponent("Button").enabled = false local oldIndexConfigData = heroDatas[index] index =rightIndex if _curStar ~= _rightStar then _curStar = _rightStar heroDatas = PlayerManager.heroHandBookListData[_curStar] end heroConFigData = heroDatas[index] if this.leftLiveObj then poolManager:UnLoadLive(GetResourcePath(leftHeroData.Live), this.leftLiveObj) this.leftLiveObj = nil end 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.rightLiveObj.transform:SetParent(this.curObj.transform) 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() if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end Util.ClearChild(self.leftObj.transform) this.leftLiveObj = this:LoadHerolive(leftHeroData,self.leftObj) this.curLiveObj = this.rightLiveObj this.rightLiveObj = this:LoadHerolive(rightHeroData,self.rightObj) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "idle", false) this.rightBtn:GetComponent("Button").enabled = true isClickLeftOrRightBtn = true this:UpdateHeroInfoData() this.btnMask.gameObject:SetActive(false) end):SetEase(Ease.Linear) end --左切换按钮点击 function HandBookHeroInfoPanel:LeftBtnOnClick() if isClickLeftOrRightBtn == false then return end this.btnMask.gameObject:SetActive(true) isClickLeftOrRightBtn = false self.leftBtn:GetComponent("Button").enabled = false local oldIndexConfigData = heroDatas[index] index =leftIndex if _curStar~= _leftStar then _curStar = _leftStar heroDatas = PlayerManager.heroHandBookListData[_curStar] end heroConFigData = heroDatas[index] if this.rightLiveObj then poolManager:UnLoadLive(GetResourcePath(rightHeroData.Live), this.rightLiveObj) this.rightLiveObj = nil end 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.leftLiveObj.transform:SetParent(this.curObj.transform) 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() if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end Util.ClearChild(self.rightObj.transform) this.rightLiveObj = this:LoadHerolive(rightHeroData,self.rightObj) this.curLiveObj = this.leftLiveObj this.leftLiveObj = this:LoadHerolive(leftHeroData,self.leftObj) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "idle", false) this.leftBtn:GetComponent("Button").enabled = true isClickLeftOrRightBtn = true this:UpdateHeroInfoData() this.btnMask.gameObject:SetActive(false) end):SetEase(Ease.Linear) end --手指滑动 local beginV3 local endV3 local distance function HandBookHeroInfoPanel:OnBeginDrag(Pointgo, data) beginV3=this.curLiveObj.transform.anchoredPosition end function HandBookHeroInfoPanel:OnDrag(Pointgo, data) distance=Vector2.Distance(beginV3,this.curLiveObj.transform.anchoredPosition) end function HandBookHeroInfoPanel:OnEndDrag(Pointgo, data) endV3=this.curLiveObj.transform.anchoredPosition if distance>250 and endV3.x<0 then this:RightBtnOnClick() elseif distance>250 and endV3.x>0 then this:LeftBtnOnClick() else this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(heroConFigData.Position[1],heroConFigData.Position[2]), 0.5, false):SetEase(Ease.Linear) end distance=0 end --界面关闭时调用(用于子类重写) function HandBookHeroInfoPanel:OnClose() for k,v in pairs(this.PageList) do v:OnHide() end if this.leftLiveObj then poolManager:UnLoadLive(GetResourcePath(leftHeroData.Live), this.leftLiveObj) this.leftLiveObj = nil end if this.rightLiveObj then poolManager:UnLoadLive(GetResourcePath(rightHeroData.Live), this.rightLiveObj) this.rightLiveObj = nil end if this.curLiveObj then poolManager:UnLoadLive(GetResourcePath(heroConFigData.Live), this.curLiveObj) this.curLiveObj = nil end this.leftBtn:GetComponent("Button").enabled = true this.rightBtn:GetComponent("Button").enabled = true Util.ClearChild(this.curObj.transform) Util.ClearChild(this.leftObj.transform) Util.ClearChild(this.rightObj.transform) end --界面销毁时调用(用于子类重写) function HandBookHeroInfoPanel:OnDestroy() this.spLoader:Destroy() SubUIManager.Close(SubUIConfig.DragView, self.dragView) for k,v in pairs(this.PageList) do SubUIManager.Close(v) end tabsList = {} end return HandBookHeroInfoPanel