RecruitManager = {} local this = RecruitManager local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting) local lotteryRewardConfig = ConfigManager.GetConfig(ConfigName.LotteryRewardConfig) local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) local dailyRewardConfig = ConfigManager.GetConfig(ConfigName.DialRewardConfig) this.recruitSubIndex = 0 --活动抽卡类型(动态的数据) local drawtType={ FindFairySingle=0, FindFairyTen=0 } this.freeUseTimeList={} --免费抽卡容器 this.recruit3MustCount = 0 this.recruit2MustCount = 0 function this.SetRecruit3MustCount(count) this.recruit3MustCount = count end function this.GetRecruit3MustCount() return this.recruit3MustCount end function this.SetRecruit2MustCount(count) this.recruit2MustCount = count end function this.GetRecruit2MustCount() return this.recruit2MustCount end function this.Initialize() this.drawTimes = {} --英雄抽卡已招募次数 this.isCanOpenBox = false this.boxReward = {} this.recruitFreeUseTime = 0 --现在只剩下秘盒招募在用了 this.isTenRecruit = 0 --首次十连 this.WishCardData = {} this.WishEquipData = {} this.wishSoulData={} this.isFirstEnterElementScroll=true this.isFirstEnterHeroScroll=true this.wishHeroId=0 this.wishEquipId=0 this.curWishType=0 this.InitPreData() this.newWishList = {}--心愿抽新增的神将 this.openTime = PlayerManager.GetServerOpenTime() --开服时间戳或是0(用于判断心愿神将是否加入卡池) this.wishTailsManSoulChips = {} end function this.SetWishId(count) this.wishHeroId = count end function this.GetWishId() return this.wishHeroId end function this.SetWishTailsManSoulChips(_datas) this.wishTailsManSoulChips = {} for k,v in pairs(_datas) do table.insert(this.wishTailsManSoulChips,v) end end function this.GetWishTailsManSoulChips() local datas = {} for k,v in pairs(this.wishTailsManSoulChips) do table.insert(datas,v) end return datas end local wishPro=20 function this.SetWishPro(pro) wishPro=pro end function this.GetWishPro() return wishPro end function this.CheckIsUpTailsManSoulChip(id) if this.upTailsManSoulChip[id] then return true else return false end end function this.GetIsUpTailsManSoulChip() this.upTailsManSoulChip = {} local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.tiandihonglu) if not id or id < 1 then return end local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",id) local singleRecruit = array[1] local poolId = singleRecruit.DiamondBoxContain[1][1] local configs = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId) for k,v in ipairs(configs) do this.upTailsManSoulChip[v.Reward[1]] = v.Reward[2] end poolId = singleRecruit.MergePool poolId = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",poolId).pool_id local configs1 = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId) for k,v in ipairs(configs1) do this.upTailsManSoulChip[v.Reward[1]] = v.Reward[2] end end --请求抽卡 1抽卡类型 2回调 3特权id function this.RecruitRequest(recruitType, func, privilegeId,_itemId,_itemNum) local itemId = 0 local itemNum = 0 local freeTimesId = ConfigManager.GetConfigData(ConfigName.LotterySetting,RecruitType.LingShowSingle).FreeTimes if privilegeId == freeTimesId then itemId = _itemId itemNum = _itemNum else local data=this.GetExpendData(recruitType) itemId,itemNum=data[1],data[2] --默认 end --Log("BagManager.GetItemCountById(itemId) ".. BagManager.GetItemCountById(itemId).." itemNum "..itemNum) --Log(tostring(this.freeUseTimeList[privilegeId])) if BagManager.GetItemCountById(itemId) >= itemNum or (this.freeUseTimeList[privilegeId] and this.freeUseTimeList[privilegeId] >= 1) then NetManager.RecruitRequest(recruitType, function(msg) local data = ConfigManager.GetConfigData(ConfigName.LotterySetting,recruitType) if (RecruitType.Single == recruitType or RecruitType.NormalSingle==recruitType or (data.LotteryType == 3 and data.PerCount == 1) or(data.LotteryType == 9 and data.PerCount == 1) or RecruitType.LingShowSingle== recruitType ) or (data.LotteryType == 10 and data.PerCount == 1) or (data.LotteryType == 11 and data.PerCount == 1)then --若某抽卡类型有免费次数 if this.freeUseTimeList[privilegeId] and this.freeUseTimeList[privilegeId] >= 1 then PrivilegeManager.RefreshPrivilegeUsedTimes(privilegeId, 1) this.freeUseTimeList[privilegeId] = PrivilegeManager.GetPrivilegeRemainValue(privilegeId) -- CheckRedPointStatus(RedPointType.Recruit_Red) CheckRedPointStatus(RedPointType.TimeLimited) CheckRedPointStatus(RedPointType.TimeLimitWish) CheckRedPointStatus(RedPointType.QianKunBox) CheckRedPointStatus(RedPointType.Pokemon_Recruit) end end CheckRedPointStatus(RedPointType.Recruit_Normal) if func then func(msg) end end) end end --记录所有抽卡类型的抽卡次数 function this.SetAllDrawTimes(_allData) for i = 1, #_allData do if not this.drawTimes[_allData[i].type] then this.drawTimes[_allData[i].type] = {} end this.drawTimes[_allData[i].type] = _allData[i].num > 0 and _allData[i].num or 0 end end --5点刷新数据 function this.RefreshFreeTime() this.freeUseTimeList[38] = PrivilegeManager.GetPrivilegeRemainValue(38) this.freeUseTimeList[14] = PrivilegeManager.GetPrivilegeRemainValue(14) this.freeUseTimeList[32] = PrivilegeManager.GetPrivilegeRemainValue(32) this.freeUseTimeList[99] = PrivilegeManager.GetPrivilegeRemainValue(99) this.freeUseTimeList[2005] = PrivilegeManager.GetPrivilegeRemainValue(2005) if (ActTimeCtrlManager.SingleFuncState(1)) then -- CheckRedPointStatus(RedPointType.Recruit_Red) CheckRedPointStatus(RedPointType.Recruit_Normal) CheckRedPointStatus(RedPointType.Recruit_ShenJiang) CheckRedPointStatus(RedPointType.Recruit_Friend) CheckRedPointStatus(RedPointType.TimeLimited) CheckRedPointStatus(RedPointType.TimeLimitWish) CheckRedPointStatus(RedPointType.QianKunBox) end Game.GlobalEvent:DispatchEvent(GameEvent.Recruit.OnRecruitRefreshData) end function this.InitPreData() this.previewHeroData = {} this.previewFriendData={} this.previewNormalData={} this.previewElementData={} this.previewLuckData = {} --- 幸运探宝 this.previewLingShou={} --灵兽奖励数据 this.previewGhostFindData = {} -- this.previewTimeLimitedData = {}--限时招募 -- this.previewTimeLimitedUPData={} -- this.previewLotterySoulData = {}--乾坤宝囊其他奖励 -- this.previewLotterySoulUPData={}--乾坤宝囊魂印up保底 if(#this.previewHeroData>=1) then return end for i, v in ConfigPairs(lotteryRewardConfig) do if(v.Pool==1) then--钻石招募 table.insert(this.previewHeroData, v) elseif v.Pool==2 then--友情 table.insert(this.previewFriendData,v) elseif v.Pool==3 then --普抽 table.insert(this.previewNormalData,v) elseif(v.Pool==11 or v.Pool==12 or v.Pool==13 or v.Pool==14) then-- or v.Pool==15 光暗被移除 table.insert(this.previewElementData, v) elseif v.Pool==5001 then table.insert(this.previewLingShou,v) end end for key, value in ConfigPairs(dailyRewardConfig) do if value.ActivityId == 30 then table.insert( this.previewLuckData, value) else table.insert( this.previewGhostFindData, value) end end if #this.previewLuckData > 1 then table.sort(this.previewLuckData, function(a, b) return a.Rank < b.Rank end) end if #this.previewGhostFindData > 1 then table.sort(this.previewGhostFindData, function(a, b) return a.Rank < b.Rank end) end --灵兽奖品排序 if #this.previewLingShou > 1 then table.sort(this.previewLingShou, function(a, b) --判断品质 if itemConfig[a.Reward[1]].Quantity == itemConfig[b.Reward[1]].Quantity then --判断类型 if itemConfig[a.Reward[1]].ItemType==itemConfig[b.Reward[1]].ItemType then --判断id if a.Reward[1] == b.Reward[1] then return a.Reward[2] < b.Reward[2] else return a.Reward[1] < b.Reward[1] end else return itemConfig[a.Reward[1]].ItemType itemConfig[b.Reward[1]].Quantity end end) end table.sort(this.previewHeroData, function(a, b) if itemConfig[a.Reward[1]].HeroStar[2] == itemConfig[b.Reward[1]].HeroStar[2] then if a.Quality == b.Quality then return a.Id < b.Id else return a.Quality > b.Quality end else return itemConfig[a.Reward[1]].HeroStar[2]>itemConfig[b.Reward[1]].HeroStar[2] end end) --友情 table.sort(this.previewFriendData, function(a, b) --if itemConfig[a.Reward[1]].HeroStar[2] == itemConfig[b.Reward[1]].HeroStar[2] then if a.Quality == b.Quality then return a.Id < b.Id else return a.Quality > b.Quality end -- else -- return itemConfig[a.Reward[1]].HeroStar[2]>itemConfig[b.Reward[1]].HeroStar[2] -- end end) --普抽 table.sort(this.previewNormalData, function(a, b) if itemConfig[a.Reward[1]].HeroStar[2] == itemConfig[b.Reward[1]].HeroStar[2] then if a.Quality == b.Quality then return a.Id < b.Id else return a.Quality > b.Quality end else return itemConfig[a.Reward[1]].HeroStar[2]>itemConfig[b.Reward[1]].HeroStar[2] end end) --元素 -- Log("#this.previewElementData:"..#this.previewElementData) table.sort(this.previewElementData, function(a, b) if (itemConfig[a.Reward[1]].Quantity == itemConfig[b.Reward[1]].Quantity) then if (a.Quality == b.Quality) then return a.Id > b.Id else return a.Quality > b.Quality end else return itemConfig[a.Reward[1]].Quantity > itemConfig[b.Reward[1]].Quantity end end) end --获取抽卡奖励预览数据 function this.GetRewardPreviewData(type) if type == PRE_REWARD_POOL_TYPE.RECRUIT then--常驻 return this.previewHeroData elseif type == PRE_REWARD_POOL_TYPE.ELEMENT_RECRUIT then--常驻 return this.previewElementData elseif type == PRE_REWARD_POOL_TYPE.LUCK_FIND then--常驻 return this.previewLuckData elseif type == PRE_REWARD_POOL_TYPE.UPPER_LUCK_FIND then--常驻 return this.previewGhostFindData elseif type ==PRE_REWARD_POOL_TYPE.FRIEND then--常驻 return this.previewFriendData elseif type==PRE_REWARD_POOL_TYPE.NORMAL then--常驻 return this.previewNormalData elseif type==PRE_REWARD_POOL_TYPE.LING_SHOU then--常驻 return this.previewLingShou elseif type==PRE_REWARD_POOL_TYPE.LOTTERY_SOUL--乾坤宝盒 or type==PRE_REWARD_POOL_TYPE.LOTTERY_SOUL_UP--乾坤宝盒UP or type==PRE_REWARD_POOL_TYPE.LING_SHOU_UP--灵兽宝阁UP or type==PRE_REWARD_POOL_TYPE.XIANG_YAO_UP or type==PRE_REWARD_POOL_TYPE.TIANDIHONGLU or type==PRE_REWARD_POOL_TYPE.Incarnation then--降妖夺宝UP return this.GetActivityPreviewData(type)--非常驻抽卡需要检测时间 elseif type==PRE_REWARD_POOL_TYPE.LINGLONG then --限时招募--开启时间有限制的 return this.GetLINGLONGPreviewData() else return {} end end function this.GetLINGLONGPreviewData() local curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.lingLongBaoJing) if not curActivityId or curActivityId < 1 then --活动招募 return {} end local previewData = {} for i, v in ipairs(ConfigManager.GetAllConfigsDataByKey(ConfigName.LingLongPool,"ActivityId",curActivityId)) do if v.ItemId[1] ~= 105 then local data = {} data.Reward = v.ItemId data.ShowWeight = v.FakeRate data.Sort = v.Sort table.insert(previewData, data) end end table.sort(previewData,function(a,b) return a.Sort < b.Sort end) LogGreen("previewData:"..#previewData) return previewData end function this.GetActivityPreviewData(type)--非常驻抽卡奖池预览 local previewData = {} -- 根据当前期获取卡池信息 local curActivityId = nil if type==PRE_REWARD_POOL_TYPE.LOTTERY_SOUL or type==PRE_REWARD_POOL_TYPE.LOTTERY_SOUL_UP then curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.QianKunBox) elseif type==PRE_REWARD_POOL_TYPE.LING_SHOU_UP then curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LingShouBaoGe) elseif type==PRE_REWARD_POOL_TYPE.XIANG_YAO_UP then curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.XiangYaoDuoBao) elseif type==PRE_REWARD_POOL_TYPE.TIANDIHONGLU then curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.tiandihonglu) elseif type==PRE_REWARD_POOL_TYPE.Incarnation then curActivityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Incarnation) end local data = nil if curActivityId ~= nil then --活动招募 --LogGreen("curActivityId:"..curActivityId) data = ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting,"ActivityId",curActivityId,"PerCount",1) else LogRed("活动没开,你不应该看到这儿"..curActivityId) end local poolId = nil if data ~= nil then if type == PRE_REWARD_POOL_TYPE.LOTTERY_SOUL or type == PRE_REWARD_POOL_TYPE.TIANDIHONGLU or type == PRE_REWARD_POOL_TYPE.Incarnation then--限时招募,乾坤宝盒 poolId = data.DiamondBoxContain[1][1] elseif type == PRE_REWARD_POOL_TYPE.LOTTERY_SOUL_UP then--限时招募UP,乾坤宝盒UP data = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",data.MergePool) poolId = data.pool_id elseif type == PRE_REWARD_POOL_TYPE.LING_SHOU_UP or type == PRE_REWARD_POOL_TYPE.XIANG_YAO_UP then--灵兽宝阁,降妖夺宝 poolId = data.DiamondBoxContain[1][1] end else LogRed("lotterySetting表里没有这个活动:"..curActivityId) end for i, v in ConfigPairs(lotteryRewardConfig) do if(v.Pool == poolId) then table.insert(previewData, v) end end table.sort(previewData, function(a, b) if itemConfig[a.Reward[1]].Quantity == itemConfig[b.Reward[1]].Quantity then return a.WeightShow > b.WeightShow else return itemConfig[a.Reward[1]].Quantity > itemConfig[b.Reward[1]].Quantity end end) return previewData end --获取英雄星级数据的最大长度(动态) type 数据类型 star 星级 function this.GetHeroMaxLengthByStar_Dynamic(type,star) local d={} for i, v in ipairs(this.GetRewardPreviewData(type)) do if itemConfig[v.Reward[1]].HeroStar[2]==star then table.insert(d,v) end end return #d end --获取抽卡消耗数据 --根据数据长度遍历;若前者不足 返回后者数据;若都不足 返回最后那组数据;若前者足 显示前者 function this.GetExpendData(type) local d local k=0 for i, v in ipairs(lotterySetting[type].CostItem) do if BagManager.GetItemCountById(v[1])>=v[2] then d=v break else k=k+1 end end local l=#lotterySetting[type].CostItem if k==l then return lotterySetting[type].CostItem[l] end return d end function this.GetExpendDataByCostItem(str,type,LimitNum) local d local k=0 local needNum= 0 if type==1 then needNum=1 else needNum=10 end local cost=nil for key, value in pairs(str) do local bagNum=BagManager.GetItemCountById(value[1]) --不是妖晶 背包数量>=需要数量 if value[1]~=16 then if bagNum>=needNum then return value else cost=value end cost=value else --如果是妖晶 背包有足够妖晶 能抽的次数>=抽的次数 if bagNum>=needNum and LimitNum>=needNum then return value end end end return cost end --抽卡类型 local rType={ Normal=1,--普通 Friend=2,--友情 Hero=3--神将 } --按钮类型 local bType={ Btn1=1, Btn10=2 } --点将台红点状态 function this.GetAllRecruitBtnRedpoint(red) local index = {} if red==RedPointType.Recruit_Friend and CheckFunctionOpen(FUNCTION_OPEN_TYPE.EquipWish)==false then return false end if red == RedPointType.Recruit_Normal then index = {1,2} elseif red == RedPointType.Recruit_Friend then index = {3,4} elseif red == RedPointType.Recruit_ShenJiang then index = {5,6} end for i = 1,#index do if PreConfigure[index[i]] then if this.GetRecruitBtnRedpoint1(PreConfigure[index[i]]) then return true end end end return false end --点将台六个按钮各自红点状态 function this.GetRecruitBtnRedpoint1(preConfig) if preConfig.privilegeId and preConfig.privilegeId > 0 then--普通召唤单抽 神将召唤单抽 return PrivilegeManager.GetPrivilegeRemainValue(preConfig.privilegeId) >= 1 elseif not preConfig.privilegeId then local data = RecruitManager.GetExpendData(preConfig.type) local itemId = data[1] local itemNum = data[2] if itemId ~= 16 and BagManager.GetItemCountById(itemId) >= itemNum then--itemId ~= 16 妖精不算 return true end end return false end --点将台六个按钮各自红点状态 function this.GetRecruitBtnRedpoint(recruitType,privilegeId)--privilegeId 单抽免费特权次数 if recruitType == RecruitType.NormalSingle or recruitType == RecruitType.Single then--普通召唤单抽 神将召唤单抽 if privilegeId then return PrivilegeManager.GetPrivilegeRemainValue(privilegeId) >= 1 end elseif recruitType == RecruitType.FriendTen or recruitType == RecruitType.NormalTen or recruitType == RecruitType.Ten then--所有召唤十连 local data = RecruitManager.GetExpendData(recruitType) local itemId = data[1] local itemNum = data[2] if itemId ~= 16 and BagManager.GetItemCountById(itemId) >= itemNum then--itemId ~= 16 妖精不算 return true end end return false end --===================心愿抽卡界面逻辑=================== function this.GetWishCardData(infoList) this.WishCardData = {} for i = 1, #infoList do this.WishCardData[i] = {} this.WishCardData[i].id = infoList[i].id this.WishCardData[i].heroTid = infoList[i].heroTid this.WishCardData[i].status = infoList[i].status -- LogPink("Id:"..tostring(infoList[i].id).." heroIid:"..tostring(infoList[i].heroTid).." status:"..tostring(infoList[i].status)) this.WishCardData[i].PropertyName = infoList[i].heroTid > 0 and heroConfig[infoList[i].heroTid] and heroConfig[infoList[i].heroTid].PropertyName or nil end end function this.SetWishTalismanData(infoList) this.WishEquipData = {} for i = 1, #infoList do this.WishEquipData[i] = {} this.WishEquipData[i].id = infoList[i].id this.WishEquipData[i].heroTid = infoList[i].heroTid this.WishEquipData[i].status = infoList[i].status LogPink("Id:"..tostring(infoList[i].id).." heroIid:"..tostring(infoList[i].heroTid).." status:"..tostring(infoList[i].status)) this.WishEquipData[i].PropertyName = infoList[i].heroTid > 0 and heroConfig[infoList[i].heroTid] and heroConfig[infoList[i].heroTid].PropertyName or nil end end --心愿魂印 function this.SetWishEquipData(infoList) this.wishSoulData={} for i = 1, #infoList do table.insert(this.wishSoulData,infoList[i].equip) end end function this.SetAllWishEquipData(data) if not data then return end for i = 1, #data do table.insert(this.wishSoulData,data[i]) end end function this.GetWishEquipData() local data={} for i = 1, #this.wishSoulData do table.insert(data,this.wishSoulData[i]) end return data end function this.GetCurHeroList(curIndex) local heroList = {} local time = (GetTimeStamp() - PlayerManager.GetServerOpenTime())/(60*60*24)--开服时间戳或是0(用于判断心愿神将是否加入卡池) for index, v in ipairs(RecruitManager.GetRewardPreviewData(PRE_REWARD_POOL_TYPE.RECRUIT)) do if heroConfig[v.Reward[1]].Star == 5 and heroConfig[v.Reward[1]].PropertyName == curIndex and heroConfig[v.Reward[1]].Weight > 0 and time > heroConfig[v.Reward[1]].JoinWishDay and HeroManager.InVersion(v.Reward[1]) -- 判断神将是否加入版本 then table.insert(heroList,v) end end return heroList end --获取当前神将法宝 function this.GetCurHeroTalismanaList(curIndex) local heroList = {} local time = (GetTimeStamp() - PlayerManager.GetServerOpenTime())/(60*60*24)--开服时间戳或是0(用于判断心愿神将是否加入卡池) for index, v in ipairs(RecruitManager.GetRewardPreviewData(PRE_REWARD_POOL_TYPE.RECRUIT)) do if heroConfig[v.Reward[1]].Star == 5 and (curIndex==0 or heroConfig[v.Reward[1]].PropertyName == curIndex) and heroConfig[v.Reward[1]].Weight > 0 and time > heroConfig[v.Reward[1]].JoinWishDay and HeroManager.InVersion(v.Reward[1]) -- 判断神将是否加入版本 then table.insert(heroList,v.Reward[1]) end end return heroList end --检测当前英雄状态 function this.CheckCurHeroState(_heroTid) for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid == _heroTid then --如果上方存在自己就✔ if this.WishCardData[i].status == 0 then return 1 elseif this.WishCardData[i].status == 1 then return 4 end end end for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid > 0 and this.WishCardData[i].PropertyName == heroConfig[_heroTid].PropertyName then --如果上方存在和当前英雄相同阵营的就置灰 return 0 end end local num = 0 for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid > 0 then num = num + 1 end end if num == 1 then --如果上方神将满则其他全部置灰 return 2 end --都没有就亮着 return 3 end --检测当前法宝状态 function this.CheckCurTalismanaState(_heroTid) for i = 1, #this.WishEquipData do if this.WishEquipData[i].heroTid == _heroTid then --如果上方存在自己就✔ if this.WishEquipData[i].status == 0 then return 1 elseif this.WishEquipData[i].status == 1 then return 4 end end end for i = 1, #this.WishEquipData do if this.WishEquipData[i].heroTid > 0 then --如果上方存在和当前英雄相同阵营的就置灰 return 0 end end local num = 0 for i = 1, #this.WishEquipData do if this.WishEquipData[i].heroTid > 0 then num = num + 1 end end if num == 1 then --如果上方神将满则其他全部置灰 return 2 end --都没有就亮着 return 3 end --添加和卸下神将 function this.ChangeHero(type,_heroTid,func) if type == 1 then --增加神将 for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid == 0 then this.WishCardData[i].heroTid = _heroTid break end end elseif type == 2 then --卸下神将 for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid == _heroTid then this.WishCardData[i].heroTid = 0 _heroTid=0 break end end end --LogError("RecruitManager.curWishType=="..RecruitManager.curWishType.." _heroid==".._heroTid) NetManager.DesireDrawCardRequest(RecruitManager.curWishType,_heroTid,function () Game.GlobalEvent:DispatchEvent(GameEvent.Recruit.OnRecruitRefreshData) if func then func() end end) end --添加和卸下法宝 function this.ChangeEquip(type,_heroTid,func) if type == 1 then --增加神将 for i = 1, #this.WishEquipData do if this.WishEquipData[i].heroTid == 0 then this.WishEquipData[i].heroTid = _heroTid break end end elseif type == 2 then --卸下神将 for i = 1, #this.WishEquipData do if this.WishEquipData[i].heroTid == _heroTid then this.WishEquipData[i].heroTid = 0 _heroTid=0 break end end end --LogError("RecruitManager.curWishType=="..RecruitManager.curWishType.." _heroid==".._heroTid) NetManager.DesireDrawCardRequest(RecruitManager.curWishType,_heroTid,function () Game.GlobalEvent:DispatchEvent(GameEvent.Recruit.OnRecruitRefreshData) if func then func() end end) end --检查该跳转的页签 function this.CheckIndex() local num = 0 for i = 1, #this.WishCardData do if this.WishCardData[i].heroTid > 0 then num = num + 1 end end if num == 3 then return 1 end local num2 = {1,2,3,4} for i = 4, 1,-1 do for j = 1, #this.WishCardData do if this.WishCardData[j].PropertyName == num2[i] then table.remove(num2,i) end end end return num2[1] end function this.GetRecruitData() local dicData = {} local allConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityGroups, "PageType",1) -- for i = 1,#allConfigs do -- if allConfigs[i].ActiveType and allConfigs[i].ActiveType > 0 then -- elseif allConfigs[i].FunType and allConfigs[i].FunType > 0 then -- if allConfigs[i].IfBack == 1 then -- if ActTimeCtrlManager.SingleFuncState(allConfigs[i].FunType) then -- table.insert(dicData,allConfigs[i]) -- end -- else -- if ActTimeCtrlManager.IsQualifiled(allConfigs[i].FunType) then -- table.insert(dicData,allConfigs[i]) -- end -- end -- end -- end for i = 1,#allConfigs do --if allConfigs[i].ActiveType and allConfigs[i].ActiveType > 0 then if allConfigs[i].FunType and allConfigs[i].FunType > 0 then if allConfigs[i].IfBack == 1 then if ActTimeCtrlManager.SingleFuncState(allConfigs[i].FunType) then table.insert(dicData,allConfigs[i]) end else if ActTimeCtrlManager.IsQualifiled(allConfigs[i].FunType) then table.insert(dicData,allConfigs[i]) end end end end table.sort(dicData,function(a,b) return a.Sort < b.Sort end) return dicData end -- 获取某个奖池的总权重 function this.GetAllWeightByPool(pool) local all = 0 for i, v in ConfigPairs(lotteryRewardConfig) do if v.Pool == pool then -- 四元阵需要判断是否进入版本 local weight = v.WeightShow if v.Pool==11 or v.Pool==12 or v.Pool==13 or v.Pool==14 then local chipId = v.Reward[1] local heroId = HeroManager.ChipIdToHeroId(chipId) if heroId and not HeroManager.InVersion(heroId) then weight = 0 end end all = all + weight end end return all end return this