--新的命格管理 GemNewManager = {} local this = GemNewManager local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfigNew) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) function this.Initialize() this.myGemList = {}--我穿戴命石的id this.sperGemList ={} --高级命石 this.typeGemList = {} this.timer=nil this.oldPower=0 this.gemLottery = {0,0} --抽卡次数记录 local value=ConfigManager.GetConfigData(ConfigName.SpecialConfig,169).Value this.drawLimit = string.split(value,"#") end function this.GetLimitNumByType(_type) return tonumber(this.drawLimit[_type]) end --初始化命石 function this.InitGemsInfo(msg) if msg==nil then return end local gemsData=msg.gems if gemsData==nil then return end local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) local isChange=false --LogError("gemsData len==========="..#gemsData) this.myGemList={} this.sperGemList={} for i=1,#gemsData do local id=gemsData[i].id local config=gemConfig[id] local proList=gemsData[i].attr local data={} data.id=id data.config=config data.sId = id data.backData = gemsData[i] data.configData = config --local itemConfig = itemConfig[drop.pokemon[i].tempId] data.name = config.Name -- itemdata.config=itemConfig data.ItemType = 31--itemConfig.ItemType data.frame = GetQuantityImageByquality(config.Quality) data.icon = GetResourcePath(config.Image) data.num = 1 --LogError("gemsData[i].isReplace================"..gemsData[i].isReplace) if gemsData[i].isReplace==1 then isChange=true data.isReplace=true else data.isReplace=false end local pros={} for j=1,#proList do --pros[proList[j].id]=proList[j].value pros[j]={proList[j].id,proList[j].value} end data.pro=pros if config.Library==1 then this.myGemList[config.Type]=data else this.sperGemList[config.Type]=data end end HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Gem) HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Gift) -- --获取新战力 -- NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL) -- local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) -- LogError("oldwar===="..oldWarPower.." temppower=="..tempPower) -- if oldWarPower ~= tempPower then -- UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower}) -- end -- if this.timer~=nil then -- this.timer:Stop() -- this.timer=nil -- end -- this.timer = Timer.New(function () -- LogError("****************************") -- Game.GlobalEvent:DispatchEvent(GameEvent.Gem.RefreshPanel) -- end, 3) -- this.timer:Start() end function this.CheckGemRed() local actconfigs=ActivityGiftManager.GetActivityInfoByType(12301) local isOpen=CheckFunctionOpen(144) if isOpen==false then return false end local progresss=0 if actconfigs then for i = 1,#actconfigs.mission do progresss=actconfigs.mission[i].progress local config=ConfigManager.GetConfigData(ConfigName.GemLotteryConfig,actconfigs.mission[i].missionId) --ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",curType,"Level",actconfigs.mission[i].missionId) if actconfigs.mission[i].state==0 and progresss>=config.LibraryNumber then return true end end end return false end function this.CheckSuperGemRed() local isOpen=CheckFunctionOpen(145) if isOpen==false then return false end local actconfigs=ActivityGiftManager.GetActivityInfoByType(12401) local progresss=0 if actconfigs then for i = 1,#actconfigs.mission do progresss=actconfigs.mission[i].progress local config=ConfigManager.GetConfigData(ConfigName.GemLotteryConfig,actconfigs.mission[i].missionId) --ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.GemLotteryConfig,"Library",curType,"Level",actconfigs.mission[i].missionId) if actconfigs.mission[i].state==0 and progresss>=config.LibraryNumber then return true end end end return false end --获取所有属性 function this.GetAllAttri() local data = {} --命石 for k, v in pairs(this.myGemList) do if v.pro and #v.pro>0 then for j=1,#v.pro do local proId=v.pro[j][1] local value=v.pro[j][2] if not data[proId] then data[proId] = 0 end if propertyConfig[proId] then if propertyConfig[proId].Style==1 then data[proId] = data[proId] + value elseif propertyConfig[proId].Style==2 then data[proId] = data[proId] + value end end end end end --高级命石 for k, v in pairs(this.sperGemList) do if v.pro and #v.pro>0 then for j=1,#v.pro do local proId=v.pro[j][1] local value=v.pro[j][2] if not data[proId] then data[proId] = 0 end if propertyConfig[proId] then if propertyConfig[proId].Style==1 then data[proId] = data[proId] + value elseif propertyConfig[proId].Style==2 then data[proId] = data[proId] + value end end end end end return data end function this.ChangeOneGemData(_gem) local gemsData={} local config=gemConfig[_gem.id] gemsData.id=_gem.id gemsData.config=config gemsData.sId = _gem.id gemsData.backData = _gem gemsData.configData = config --local itemConfig = itemConfig[drop.pokemon[i].tempId] gemsData.name = config.Name -- itemdata.config=itemConfig gemsData.ItemType = 31--itemConfig.ItemType gemsData.frame = GetHeroQuantityImageByquality(config.Quality) gemsData.icon = GetResourcePath(config.Image) gemsData.num = 1 local pros={} local proList=_gem.attr for j=1,#proList do --pros[proList[j].id]=proList[j].value pros[j]={proList[j].id,proList[j].value} end gemsData.pro=pros return gemsData end --根据类型获取属性 function this.GetProListByType(type) local list=nil local proList={} if type==1 then list=this.myGemList else list=this.sperGemList end for k, v in pairs(list) do if v.pro then for i=1,#v.pro do if proList[v.pro[i][1]] then proList[v.pro[i][1]]=proList[v.pro[i][1]]+v.pro[i][2] else proList[v.pro[i][1]]=v.pro[i][2] end end end end for k, v in pairs(proList) do --LogError("k=========="..k.." v======="..v) end return proList end --根据类型获取集合 function this.GetGemListByType(type) if type==1 then return this.myGemList else return this.sperGemList end end return this