require("Base/BasePanel") RoleInfoLayout = Inherit(BasePanel) local this = RoleInfoLayout 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 skillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig) local passiveSkillConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillConfig) local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig) local costItemList--升级突破静态材料 local isUpLvMaterials=true--升级 突破 材料是否充足 local allAddProVal={}--所有属性加成值 local lvUpShowProList={}--升级后展示的属性提升list local isHeroUpTuPo=false--是否可突破 local upTuPoRankUpConfig={}--即将要突破的数据 local upStarRankUpConfig={}--即将要升星的数据 local curStarRankUpConfig={}--当前升星的数据 local curTuPoRankUpConfig={}--当前突破的数据 local costId=0 --长按升级状态 local _isClicked = false --是否点击 local _isReqLvUp = false local _isLongPress = false --是否长按 this.timePressStarted = 0--监听长按事件 this.priThread = nil--协同程序播放升级属性提升值动画用 local oldLv = 0 local curHeroData--当前英雄信息 local parent = {} local isUpZhen = false--当前英雄是否上阵 local isHeroUpStar local herodatas = {} this.isPressed = false local timer = 0 local proSort = { [1] = HeroProType.Attack, [2] = HeroProType.Hp, [3] = HeroProType.PhysicalDefence, [4] = HeroProType.MagicDefence, } function RoleInfoLayout:New(gameObject) local b = {} b.gameObject = gameObject b.transform = gameObject.transform setmetatable(b, { __index = RoleInfoLayout }) return b end --初始化组件(用于子类重写) function RoleInfoLayout:InitComponent() this.spLoader = SpriteLoader.New() this.playplyanim = Util.GetGameObject(self.gameObject,"playplyanim") this.lvRoot = Util.GetGameObject(self.gameObject,"content/lv") this.lv = Util.GetGameObject(self.gameObject,"content/lv/proValue"):GetComponent("Text") this.pos = Util.GetGameObject(self.gameObject,"content/Pos") this.posImage = Util.GetGameObject(this.pos,"PosImage"):GetComponent("Image") this.posText = Util.GetGameObject(this.pos,"PosText"):GetComponent("Text") this.proList = {} for i = 1,4 do this.proList[i] = {} this.proList[i].go = Util.GetGameObject(self.gameObject,"content/pro/bg/proPre"..i) this.proList[i].proImage = Util.GetGameObject(this.proList[i].go,"Image"):GetComponent("Image") this.proList[i].value = Util.GetGameObject(this.proList[i].go,"proValue"):GetComponent("Text") end this.allProButton = Util.GetGameObject(self.gameObject,"content/pro") this.posBtn = Util.GetGameObject(self.gameObject,"content/posBtn") this.posInfo = Util.GetGameObject(this.posBtn,"PosInfo"):GetComponent("Text") this.proTip = Util.GetGameObject(self.gameObject,"content/pro/bg/tishi") this.skillGrid=Util.GetGameObject(self.gameObject,"content/skill") this.skillGrid2=Util.GetGameObject(self.gameObject,"content/skill2") this.selsectSkillImage=Util.GetGameObject(this.skillGrid,"selsectSkillImage") this.skillList = {} this.skillBtnsList = {} this.skillBtnsRoot = Util.GetGameObject(self.gameObject,"content/skillBtns") this.skillGridCanvas = this.skillBtnsRoot:GetComponent("Canvas") for i = 1,5 do this.skillList[i] = {} this.skillList[i].go = Util.GetGameObject(this.skillGrid,"sBg"..i) this.skillList[i].icon = Util.GetGameObject(this.skillList[i].go,"icon"):GetComponent("Image") this.skillList[i].pos = Util.GetGameObject(this.skillList[i].go,"pos/icon"):GetComponent("Image") this.skillList[i].pro = Util.GetGameObject(this.skillList[i].go,"pro"):GetComponent("Image") this.skillList[i].proText = Util.GetGameObject(this.skillList[i].pro.gameObject,"Text"):GetComponent("Text") this.skillList[i].skillName = Util.GetGameObject(this.skillList[i].go,"skillName"):GetComponent("Text") this.skillList[i].skillIma = Util.GetGameObject(this.skillList[i].go,"image") this.skillList[i].frame = Util.GetGameObject(this.skillList[i].go,"frame"):GetComponent("Image") this.skillBtnsList[i] = Util.GetGameObject(this.skillBtnsRoot,"sBg"..i) end this.line1 = Util.GetGameObject(this.skillGrid,"line1") this.line2 = Util.GetGameObject(this.skillGrid,"line2") this.line3 = Util.GetGameObject(this.skillBtnsRoot,"line1") this.line4 = Util.GetGameObject(this.skillBtnsRoot,"line2") this.upLv = Util.GetGameObject(self.gameObject,"content/upLv") --升级 this.itemPre=Util.GetGameObject(this.upLv,"costPre") this.itemGrid=Util.GetGameObject(this.upLv,"itemGrid") this.costList = {} for i = 1,this.itemGrid.transform.childCount do if this.itemGrid.transform:GetChild(i - 1).gameObject.name=="Image" then goto label end this.costList[#this.costList+1] = {} this.costList[#this.costList].go = this.itemGrid.transform:GetChild(i - 1) this.costList[#this.costList].icon = Util.GetGameObject( this.costList[#this.costList].go,"icon"):GetComponent("Image") this.costList[#this.costList].costText = Util.GetGameObject( this.costList[#this.costList].go,"Text"):GetComponent("Text") ::label:: end this.upLvBtn=Util.GetGameObject(this.upLv,"upLvBtn") this.upMaxLvBtn=Util.GetGameObject(this.upLv,"upMaxLvBtn") this.upLvBtnRedPoint=Util.GetGameObject(this.upLvBtn,"redPoint") this.upMaxLvBtnRedPoint=Util.GetGameObject(this.upMaxLvBtn,"redPoint") this.upLvTrigger = Util.GetEventTriggerListener(this.upLvBtn) this.upLvBtnText=Util.GetGameObject(this.upLvBtn,"Text"):GetComponent("Text") this.upLvBtnImage=this.upLvBtn:GetComponent("Image") this.tipUpLv=Util.GetGameObject(this.upLv,"tip"):GetComponent("Text") this.noUpLvText=Util.GetGameObject(self.gameObject,"content/noUpLvText") this.gongmingText=Util.GetGameObject(self.gameObject,"gongming") this.hognmengzhenTip = Util.GetGameObject(this.gongmingText,"hognmengzhenTip") this.hognmengbeiTip = Util.GetGameObject(this.gongmingText,"hognmengbeiTip") this.lvUpGo=Util.GetGameObject(self.gameObject,"lvUpGo") this.lvUpGoImage=Util.GetGameObject(self.gameObject,"lvUpGo/Image") this.lvUpGoImage:SetActive(false) for i = 1, 5 do lvUpShowProList[i]=Util.GetGameObject(this.lvUpGo.transform,"proPreParent/proPre"..i) end lvUpShowProList[5]:SetActive(false) end function RoleInfoLayout:OnPointerUp(Pointgo,data)--抬起 if self.isPressed then self.isPressed = false self:RefreshBottom(true) end end --点击或长按处理升级处理 function RoleInfoLayout:OnPointerDown(Pointgo,data)--按下 self.isPressed = true end --绑定事件(用于子类重写) function RoleInfoLayout:BindEvent() --角色定位按钮 Util.AddClick(this.posBtn,function() UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig,curHeroData.star) end) --一键升级 Util.AddClick(this.upMaxLvBtn, function() if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then PopupTipPanel.ShowTip("等级已达上限") return end local oldUpMaxLv=this:CalUpMaxLv() local openLv=this.GetCurHeroLvLimit() if curHeroData.lv>=openLv then PopupTipPanel.ShowTip("等级已达上限") return end if this.isGongMing then PopupTipPanel.ShowTip("神将正在共鸣中,无法升级!") return end if curHeroData.lv 0 then -- curLvEnd = heroRankupConfig[curHeroData.breakId].OpenLevel -- end -- if curHeroData.upStarId > 0 then -- if heroRankupConfig[curHeroData.upStarId].OpenLevel > curLvEnd then -- curLvEnd = heroRankupConfig[curHeroData.upStarId].OpenLevel -- end -- end if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then -- body#FFCC00 this.lv.text= ""..curHeroData.lv.."" elseif HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() >= HarmonyManager.TowerStartLimit then this.lv.text= ""..curHeroData.lv.."" else this.lv.text= curHeroData.lv.."/"..curLvEnd end ForceRebuildLayout(this.lvRoot.transform) this.posImage.sprite =this.spLoader:LoadSprite(curHeroData.professionIcon) --this.posImage:SetNativeSize() this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation) --技能点击特殊处理 this.selsectSkillImage:SetActive(false) --this.UpdateHeroUpStarProUpSkillShow() end function this:ProShow(go,allAddProVal,HeroProType,nextallAddProVal) --go.proName.text = GetLanguageStrById(curProSConFig.Info)..":" go.proImage.sprite = this.spLoader:LoadSprite(PropertyTypeIconDef[HeroProType]) go.value.text = allAddProVal[HeroProType] end function this.GetCurHeroLvLimit() local curLvEnd = 30 if curHeroData.breakId > 0 then curLvEnd = heroRankupConfig[curHeroData.breakId].OpenLevel end if curHeroData.lv>= curLvEnd and curHeroData.upStarId > 0 then if heroRankupConfig[curHeroData.upStarId].OpenLevel > curLvEnd then curLvEnd = heroRankupConfig[curHeroData.upStarId].OpenLevel end end return curLvEnd end function this.GetSkillsDataOld() local skillList = {} local skillIdList = {} if curHeroData.heroConfig.OpenSkillRules then for i = 1, #curHeroData.heroConfig.OpenSkillRules do if not skillIdList[curHeroData.heroConfig.OpenSkillRules[i][2]] then local heroSkill = {} heroSkill.skillId = curHeroData.heroConfig.OpenSkillRules[i][2] heroSkill.skillConfig = skillConfig[heroSkill.skillId] if curHeroData.star >= curHeroData.heroConfig.OpenSkillRules[i][1] then heroSkill.state = 1 else heroSkill.state = 0 end heroSkill.star = curHeroData.heroConfig.OpenSkillRules[i][1] heroSkill.quality = 0 heroSkill.skillType = 0 skillIdList[curHeroData.heroConfig.OpenSkillRules[i][2]] = curHeroData.heroConfig.OpenSkillRules[i][2] table.insert(skillList, heroSkill) end end end if curHeroData.star < 11 then if curHeroData.heroConfig.OpenPassiveSkillRules then for i = 1, #curHeroData.heroConfig.OpenPassiveSkillRules do if curHeroData.heroConfig.OpenPassiveSkillRules[i][1] == 2 and passiveSkillLogicConfig[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]].Judge == 1 then if not skillIdList[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]] then local heroSkill = {} heroSkill.skillId = curHeroData.heroConfig.OpenPassiveSkillRules[i][3] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] if curHeroData.star >= curHeroData.heroConfig.OpenPassiveSkillRules[i][2] - 1 then heroSkill.state = 1 else heroSkill.state = 0 end heroSkill.star = curHeroData.heroConfig.OpenPassiveSkillRules[i][2] - 1 heroSkill.quality = 0 heroSkill.skillType = 1 skillIdList[curHeroData.heroConfig.OpenPassiveSkillRules[i][3]] = curHeroData.heroConfig.OpenPassiveSkillRules[i][3] table.insert(skillList, heroSkill) end end end end else local heroSkillList = this.GetAwakenSkill() if heroSkillList then for i = 1, #heroSkillList do table.insert(skillList, heroSkillList[i]) end end if curHeroData.heroConfig.MaxRank > 11 then for i = 1, #curHeroData.heroConfig.Awaken do if curHeroData.heroConfig.Awaken[i][1] == 2 and curHeroData.heroConfig.Awaken[i][2] == 27 then local heroSkill = {} heroSkill.skillId = curHeroData.heroConfig.Awaken[i][3] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] if curHeroData.star == 14 then heroSkill.state = 1 else heroSkill.state = 0 --是否置灰 end heroSkill.star = 14 heroSkill.quality = 1 --决定技能的品质框 heroSkill.skillType = 0 --是否显示对比技能 table.insert(skillList, heroSkill) break end end end end return skillList end function this.SkillInfo() this.skillGrid2:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1 local maxStar=curHeroData.heroConfig.MaxRank local skillList = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,maxStar,curHeroData.star) local skillList2 if maxStar>9 then skillList2 = HeroManager.GetCurHeroSidAndCurStarAllSkillDatas2(curHeroData.heroConfig.Id,10,curHeroData.star) else end for i = 1, this.skillGrid2.transform.childCount do this.skillGrid2.transform:GetChild(i-1).gameObject:SetActive(false) end for i = 1, #skillList do if skillList[i] and skillList[i].skillConfig and GetLanguageStrById(skillList[i].skillConfig.Name) then local go = this.skillGrid2.transform:GetChild(i-1).gameObject go:SetActive(true) Util.GetGameObject(go.transform,"icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(skillList[i].skillConfig.Icon)) local typeImg=Util.GetGameObject(go.transform,"pos/icon") typeImg:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetSkillType(skillList[i])) local sText = Util.GetGameObject(go.transform,"skillName"):GetComponent("Text") sText.text=GetLanguageStrById(skillList[i].skillConfig.Name) sText.fontSize = GetCurLanguage() ~= 2 and 30 or 25 Util.SetGray(go,skillList[i].isOpen) if skillList[i].isOpen then if skillList[i].needStar==15 then sText.text="飞升5解锁" elseif skillList[i].needStar==13 then sText.text="飞升3解锁" else sText.text=NumToSimplenessFont[skillList[i].needStar].."星解锁" end end local pro=Util.GetGameObject(go.transform,"pro") local proText=Util.GetGameObject(go.transform,"pro/Text"):GetComponent("Text") if skillList[i].skillConfig.Skilltips and skillList[i].skillConfig.Skilltips~=0 then pro:SetActive(true) proText.text=SkillProType[skillList[i].skillConfig.Skilltips] else pro:SetActive(false) end Util.AddOnceClick(go, function() if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack) end this.selsectSkillImage:SetActive(true) this.selsectSkillImage.transform.position=Util.GetGameObject(go.transform,"icon").transform.position local skillData = {} skillData.skillConfig = skillList[i].skillConfig skillData.isOpen=skillList[i].isOpen skillData.needStar=skillList[i].needStar local nextData=nil -- if curHeroData.star<11 and i>2 then -- nextData=skillList2[i] -- end local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,skillData.skillConfig.Type) if skillList2 and skillList2[i] and i>2 then nextData=skillList2[i] nextData.isOpen=skillList2[i].isOpen nextData.needStar=skillList2[i].needStar --飞升技能 if i==6 then panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i) else panel = UIManager.OpenPanel(UIName.SkillInfoPopup,nextData,1,10,maxLv,i,skillData) end else panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i) end --local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,skillData,1,10,maxLv,i,nextData) this.skillGrid2:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1 triggerCallBack = function (panelType, p) if panelType == UIName.SkillInfoPopup and panel == p then --监听到SkillInfoPopup关闭,把层级设回去 this.skillGrid2:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1 Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack) this.selsectSkillImage:SetActive(false) end end Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack) end) end end end function this.GetAwakenSkill() local starIdlist = {} local skillIdList = {} local skillList = {} if curHeroData.heroConfig.Awaken then for i = 1, #curHeroData.heroConfig.Awaken do if curHeroData.heroConfig.Awaken[i][1] == 2 and passiveSkillLogicConfig[curHeroData.heroConfig.Awaken[i][3]].Judge == 1 and curHeroData.heroConfig.Awaken[i][2] < 12 then if not skillIdList[curHeroData.heroConfig.Awaken[i][3]] and not starIdlist[curHeroData.heroConfig.Awaken[i][2]] then local heroSkill = {} heroSkill.skillId = curHeroData.heroConfig.Awaken[i][3] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] if curHeroData.star >= curHeroData.heroConfig.Awaken[i][2] - 1 then heroSkill.state = 1 else heroSkill.state = 0 end heroSkill.star = curHeroData.heroConfig.Awaken[i][2] - 1 heroSkill.quality = 1 heroSkill.skillType = 0 starIdlist[curHeroData.heroConfig.Awaken[i][2]] = curHeroData.heroConfig.Awaken[i][2] skillIdList[curHeroData.heroConfig.Awaken[i][3]] = curHeroData.heroConfig.Awaken[i][3] table.insert(skillList, heroSkill) end end end end return skillList end function this.GetSkillsData() local skillList = {} local skillIdList = {} if curHeroData.heroConfig.OpenSkillRules then for i = 1, #curHeroData.heroConfig.OpenSkillRules do if curHeroData.heroConfig.OpenSkillRules[i][1] == curHeroData.star then local heroSkill = {} heroSkill.skillId = curHeroData.heroConfig.OpenSkillRules[i][2] heroSkill.skillConfig = skillConfig[heroSkill.skillId] heroSkill.Type = heroSkill.skillConfig.Type --角标 heroSkill.Skilltips = heroSkill.skillConfig.Skilltips --右角标 heroSkill.Name = nil heroSkill.Icon = GetResourcePath(heroSkill.skillConfig.Icon) --图标 if curHeroData.star >= curHeroData.heroConfig.OpenSkillRules[i][1] then heroSkill.state = 1 --是否置灰 -1不显示 0置灰 1显示不置灰 else heroSkill.state = 0 end heroSkill.quality = 0 --是否白金背景框 table.insert(skillList, heroSkill) end end end local heroSkill = {} if curHeroData.heroConfig.EquipTalismana and #curHeroData.heroConfig.EquipTalismana > 1 then local dowerAllData = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",curHeroData.heroConfig.EquipTalismana[2]) for i = 1,#dowerAllData do if dowerAllData[i].OpenSkillRules and dowerAllData[i].Level==25 then --特性显示 heroSkill.skillId = dowerAllData[i].OpenSkillRules[1] heroSkill.skillConfig = passiveSkillConfig[heroSkill.skillId] heroSkill.Type = 4 heroSkill.Skilltips = nil heroSkill.Name = nil heroSkill.Icon = GetResourcePath(heroSkill.skillConfig.Icon) local curLv = HeroManager.GetTalismanLv(curHeroData.dynamicId) if curLv >= dowerAllData[i].Level then heroSkill.state = 1 else heroSkill.state = 0 end heroSkill.quality = 0 table.insert(skillList, heroSkill) end end else heroSkill.state = -1 end --天赋 local heroSkill = {} heroSkill.skillId = 0 heroSkill.skillConfig = nil heroSkill.Skilltips = nil local OpenPassiveSkillRules = curHeroData.star >= HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules OpenPassiveSkillRules=GetPassiveByMaxStar(curHeroData.heroConfig,OpenPassiveSkillRules) LogError("breakid=="..curHeroData.breakId.." upstarid=="..curHeroData.upStarId) if OpenPassiveSkillRules then local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId) -- LogError("#OpenPassiveSkillRules=="..#OpenPassiveSkillRules.." compoundNum=="..compoundNum) heroSkill.Name = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum heroSkill.state = 1 if curHeroData.star == 11 then heroSkill.Icon = "r_tongyong_feisheng_icon1" --飞升一 heroSkill.Type = 8 heroSkill.quality = 1 elseif curHeroData.star == 12 then heroSkill.Icon = "r_tongyong_feisheng_icon2" --飞升二 heroSkill.Type = 8 heroSkill.quality = 1 elseif curHeroData.star > 13 then heroSkill.Icon = "r_tongyong_feisheng_icon3" --飞升三 heroSkill.Type = 8 heroSkill.quality = 1 -- elseif curHeroData.star == 11 then -- heroSkill.Icon = "r_tongyong_tianfu_icon" --觉醒 -- heroSkill.Type = 7 -- heroSkill.quality = 1 elseif curHeroData.heroConfig.Natural <= 5 then heroSkill.Icon = "r_tongyong_feisheng_icon" --9星以下 heroSkill.Type = 5 heroSkill.quality = 0 elseif curHeroData.heroConfig.Natural == 6 or curHeroData.heroConfig.Natural == 7 then heroSkill.Icon = "r_tongyong_tianfu_icon" --10星 heroSkill.Type = 6 heroSkill.quality = 0 end table.insert(skillList, heroSkill) else heroSkill.state = -1 end --神魂 local heroSkill = {} heroSkill.skillId = 0 heroSkill.skillConfig = nil heroSkill.Type = 9 heroSkill.Skilltips = nil heroSkill.Name = nil heroSkill.Icon = "r_tongyong_shenhun_icon" if curHeroData.star < 11 or curHeroData.heroConfig.IsSoulOpen == 0 then heroSkill.state = -1 else if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun) then heroSkill.state = -1 heroSkill.Name = "100级开启" else heroSkill.state = 1 heroSkill.quality = 1 table.insert(skillList, heroSkill) end end return skillList end function this.SetSelectSkillImage(parent) this.selsectSkillImage:SetActive(true) this.selsectSkillImage.transform:SetParent(parent.transform) this.selsectSkillImage.transform.localPosition = Vector3.zero this.selsectSkillImage.transform.localScale = Vector3.one end --单个技能显示 function this.UpdateHeroUpStarProUpSkillShowOld(skillGridGO,skillTabs,passiveSkills) this.skillGridCanvas.sortingOrder = this.sortingOrder + 1 this.skillData = this.GetSkillsData() for i = 1,math.max(#this.skillList,#this.skillData) do this.skillList[i].icon.gameObject:GetComponent("Button").onClick:RemoveAllListeners() if not this.skillData[i] then this.skillList[i].go.gameObject:SetActive(false) else this.skillList[i].go.gameObject:SetActive(true) if this.skillData[i].quality == 0 then this.skillList[i].frame.gameObject:SetActive(false) else this.skillList[i].frame.gameObject:SetActive(true) end this.skillList[i].pos.sprite=this.spLoader:LoadSprite(SkillIconType[this.skillData[i].skillConfig.Type])--被动技 this.skillList[i].pos:SetNativeSize() if this.skillData[i].skillConfig.Skilltips and this.skillData[i].skillConfig.Skilltips > 0 then if this.skillData[i].skillConfig.Skilltips == 6 then this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_lvdi")--被动技 else this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_hongdi")--被动技 end this.skillList[i].pro.gameObject:SetActive(true) this.skillList[i].pro:SetNativeSize() this.skillList[i].proText.text=SkillProType[this.skillData[i].skillConfig.Skilltips] else this.skillList[i].pro.gameObject:SetActive(false) end this.skillList[i].skillName.text= GetLanguageStrById(this.skillData[i].skillConfig.Name)--(curSkillData.skillId % 10) this.skillList[i].icon.sprite=this.spLoader:LoadSprite(GetResourcePath(this.skillData[i].skillConfig.Icon))--被动技 if this.skillData[i].state == 0 then local str = NumToChinese[this.skillData[i].star].."星" if this.skillData[i].star > 10 then str = "飞升"..NumToChinese[this.skillData[i].star - 10] end this.skillList[i].skillName.text = str.."解锁" Util.SetGray(this.skillList[i].go,true) else Util.SetGray(this.skillList[i].go,false) end Util.AddOnceClick(this.skillList[i].icon.gameObject, function() this.SetSelectSkillImage(this.skillList[i].icon.gameObject) local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,this.skillData[i].skillConfig.Type) if this.skillData[i].skillType == 0 then this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId)) else local awakenSkillList = this.GetAwakenSkill() this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId),awakenSkillList[i-2]) end this.skillGridCanvas.sortingOrder = this.skillPanel.sortingOrder + 1 end) end end if #this.skillData > 2 then this.line1.gameObject:SetActive(true) else this.line1.gameObject:SetActive(false) end if #this.skillData > 5 then this.line2.gameObject:SetActive(true) else this.line2.gameObject:SetActive(false) end end --单个技能显示 function this.UpdateHeroUpStarProUpSkillShow(skillGridGO,skillTabs,passiveSkills) this.skillPanelId = 0 this.skillGridCanvas.sortingOrder = this.sortingOrder + 1 this.skillData = this.GetSkillsData() for i = 1,math.max(#this.skillList,#this.skillData) do this.skillBtnsList[i].gameObject:GetComponent("Button").onClick:RemoveAllListeners() if not this.skillData[i] then this.skillList[i].go.gameObject:SetActive(false) this.skillBtnsList[i].gameObject:SetActive(false) elseif this.skillData[i].state == -1 then this.skillList[i].go.gameObject:SetActive(false) this.skillBtnsList[i].gameObject:SetActive(false) else this.skillList[i].go.gameObject:SetActive(true) this.skillBtnsList[i].gameObject:SetActive(true) if this.skillData[i].quality == 0 then this.skillList[i].frame.gameObject:SetActive(false) else this.skillList[i].frame.gameObject:SetActive(true) end this.skillList[i].pos.sprite=this.spLoader:LoadSprite(SkillIconType[this.skillData[i].Type])--被动技 this.skillList[i].pos:SetNativeSize() if this.skillData[i].Skilltips and this.skillData[i].Skilltips > 0 then if this.skillData[i].Skilltips == 6 then this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_lvdi")--被动技 else this.skillList[i].pro.sprite=this.spLoader:LoadSprite("r_hero_hongdi")--被动技 end this.skillList[i].pro.gameObject:SetActive(true) this.skillList[i].proText.text=SkillProType[this.skillData[i].Skilltips] else this.skillList[i].pro.gameObject:SetActive(false) end this.skillList[i].icon.sprite=this.spLoader:LoadSprite(this.skillData[i].Icon)--被动技 if this.skillData[i].Name then this.skillList[i].skillName.text = this.skillData[i].Name this.skillList[i].skillIma.gameObject:SetActive(true) else this.skillList[i].skillName.text = "" this.skillList[i].skillIma.gameObject:SetActive(false) end if this.skillData[i].state == 0 then Util.SetGray(this.skillList[i].go,true) else Util.SetGray(this.skillList[i].go,false) end Util.AddOnceClick(this.skillBtnsList[i].gameObject, function() this.SetSelectSkillImage(this.skillList[i].icon.gameObject) if this.skillPanel then UIManager.ClosePanel(this.skillPanelId) end if this.skillData[i].Type < 5 then local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,this.skillData[i].Type) if this.skillData[i].Type == 4 and this.skillData[i].state == 0 then this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId),"\n(法宝25级解锁)") this.skillPanelId = UIName.SkillInfoPopup else this.skillPanel = UIManager.OpenPanel(UIName.SkillInfoPopup,this.skillData[i],1,10,maxLv,i,nil,GodSoulManager.GetGodSoulLv(curHeroData.dynamicId)) this.skillPanelId = UIName.SkillInfoPopup end else if this.skillData[i].Type > 4 and this.skillData[i].Type < 9 then this.skillPanel = UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId) this.skillPanelId = UIName.RoleTalentPopup elseif this.skillData[i].Type == 9 then if this.skillData[i].state == 0 then this.skillPanel = UIManager.OpenPanel(UIName.RoleGodSoulLayout,curHeroData.heroConfig,11) this.skillPanelId = UIName.RoleGodSoulLayout else this.skillPanel = UIManager.OpenPanel(UIName.RoleGodSoulLayout,curHeroData) this.skillPanelId = UIName.RoleGodSoulLayout end end end this.skillGridCanvas.sortingOrder = this.skillPanel.sortingOrder + 1 end) end end if #this.skillData > 2 then this.line1.gameObject:SetActive(true) this.line3.gameObject:SetActive(true) else this.line1.gameObject:SetActive(false) this.line3.gameObject:SetActive(false) end if #this.skillData > 4 then this.line2.gameObject:SetActive(true) this.line4.gameObject:SetActive(true) else this.line2.gameObject:SetActive(false) this.line4.gameObject:SetActive(false) end end --更新英雄升级 和 突破 的材料显示 function this:UpdateHeroUpLvAndBreakMaterialShow() if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then costItemList=upTuPoRankUpConfig.ConsumeMaterial else costItemList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume end if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then this.noUpLvText:SetActive(true) this.upLv:SetActive(false) -- 长按升到最大级了,会无法触发抬起事件,主动调用一下 if _isLongPress then this._onPointerUp() end else this.noUpLvText:SetActive(false) this.upLv:SetActive(true) isUpLvMaterials=true for i = 1, math.max(#this.costList,#costItemList) do this.costList[i].go.gameObject:GetComponent("Button").onClick:RemoveAllListeners() if not costItemList[i] then this.costList[i].go.gameObject:SetActive(false) else if not this.costList[i] then else this.costList[i].go.gameObject:SetActive(true) this.costList[i].icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(costItemList[i][1])) if BagManager.GetItemCountById(costItemList[i][1])%s",costItemList[i][2]) else this.costList[i].costText.text=string.format("%s",costItemList[i][2]) end Util.AddOnceClick(this.costList[i].go.gameObject,function() UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1]) end) end end end end this.isGongMing = HarmonyManager.IsGongMing(curHeroData) if this.isGongMing then this.gongmingText:SetActive(true) this.hognmengbeiTip.gameObject:SetActive(HarmonyManager:HongMengTowerUpLimit() > 0) this.hognmengzhenTip.gameObject:SetActive(not (HarmonyManager:HongMengTowerUpLimit() > 0)) this.upLv:SetActive(false) this.noUpLvText:SetActive(false) return else this.gongmingText:SetActive(false) end --红点检测 local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData) this.upLvBtnRedPoint:SetActive(upLvRedpoint) this.upMaxLvBtnRedPoint:SetActive(upLvRedpoint) parent:CheckRedPointType(RoleInfoPanelIndex.qingbao,upLvRedpoint) end --获取当前英雄的下一突破 和 升星 静态数据 function RoleInfoLayout:GetCurHeroUpLvOrUpStarSData() isHeroUpTuPo = false isHeroUpStar = false upTuPoRankUpConfig = {} upStarRankUpConfig = {} local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) for i, v in ConfigPairs(heroRankUpConfig) do if v.Star==curHeroData.heroConfig.Star then--初始星级相等 if v.Show==1 then -- 1 突破 if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then--and curHeroData.star == v.LimitStar -- Log("突破 "..v.Id) isHeroUpTuPo = true upTuPoRankUpConfig = v end end if v.Show==2 then -- 2 升星 if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then -- Log("升星 "..v.Id) upStarRankUpConfig=v isHeroUpStar=true end end end end -- Log("isHeroUpTuPo:"..tostring(isHeroUpTuPo).." isHeroUpStar:"..tostring(isHeroUpStar)) end --更新英雄升级 和 突破数据 function this:UpdateHeroUpLvAndBreakData() -- 升级获取突破 和 升星相应heroRankUpConfig静态数据 --LogError("isHeroUpStar "..tostring(isHeroUpStar)) if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then--当前突破全部完成 this.itemGrid.gameObject:SetActive(true) this.tipUpLv.gameObject:SetActive(false) this.upLvBtnText.text=Language[11805] this.upMaxLvBtn.gameObject:SetActive(false) this.tipUpLv.text=Language[11804] this.tipUpLv.gameObject:SetActive(false) else this.upLvBtnText.text=Language[11063] this.upMaxLvBtn.gameObject:SetActive(true) if isHeroUpStar and curStarRankUpConfig and curHeroData.lv >= curStarRankUpConfig.OpenLevel then--当前突破全部完成 this.tipUpLv.text=Language[11804] this.tipUpLv.gameObject:SetActive(false) this.itemGrid.gameObject:SetActive(true) else this.itemGrid.gameObject:SetActive(true) this.tipUpLv.gameObject:SetActive(false) end end this:UpdateHeroUpLvAndBreakMaterialShow() end function RoleInfoLayout:OnSortingOrderChange() end --升级按钮点击事件处理 function RoleInfoLayout:LvUpClick(isSingleLvUp) if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then PopupTipPanel.ShowTip(Language[11788]) _isClicked = false _isLongPress = false this.isPressed = false timer = 0 return end --可以升星 是当前星级突破已满,等级也到了突破最大等级 if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成 if curStarRankUpConfig then--进阶过处理 --等级到达当前星级开放的最大等级 if curHeroData.lv == curStarRankUpConfig.OpenLevel then --是否能升星 if curHeroData.star >= curHeroData.heroConfig.MaxRank then MsgPanel.ShowOne("当前英雄已达最大星级") return end _isClicked = false local showTipStr = Language[11808] local showIndex = RoleInfoPanelIndex.jinjie local showBtnTipStr = Language[11809] if curHeroData.star == HeroManager.awakeStarIndex then showTipStr = Language[11810] showBtnTipStr = Language[11811] showIndex = RoleInfoPanelIndex.juexing end if showIndex == RoleInfoPanelIndex.juexing then if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then MsgPanel.ShowTwo(showTipStr, nil, function() parent:SetSelectBtn(showIndex) parent:OnPageTabChange(showIndex) end,Language[10731],showBtnTipStr) else PopupTipPanel.ShowTip(Language[11812])--需要先进行觉醒! end else MsgPanel.ShowTwo(showTipStr, nil, function() parent:SetSelectBtn(showIndex) parent:OnPageTabChange(showIndex) end,Language[10731],showBtnTipStr) end else if isHeroUpTuPo and oldLv == upTuPoRankUpConfig.LimitLevel then --点击按钮之前的等级 == 突破最大等级 说明是突破 if isUpLvMaterials then this:DeleteLvUpMaterials() else --PopupTipPanel.ShowTip(Language[11813]) this:ShowCostNotEnoughTip() end _isClicked = false _isLongPress = false this.isPressed = false timer = 0 elseif not isHeroUpTuPo or curHeroData.lv < upTuPoRankUpConfig.LimitLevel then if isUpLvMaterials then this:DeleteLvUpMaterials() else _isClicked = false if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then this:ShowCostNotEnoughTip() else this:ShowCostNotEnoughTip() end end end end else--从未进阶过处理 _isClicked = false MsgPanel.ShowTwo(Language[11808], nil, function() parent:SetSelectBtn(RoleInfoPanelIndex.jinjie) parent:OnPageTabChange(RoleInfoPanelIndex.jinjie) end,Language[10731],Language[11809]) end elseif isHeroUpTuPo and oldLv == upTuPoRankUpConfig.LimitLevel then --点击按钮之前的等级 == 突破最大等级 说明是突破 if isUpLvMaterials then this:DeleteLvUpMaterials() else this:ShowCostNotEnoughTip() end _isClicked = false _isLongPress = false this.isPressed = false timer = 0 elseif not isHeroUpTuPo or curHeroData.lv < upTuPoRankUpConfig.LimitLevel then if isUpLvMaterials then this:DeleteLvUpMaterials() else this:ShowCostNotEnoughTip() _isClicked = false _isLongPress = false this.isPressed = false timer = 0 end end end function RoleInfoLayout:ShowCostNotEnoughTip() if isHeroUpTuPo then PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法突破") else PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法升级") end local item=BagManager.GetItemDataByTimeIsGold(costId) if item then UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 4,item) else UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costId) end --local _itemData = BagManager.bagDatas[itemSid] --if costId==4 then --end end function RoleInfoLayout:CalUpMaxLv() local calOldLv=curHeroData.lv local upMaxCostList={} for i = curHeroData.lv, this.GetCurHeroLvLimit() do local costList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, i).Consume for j = 1, #costList do local costxxId=costList[j][1] local costxxNum=costList[j][2] if upMaxCostList[costxxId] then costxxNum=costxxNum+upMaxCostList[costxxId] end local havexxNum= BagManager.GetItemCountById(costList[j][1]) if havexxNum 0.4 then if timer <= 0 then timer = timer + 0.1 _isLongPress = true this:LvUpClick(false) end if Time.frameCount - oldFrame > 0 then oldFrame = Time.frameCount timer = timer - Time.deltaTime end end end end --播放升级 属性提升动画 function this.ShowProAddVal(allAddProValOld) this.lvUpGo:SetActive(true) Util.GetGameObject(lvUpShowProList[1], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Attack]-allAddProValOld[HeroProType.Attack] Util.GetGameObject(lvUpShowProList[2], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Hp]-allAddProValOld[HeroProType.Hp] Util.GetGameObject(lvUpShowProList[3], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.PhysicalDefence]-allAddProValOld[HeroProType.PhysicalDefence] Util.GetGameObject(lvUpShowProList[4], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.MagicDefence]-allAddProValOld[HeroProType.MagicDefence] --Util.GetGameObject(lvUpShowProList[5], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Speed]-allAddProValOld[HeroProType.Speed] this.ThreadShowProAddVal() end function this.ThreadShowProAddVal() if this.priThread then coroutine.stop(this.priThread) this.priThread = nil end table.walk(lvUpShowProList, function(privilegeItem) privilegeItem:SetActive(false) end) this.priThread = coroutine.start(function() for i = 1, 4 do lvUpShowProList[i]:SetActive(false) PlayUIAnims(lvUpShowProList[i]) coroutine.wait(0.04) lvUpShowProList[i]:SetActive(true) coroutine.wait(0.08) end this.lvUpGo:SetActive(false) end) end function RoleInfoLayout:OnHide() self.gameObject:SetActive(false) end function RoleInfoLayout:OnClose() FixedUpdateBeat:Remove(this.OnUpdate, self) if this.priThread then coroutine.stop(this.priThread) -- 关闭显示 for i = 1, 4 do lvUpShowProList[i]:SetActive(false) end this.lvUpGo:SetActive(false) this.priThread = nil end this.proList = {} this.skillList = {} this.costList = {} end return RoleInfoLayout