local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)require("Base/BasePanel") RoleProInfoPopup = Inherit(BasePanel) local this=RoleProInfoPopup local sDataTable = { [1] = {name = Language[11432],showType = 1}, [2] = {name = Language[11822],showType = 2}, [3] = {name = Language[11823],showType = 3}, } local allPro = {}--所有属性 三维数组 local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local fristProGoList = {} local secondProGoList = {} local thirdlyProGoList = {} local allAddProVal local heroSConFig local isShowGuild = true local ProGoList --初始化组件(用于子类重写) function RoleProInfoPopup:InitComponent() this.spLoader = SpriteLoader.New() this.btnBack=Util.GetGameObject(self.transform, "btnBack") this.proPre1=Util.GetGameObject(self.gameObject, "proPre1") this.proPre2=Util.GetGameObject(self.gameObject, "proPre2") this.fristGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (1)/Mask") this.secondGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (2)/Mask") this.thirdlyGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)/Mask") this.thirdlyGridP=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)") if not ProGoList then -- 构建数据 local ProDataList = {} for _, propConfig in ConfigPairs(propertyConfig) do if propConfig.IfShow == 1 or propConfig.IfShow == 2 then table.insert(ProDataList, propConfig) end end table.sort(ProDataList, function (a,b)return a.SortId < b.SortId end) -- 构建显示节点 ProGoList = {} local FirstIndex = 0 local SecondIndex = 0 local curFirstPre, curSecondPre for _, propConfig in ipairs(ProDataList) do local propId = propConfig.PropertyId if propConfig.IfShow == 1 then if FirstIndex == 0 then curFirstPre = newObjToParent(this.proPre1, this.fristGrid) Util.GetGameObject(curFirstPre, "pro1"):SetActive(false) Util.GetGameObject(curFirstPre, "pro2"):SetActive(false) end local pro = Util.GetGameObject(curFirstPre, "pro"..FirstIndex+1) pro:SetActive(true) ProGoList[propId] = { propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"), propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text") } FirstIndex = (FirstIndex + 1) % 2 elseif propConfig.IfShow == 2 then if SecondIndex == 0 then curSecondPre = newObjToParent(this.proPre1, this.secondGrid) Util.GetGameObject(curSecondPre, "pro1"):SetActive(false) Util.GetGameObject(curSecondPre, "pro2"):SetActive(false) end local pro = Util.GetGameObject(curSecondPre, "pro"..SecondIndex+1) pro:SetActive(true) ProGoList[propId] = { propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"), propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text") } SecondIndex = (SecondIndex + 1) % 2 end end -- 公会数据节点 this.guildPre = newObjToParent(this.proPre2, this.thirdlyGrid) this.jumpBtn = Util.GetGameObject(this.guildPre, "jumpBtn") this.guildProName = Util.GetGameObject(this.guildPre, "proName"):GetComponent("Text") this.guildProValue = Util.GetGameObject(this.guildPre, "proVale"):GetComponent("Text") end end --绑定事件(用于子类重写) function RoleProInfoPopup:BindEvent() Util.AddClick(this.btnBack, function() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) Util.AddOnceClick(this.jumpBtn, function() JumpManager.GoJump(73001) end) end -- 设置属性显示 function RoleProInfoPopup.SetProShow(go, id, value) go.propName.text = GetLanguageStrById(propertyConfig[id].Info)..":" value = value or 0 if propertyConfig[id].Style == 1 then go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value) elseif propertyConfig[id].Style == 2 then go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value*100) end end --界面打开时调用(用于子类重写) function RoleProInfoPopup:OnOpen(_allAddProVal,_configData,_isShowGuild,_guildSkill) -- 设置属性显示 for _proId, go in pairs(ProGoList) do this.SetProShow(go, _proId, _allAddProVal[_proId]) end this.thirdlyGridP:SetActive(_isShowGuild) if not _configData then return end if _isShowGuild then --加公会技能特殊属性 local allLv = _isShowGuild and GuildSkillManager.GetAllGuildSkillLv(_configData.Profession) or 0 if _guildSkill then allLv = _guildSkill end this.guildProName.text = Language[11061]..GuildSkillType[_configData.Profession] this.guildProValue.text = allLv -- 跳转按钮如果设置的公会技能等级,说明是别人,就不显示跳转 this.jumpBtn:SetActive(_guildSkill == nil) end if not this.specialPro then this.specialPro = {} end for k,v in pairs(this.specialPro) do v.go.gameObject:SetActive(false) end local index = 1 local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(_configData.Id) if totalLv > 0 then if not this.specialPro[index] then this.specialPro[index] = {} this.specialPro[index].go = newObjToParent(this.proPre2,this.thirdlyGrid) this.specialPro[index].jumpBtn = Util.GetGameObject(this.specialPro[index].go, "jumpBtn") this.specialPro[index].guildProName = Util.GetGameObject(this.specialPro[index].go, "proName"):GetComponent("Text") this.specialPro[index].guildProValue = Util.GetGameObject(this.specialPro[index].go, "proVale"):GetComponent("Text") end this.specialPro[index].go.gameObject:SetActive(true) this.specialPro[index].guildProName.text = "好感度" this.specialPro[index].guildProValue.text = totalLv Util.AddOnceClick(this.specialPro[index].jumpBtn, function() JumpManager.GoJump(40033) end) end index = index + 1 end --界面关闭时调用(用于子类重写) function RoleProInfoPopup:OnClose() end --界面销毁时调用(用于子类重写) function RoleProInfoPopup:OnDestroy() this.spLoader:Destroy() this.specialPro = {} ProGoList = nil end return RoleProInfoPopup