require("Base/BasePanel") RoleInfoPanel = Inherit(BasePanel) local this = RoleInfoPanel local _CurPageIndex = 1 local orginLayer local tabsList = {} local tabs = { [RoleInfoPanelIndex.qingbao] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11093],rpType = -1, }, [RoleInfoPanelIndex.shenhun] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "神魂",rpType = -1, }, [RoleInfoPanelIndex.jinjie] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11815],rpType = -1, }, [RoleInfoPanelIndex.juexing] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[10373],rpType = -1, }, [RoleInfoPanelIndex.chuanshuo] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11095],rpType = -1, }, [RoleInfoPanelIndex.pifu] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11816],rpType = -1, }, [RoleInfoPanelIndex.feiSheng] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "飞升",rpType = -1, }, } local tabPage = { [RoleInfoPanelIndex.qingbao] = SubUIConfig.RoleInfoLayout, [RoleInfoPanelIndex.shenhun] = SubUIConfig.RoleGodSoulLayout, [RoleInfoPanelIndex.jinjie] = SubUIConfig.RoleUpStarLayout, [RoleInfoPanelIndex.juexing] = SubUIConfig.RoleAwakelayout, [RoleInfoPanelIndex.chuanshuo] = SubUIConfig.RoleStoryLayout, [RoleInfoPanelIndex.pifu] = SubUIConfig.RoleSkinLayout, [RoleInfoPanelIndex.feiSheng] = SubUIConfig.RoleFlyUpLayout, } local curHeroData--当前英雄信息 local leftHeroData--左边预加载英雄信息 local rightHeroData--右边预加载英雄信息 local curHeroPosition -- local heroDatas--所有英雄list信息 local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local heroSkinConfig = ConfigManager.GetConfig(ConfigName.HeroSkin) local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig) local index--当前英雄在 英雄列表中的索引 local soulPrintData={}--魂印数据 local isUpZhen = false--当前英雄是否上阵 local isClickLeftOrRightBtn = true--点击左右按钮切换英雄播放动画状态 local teamHero = {}--主线编队成员信息 local talismanIsOpen = false--法宝是否开启 local soulPrintIsOpen = false--魂印是否开启 --初始化组件(用于子类重写) function RoleInfoPanel:InitComponent() this.spLoader = SpriteLoader.New() orginLayer = 0 this.BtnBack = Util.GetGameObject(self.transform, "btnBack") this.bgImageList = {} for i = 1, 4 do this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")") end this.optionUp=Util.GetGameObject(self.gameObject,"optionUp")--上部按钮组 this.helpBtn = Util.GetGameObject(this.optionUp, "helpBtn") this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition this.posBtn=Util.GetGameObject(this.optionUp,"posBtn")--角色定位按钮 this.posBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_dingweianniu_zh") this.RecallBtn=Util.GetGameObject(this.optionUp,"RecallBtn")--角色归元按钮 this.RecallBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_fabao_guiyuan_zh") this.reStarBtn=Util.GetGameObject(this.optionUp,"reStarBtn")--角色归元按钮 this.reStarBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_huitui") this.shareBtn=Util.GetGameObject(this.optionUp,"shareBtn")--分享按钮 this.bg = Util.GetGameObject(self.gameObject, "bg") screenAdapte(this.bg) this.starGrid = Util.GetGameObject(self.transform, "rolePanel/info/sartAndLvLayout") this.profession = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/proImage/proImage"):GetComponent("Image") this.heroName = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/heroName"):GetComponent("Text") this.level = Util.GetGameObject(self.transform, "rolePanel/info/sartAndLvLayout/lvText"):GetComponent("Text") this.rolePanelOp = Util.GetGameObject(self.transform, "rolePanel/layout") --装备 this.equipBtn=Util.GetGameObject(self.transform,"option/equipBtn") this.equipBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_zhuanbeianniu_zh") this.soulPrintBtn=Util.GetGameObject(self.transform,"option/soulPrintBtn") this.soulPrintBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_hunyinanniu_zh") this.soulPrintBtnRedPoint=Util.GetGameObject(self.transform,"option/soulPrintBtn/redPoint") this.equipBtnRedPoint=Util.GetGameObject(self.transform,"option/equipBtn/redPoint") --法宝 this.talismanBtn=Util.GetGameObject(self.transform,"option/talismanBtn") --该按钮控制入口显隐 this.talismanClick=Util.GetGameObject(self.transform,"option/talismanBtn/panel") --控制按钮的点击事件 置灰 this.talismanClick:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_fabaoanniu_zh") this.talismanBtnRedPoint=Util.GetGameObject(self.transform,"option/talismanBtn/panel/redPoint") this.talismanInfo=Util.GetGameObject(self.transform,"option/talismanBtn/info") --查看法宝特性按钮 --上锁 this.lockBtn=Util.GetGameObject(this.optionUp,"lockBtn") this.lockImage=Util.GetGameObject(this.lockBtn.transform,"lock") this.lockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_suoding_zh") this.unlockImage=Util.GetGameObject(this.lockBtn.transform,"unlock") this.unlockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_jiesuo_zh") this.talentBtn=Util.GetGameObject(self.transform,"leftGrid/talentBtn") this.talentBtnIcon=Util.GetGameObject(this.talentBtn,"icon"):GetComponent("Image") this.talentProgress=Util.GetGameObject(this.talentBtn,"progress"):GetComponent("Text") this.talentTipStr=Util.GetGameObject(this.talentBtn,"tipStr"):GetComponent("Text") this.talentTipStrGo=Util.GetGameObject(this.talentBtn,"tipStr") --神印 this.imprintBtn=Util.GetGameObject(self.transform,"leftGrid/imprintBtn") this.imprintBtnIcon=Util.GetGameObject(this.imprintBtn,"icon"):GetComponent("Image") this.imprintImg=Util.GetGameObject(this.imprintBtn,"Image"):GetComponent("Image") this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text") Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh") this.upLvEffect = Util.GetGameObject(self.transform,"powerBtn/effect") this.flyUpEffect = Util.GetGameObject(self.transform,"c_long") this.posBgImage=Util.GetGameObject(self.transform,"powerBtn/Pos"):GetComponent("Image") this.posImage=Util.GetGameObject(self.transform,"powerBtn/Pos/PosImage"):GetComponent("Image") this.posText=Util.GetGameObject(self.transform,"powerBtn/Pos/PosText"):GetComponent("Text") this.curObj= Util.GetGameObject(self.transform, "curObj") this.leftObj= Util.GetGameObject(self.transform, "leftObj") this.rightObj= Util.GetGameObject(self.transform, "rightObj") this.PageList = {} this.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform) this.dragView.transform:SetSiblingIndex(1) 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.btnList = Util.GetGameObject(self.transform,"rolePanel/btnList") this.btnPre = Util.GetGameObject(self.transform,"rolePanel/btnInfo") this.selectBtn = Util.GetGameObject(self.transform, "rolePanel/selectBtn") this.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject") this.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject") -- 上部货币显示 this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft}) this.btnMask = Util.GetGameObject(self.transform, "btnMask") this.btnMask.gameObject:SetActive(false) --神魂 this.godSoulBtn=Util.GetGameObject(self.transform,"leftGrid/godSoulBtn") this.godSoulBtnIcon=Util.GetGameObject(this.godSoulBtn,"icon"):GetComponent("Image") this.godSoulBtnRed=Util.GetGameObject(this.godSoulBtn,"redPoint"):GetComponent("Image") end --绑定事件(用于子类重写) function RoleInfoPanel:BindEvent() Util.AddClick(this.BtnBack, function() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) --角色定位按钮 Util.AddClick(this.posBtn,function() UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig,curHeroData.star) end) --角色归元按钮 Util.AddClick(this.RecallBtn,function() if curHeroData.lv <= 1 then PopupTipPanel.ShowTip(Language[12263]) return end if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then PopupTipPanel.ShowTip(Language[12184]) return end if HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() ~= 0 then if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then PopupTipPanel.ShowTip(Language[12184]) return end end if curHeroData.lockState == 1 then PopupTipPanel.ShowTip(Language[12264]) -- MsgPanel.ShowTwo("此神将已被锁定,是否解除锁定状态?", nil, function() -- NetManager.HeroLockEvent(curHeroData.dynamicId,0,function () -- PopupTipPanel.ShowTip("神将解锁成功") -- HeroManager.UpdateSingleHeroLockState(curHeroData.dynamicId,0) -- end) -- end) return end local selectHero = {} selectHero[curHeroData.dynamicId] = curHeroData UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.ResolveRecall, HeroManager.GetHeroReturnItems(selectHero,GENERAL_POPUP_TYPE.ResolveRecall),selectHero) end) --角色归元按钮 Util.AddClick(this.reStarBtn,function() if curHeroData.lv > 1 then PopupTipPanel.ShowTip("只有1级的神将才可回退,请先进行归元!") return end if curHeroData.lockState == 1 then PopupTipPanel.ShowTip(Language[12264]) return end local selectHero = {} selectHero[curHeroData.dynamicId] = curHeroData UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.ResolveReStar, HeroManager.GetHeroReturnItems(selectHero,GENERAL_POPUP_TYPE.ResolveReStar),selectHero) end) --左切换按钮 Util.AddClick(this.leftBtn, function() this:LeftBtnOnClick() end) --右切换按钮 Util.AddClick(this.rightBtn, function() this:RightBtnOnClick() end) Util.AddClick(this.dragView.gameObject, function() local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) end) --装备 Util.AddClick(this.equipBtn, function() UIManager.OpenPanel(UIName.RoleEquipPanel,curHeroData,heroDatas,this,isUpZhen) end) --魂印 Util.AddClick(this.soulPrintBtn, function() if soulPrintIsOpen then UIManager.OpenPanel(UIName.SoulPrintPanel,curHeroData,heroDatas) else local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock PopupTipPanel.ShowTip(Language[10536]..NumToSimplenessFont[EquipSignUnlock[2][2]] .. Language[11817]) end end) --法宝 Util.AddClick(this.talismanClick,function() if talismanIsOpen then UIManager.OpenPanel(UIName.RoleTalismanPanelV2,curHeroData,heroDatas) else PopupTipPanel.ShowTip(TalismanManager.GetCurHeroIsOpenTalismanTip()) end end) --查看法宝特性按钮 Util.AddClick(this.talismanInfo,function() UIManager.OpenPanel(UIName.TalismanInfoPopup,curHeroData.heroConfig,1,1) end) --上锁 Util.AddClick(this.lockBtn,function() this:HeroLockEvent() end) Util.AddClick(this.talentBtn,function() LogError("brea id=="..curHeroData.breakId.." upstarid =="..curHeroData.upStarId) UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId) end) Util.AddClick(this.godSoulBtn,function() UIManager.OpenPanel(UIName.RoleGodSoulLayout,curHeroData) end) end --添加事件监听(用于子类重写) function RoleInfoPanel:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow) Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self) Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData,self) end --移除事件监听(用于子类重写) function RoleInfoPanel:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin,this.UpdateSkinShow) Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self) Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData,self) end this.UpdateSkinShow = function() if _CurPageIndex == RoleInfoPanelIndex.pifu then this:OnPageTabChange(_CurPageIndex) end end --界面打开时调用(用于子类重写) function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen,_index) curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen if _index and _index > 0 then _CurPageIndex = _index else _CurPageIndex = RoleInfoPanelIndex.qingbao end end -- 打开,重新打开时回调 function RoleInfoPanel:OnShow() this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.RoleInfo }) isClickLeftOrRightBtn = true this.upLvEffect:SetActive(false) this.flyUpEffect:SetActive(true) for i = 1, #heroDatas do if curHeroData.dynamicId == heroDatas[i].dynamicId then index = i end end teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL) this:UpdateLiveList()--加载当前 和 左右数据 if this.leftLiveObj and leftHeroData then poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj) this.leftLiveObj = nil end if this.rightLiveObj and rightHeroData then poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj) this.rightLiveObj = nil end if this.curLiveObj and curHeroData then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end Util.ClearChild(this.curObj.transform) Util.ClearChild(this.leftObj.transform) Util.ClearChild(this.rightObj.transform) this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj) this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj) this.curLiveObj = HeroManager.LoadHerolive(curHeroData,this.curObj) local leftToward=0 if leftHeroData.skinId and leftHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,leftHeroData.skinId) if roleCon then leftToward=roleCon.Toward end else leftToward=leftHeroData.heroConfig.Toward end SetHEeroLiveToward(this.leftLiveObj,leftToward,leftHeroData.position) local rightToward=0 if rightHeroData.skinId and rightHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,rightHeroData.skinId) if roleCon then rightToward=roleCon.Toward end else rightToward=rightHeroData.heroConfig.Toward end SetHEeroLiveToward(this.rightLiveObj,rightToward,rightHeroData.position) if this.curLiveObj then this.dragView.gameObject:SetActive(true) this.dragView:SetDragGO(this.curLiveObj) else this.dragView.gameObject:SetActive(false) end this:SetPanelBg(curHeroData.heroConfig) this:UpdateHeroInfoData()--刷新界面方法 end --更新界面已存数据 function this:UpdateLiveList() local leftIndex = (index - 1 > 0 and index - 1 or #heroDatas) leftHeroData = heroDatas[leftIndex] curHeroData = heroDatas[index] local rightIndex = (index + 1 <= #heroDatas and index + 1 or 1) rightHeroData = heroDatas[rightIndex] end function this:SetPanelBg(heroData) for i = 1, 4 do if heroData.PropertyName == i then this.bgImageList[i]:SetActive(true) else this.bgImageList[i]:SetActive(false) end end end --右切换按钮点击 function this:RightBtnOnClick() -- 英雄长按升级时不再进行切换操作 if this.PageList[1] and this.PageList[1].isPressed then return end if isClickLeftOrRightBtn == false then return end isClickLeftOrRightBtn = false this.btnMask.gameObject:SetActive(true) local oldIndexConfigData = heroDatas[index] index = (index + 1 <= #heroDatas and index + 1 or 1) curHeroData = heroDatas[index] if this.leftLiveObj then poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj) this.leftLiveObj = nil end this.curLiveObj.transform:SetParent(this.leftObj.transform) 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() if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj) this.curLiveObj = nil end Util.ClearChild(this.leftObj.transform) this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj) local leftToward=0 if leftHeroData.skinId and leftHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,leftHeroData.skinId) if roleCon then leftToward=roleCon.Toward end else leftToward=leftHeroData.heroConfig.Toward end SetHEeroLiveToward(this.leftLiveObj,leftToward,leftHeroData.position) this.curLiveObj = this.rightLiveObj local rightToward=0 if rightHeroData.skinId and rightHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,rightHeroData.skinId) if roleCon then rightToward=roleCon.Toward end else rightToward=rightHeroData.heroConfig.Toward end this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj) SetHEeroLiveToward(this.rightLiveObj,rightToward,rightHeroData.position) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) this.rightBtn:GetComponent("Button").enabled = true isClickLeftOrRightBtn = true this:UpdateHeroInfoData() this.btnMask.gameObject:SetActive(false) end):SetEase(Ease.Linear) this:SetPanelBg(curHeroData.heroConfig) end --左切换按钮点击 function this:LeftBtnOnClick() -- 英雄长按升级时不再进行切换操作 if this.PageList[1] and this.PageList[1].isPressed then return end if isClickLeftOrRightBtn == false then return end this.btnMask.gameObject:SetActive(true) isClickLeftOrRightBtn = false this.leftBtn:GetComponent("Button").enabled = false 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 end this.curLiveObj.transform:SetParent(this.rightObj.transform) 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() if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj) this.curLiveObj = nil end Util.ClearChild(this.rightObj.transform) this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj) local rightToward=0 if rightHeroData.skinId and rightHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,rightHeroData.skinId) if roleCon then rightToward=roleCon.Toward end else rightToward=rightHeroData.heroConfig.Toward end SetHEeroLiveToward(this.rightLiveObj,rightToward,rightHeroData.position) this.curLiveObj = this.leftLiveObj this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj) local leftToward=0 if leftHeroData.skinId and leftHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,leftHeroData.skinId) if roleCon then leftToward=roleCon.Toward end else leftToward=leftHeroData.heroConfig.Toward end SetHEeroLiveToward(this.leftLiveObj,leftToward,leftHeroData.position) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) this.leftBtn:GetComponent("Button").enabled = true isClickLeftOrRightBtn = true this:UpdateHeroInfoData() this.btnMask.gameObject:SetActive(false) end):SetEase(Ease.Linear) this:SetPanelBg(curHeroData.heroConfig) end function this:UpdateBtnList() if not tabsList then tabsList = {} end for k,v in pairs(tabsList) do if IsNull(tabsList[k]) then tabsList[k] = nil else tabsList[k].gameObject:SetActive(false) end end for k,v in ipairs(tabs) do 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",curHeroData.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.jinjie then if curHeroData.star < 10 then tabsList[k].gameObject:SetActive(true) else tabsList[k].gameObject:SetActive(false) end elseif k == RoleInfoPanelIndex.juexing then if curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) 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 curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then tabsList[k].gameObject:SetActive(false) else tabsList[k].gameObject:SetActive(false) end elseif k== RoleInfoPanelIndex.feiSheng then -- if curHeroData.star >=11 and curHeroData.heroConfig.MaxRank>11 and curHeroData.star<14 then --and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FlyUp) then tabsList[k].gameObject:SetActive(true) else tabsList[k].gameObject:SetActive(false) end else tabsList[k].gameObject:SetActive(true) end local img = tabsList[k]:GetComponent("Image") img.sprite = this.spLoader:LoadSprite("r_hero_xuanze_002") local title = Util.GetGameObject(tabsList[k], "Text"):GetComponent("Text") local redpot = Util.GetGameObject(tabsList[k], "redPoint") title.text = GetCurLanguage() == 0 and v.title or ""..v.title.."" -- 判断是否需要检测红点 redpot:SetActive(false) if k == RoleInfoPanelIndex.qingbao then local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData) redpot.gameObject:SetActive(upLvRedpoint) elseif k == RoleInfoPanelIndex.jinjie then local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData) redpot.gameObject:SetActive(upStarRedPointState) elseif k == RoleInfoPanelIndex.juexing then local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData) redpot.gameObject:SetActive(upStarRedPointState) elseif k == RoleInfoPanelIndex.shenhun then -- local upStarRedPointState = GodSoulManager.CheckRedPointGodSoul(curHeroData) -- redpot.gameObject:SetActive(upStarRedPointState) -- else redpot.gameObject:SetActive(false) elseif k == RoleInfoPanelIndex.feiSheng then local upStarRedPointState = HeroManager.IsShowFlyUpRedPoint(curHeroData) redpot.gameObject:SetActive(upStarRedPointState) end Util.AddOnceClick(tabsList[k],function() if k == _CurPageIndex then else this:SetSelectBtn(k) this:OnPageTabChange(k) end end) end end function this:CheckRedPointType(index,isShowRedPoint) if tabsList[index] then local redpot = Util.GetGameObject(tabsList[index], "redPoint") redpot.gameObject:SetActive(isShowRedPoint) end end -- 绑定数据 local _PageBindData = {} --页签选中效果设置 function this:SetSelectBtn(index) this.selectBtn.transform:SetParent(tabsList[index].transform) this.selectBtn.transform.localScale = Vector3.one this.selectBtn.transform.localPosition=Vector3.zero this.selectBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_xuanze_001") Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == 0 and tabs[index].title or ""..tabs[index].title..""--tabs[index].title-- this.talentTipStrGo:SetActive(false) if index == RoleInfoPanelIndex.jinjie then this.talentTipStrGo:SetActive(true) end end -- tab改变事件 function this:OnPageTabChange(index) this:ChangeCurentHeroSkinLive() if this.PageList[_CurPageIndex] then this.PageList[_CurPageIndex]:OnHide() end _CurPageIndex = index if not this.PageList[index] then this.PageList[index] = SubUIManager.Open(tabPage[index],this.rolePanelOp.transform) end this.PageList[index]:OnShow() this.PageList[index]:SetData(this.sortingOrder,this,curHeroData,isUpZhen,heroDatas) end function this:OnSortingOrderChange() Util.AddParticleSortLayer(this.upLvEffect, this.sortingOrder - orginLayer) AddParticleSortLayer(this.flyUpEffect, this.sortingOrder - orginLayer) orginLayer = this.sortingOrder end function this:UpdateHeroInfoData() this:UpdateBtnList() for k,v in pairs(this.PageList) do v:OnHide() end if _CurPageIndex == RoleInfoPanelIndex.pifu then local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.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.jinjie then if (curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake)) or (not (curHeroData.star < 10)) then _CurPageIndex = RoleInfoPanelIndex.qingbao end elseif _CurPageIndex == RoleInfoPanelIndex.juexing then if (curHeroData.star < 10) or not (curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake)) then _CurPageIndex = RoleInfoPanelIndex.qingbao end elseif _CurPageIndex == RoleInfoPanelIndex.shenhun then if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then _CurPageIndex = RoleInfoPanelIndex.qingbao else _CurPageIndex = RoleInfoPanelIndex.qingbao end end this:SetSelectBtn(_CurPageIndex) this:OnPageTabChange(_CurPageIndex) local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock local EquipSignUnlockTwo = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,87).OpenRules[2] if teamHero[curHeroData.dynamicId] then isUpZhen = true local isCanUpEquipTreasure local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig,40) if config then local limits = string.split(config.Value, "|") if limits then local heroConfig = curHeroData.heroConfig local lvs = string.split(limits[1], "#") local stars = string.split(limits[2], "#") if PlayerManager.level >= tonumber(lvs[2]) and heroConfig ~= nil and heroConfig.MaxRank >= tonumber(stars[2]) then isCanUpEquipTreasure = true else isCanUpEquipTreasure = false end else isCanUpEquipTreasure = false end else isCanUpEquipTreasure = false end this.equipBtnRedPoint:SetActive(#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 or (isCanUpEquipTreasure and #HeroManager.GetHeroIsUpTreasure(curHeroData.dynamicId,0) > 0) or HeroManager.CheckIsUpTreasure(curHeroData.jewels[1],0) or HeroManager.CheckIsUpTreasure(curHeroData.jewels[2],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 end --魂印按钮逻辑 this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlockTwo and curHeroData.heroConfig.MaxRank >= EquipSignUnlock[2][2]) this:SetDragView() local starSize = Vector2.New(60,60) local star,starType = curHeroData.GetStar(1) local starScale = -10 if starType == 3 then starSize = Vector2.New(1.2,1.84) starScale = 7 end SetHeroStars(this.spLoader, this.starGrid, star,starType,starSize,starScale)--,Vector2.New(0.5,0.5)) Util.SetParticleSortLayer(this.starGrid,this.sortingOrder + 1) --使得神魂特效同步------------------------ this.starGrid:SetActive(false) this.starGrid:SetActive(true) ------------------------------------------ this.posImage.sprite =this.spLoader:LoadSprite(curHeroData.professionIcon) this.heroName.text = curHeroData.name this.profession.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName)) --定位描述相关 this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession)) this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession)) this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation) SetTextVerTial(this.posText.gameObject,Vector3.New(64,21,0),"MiddleLeft") this.unlockImage:SetActive(curHeroData.lockState == 0) this.lockImage:SetActive(curHeroData.lockState == 1) --魂印 soulPrintIsOpen=SoulPrintManager.GetSoulPrintIsOpen(curHeroData) Util.GetGameObject(this.soulPrintBtn, "lock"):SetActive(not soulPrintIsOpen) Util.SetGray(this.soulPrintBtn, not soulPrintIsOpen) if not soulPrintIsOpen then Util.GetGameObject(this.soulPrintBtn, "lock/Text"):GetComponent("Text").text= NumToSimplenessFont[EquipSignUnlock[2][2]]..Language[10535] end --天赋 local talentBtnImage="" this.talentBtn:SetActive(curHeroData.heroConfig.OpenPassiveSkillRules ~= nil) if curHeroData.star==HeroManager.awakeNextStarIndex then talentBtnImage="r_hero_tianfu2_zh" elseif curHeroData.star==12 then talentBtnImage="r_tongyong_tianfufeisheng1" elseif curHeroData.star==13 then talentBtnImage="r_tongyong_tianfufeisheng2" elseif curHeroData.star==14 then talentBtnImage="r_tongyong_tianfufeisheng3" else talentBtnImage="r_hero_tianfu1_zh" end this.talentBtnIcon.sprite = this.spLoader:LoadSprite(talentBtnImage) local OpenPassiveSkillRules = curHeroData.star >= HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules if OpenPassiveSkillRules then local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId) this.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum if allUpStarOpenData[curHeroData.star + 1] then this.talentTipStr.text = Language[11818].. NumToSimplenessFont[curHeroData.star + 1] ..Language[11819] else this.talentTipStr.text = "" end end local WarPower = 0 if isUpZhen then WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL) else -- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false) WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId) end this.force.text = WarPower --神印按钮 local imprintId = PracticeManager.CheckHeroWearImprint(curHeroData.dynamicId) if imprintId then this.imprintBtn:SetActive(true) this.imprintImg.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[imprintId].Icon)) Util.AddOnceClick(this.imprintBtn,function () UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,imprintId,curHeroData.id) end) else this.imprintBtn:SetActive(false) end ForceRebuildLayout(this.starGrid.transform) this.godSoulBtn.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10) local upStarRedPointState = GodSoulManager.CheckRedPointGodSoul(curHeroData) this.godSoulBtnRed.gameObject:SetActive(upStarRedPointState) this.reStarBtn.gameObject:SetActive(curHeroData.star > 5 and curHeroData.star < 10) end function this:ChangeCurentHeroSkinLive(herodata) if this.curLiveObj then poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj) this.curLiveObj = nil end if herodata then this.curLiveObj=HeroManager.LoadHerolive1(herodata,this.curObj) local toward=0 local pos=nil if herodata.Type~=0 then LogError("type=="..herodata.Type) local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,herodata.Type) if roleCon then LogError("type====="..herodata.Type) toward=roleCon.Toward end else toward=herodata.heroConfig.Toward end SetHEeroLiveToward(this.curLiveObj,toward,herodata.Position) -- 临时保存皮肤位置 curHeroPosition = herodata.Position else local WarPower if isUpZhen then -- local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL) -- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId) -- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal) WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL) else WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId) -- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false) end this.force.text = WarPower local toward=0 if curHeroData.skinId and curHeroData.skinId~=0 then local roleCon=ConfigManager.TryGetConfigData(ConfigName.RoleConfig,curHeroData.skinId) if roleCon then toward=roleCon.Toward end else toward=curHeroData.heroConfig.Toward end this.curLiveObj=HeroManager.LoadHerolive(curHeroData,this.curObj) SetHEeroLiveToward(this.curLiveObj,toward,curHeroData.position) -- 清空临时保存的皮肤位置 curHeroPosition = nil end this:SetDragView() end function this:SetDragView() if this.curLiveObj then this.dragView.gameObject:SetActive(true) this.dragView:SetDragGO(this.curLiveObj) else this.dragView.gameObject:SetActive(false) end end local beginV3 local endV3 local distance function RoleInfoPanel:OnBeginDrag(Pointgo, data) beginV3=this.curLiveObj.transform.anchoredPosition end function RoleInfoPanel:OnDrag(Pointgo, data) distance=Vector2.Distance(beginV3,this.curLiveObj.transform.anchoredPosition) end function RoleInfoPanel: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 local pos = curHeroPosition or curHeroData.position this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(pos[1], pos[2]), 0.5, false):SetEase(Ease.Linear) end distance=0 end --界面关闭时调用(用于子类重写) function RoleInfoPanel:OnClose() if this.leftLiveObj and leftHeroData then poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj) this.leftLiveObj = nil end if this.rightLiveObj and rightHeroData then poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj) this.rightLiveObj = nil end if this.curLiveObj and curHeroData then poolManager:UnLoadLive(this.curLiveObj.name, 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) for k,v in pairs(this.PageList) do v:OnHide() end this.btnMask.gameObject:SetActive(false) end --界面销毁时调用(用于子类重写) function RoleInfoPanel:OnDestroy() this.spLoader:Destroy() tabsList = {} SubUIManager.Close(this.UpView) -- 这里管理全部子界面的销毁,保证子界面生命周期完整 for k,v in pairs(this.PageList) do SubUIManager.Close(v) end end --跳转显示新手提示圈 function this.ShowGuideGo(type)--1 升级突破 2 进阶 if type == 1 then JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upLvBtn) elseif type == 2 then -- 我要变强跳转过来显示小手 elseif type == -1 then JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upLvBtn) elseif type == -2 then JumpManager.ShowGuide(UIName.RoleInfoPanel,this.equipBtn) elseif type == -3 then JumpManager.ShowGuide(UIName.RoleInfoPanel,this.soulPrintBtn) elseif type == -4 then JumpManager.ShowGuide(UIName.RoleInfoPanel,this.talismanClick) end end function this:HeroLockEvent() if curHeroData.lockState == 1 then curHeroData.lockState = 0 elseif curHeroData.lockState == 0 then curHeroData.lockState = 1 end NetManager.HeroLockEvent(curHeroData.dynamicId,curHeroData.lockState,function () if curHeroData.lockState == 1 then PopupTipPanel.ShowTip(Language[11820]) elseif curHeroData.lockState == 0 then PopupTipPanel.ShowTip(Language[11741]) end HeroManager.UpdateSingleHeroLockState(curHeroData.dynamicId,curHeroData.lockState) this.unlockImage:SetActive(curHeroData.lockState == 0) this.lockImage:SetActive(curHeroData.lockState == 1) for i, v in pairs(heroDatas) do if curHeroData == v then v.lockState = curHeroData.lockState end end end) end function this:ResolveUpdateHeroInfoData() curHeroData = HeroManager.GetSingleHeroData(curHeroData.dynamicId) for i = 1, #heroDatas do if curHeroData.dynamicId == heroDatas[i].dynamicId then heroDatas[i] = curHeroData end end this:UpdateHeroInfoData()--刷新界面方法 if isUpZhen then FormationManager.UserPowerChanged() end end return this