824 lines
34 KiB
Lua
824 lines
34 KiB
Lua
DynamicActivityManager = {}
|
|
local this = DynamicActivityManager
|
|
local SpiritAnimalSummonConfig = ConfigManager.GetConfig(ConfigName.SpiritAnimalSummon)
|
|
local shopItemConfig = ConfigManager.GetConfig(ConfigName.StoreConfig)
|
|
local rechargeCommodityConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
|
local actRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
local GlobalActivity = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
local artResConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
|
this.curLevel = 0--社稷大典的等级
|
|
this.curActivityType = 0
|
|
this.OpenUIList = {}
|
|
this.selectIndex = {dataType = 0,goodsId = {}}
|
|
this.selectIndex2 = {dataType = 0,goodsId = {}}
|
|
this.NiuQiIndex = 1
|
|
this.growIndex = 0
|
|
this.growcurIndex = 0
|
|
|
|
this.TaiChuMiJuanData = {}
|
|
function this.SetTaiChuMiJuanData(msg,fun)
|
|
local datas
|
|
if not msg or not msg.secretvolume or #msg.secretvolume < 1 then
|
|
---------------------------------------------测试数据
|
|
--datas = {[1] = {id = 1,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=eed09eaec41c4d18abc08ddbb3452fdc_s&infoId=II00",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-e1fd1cf39f6abfc1cdb35be92b6bc3d0.jpg?time=1628668135&signature=89DFF74746F289F5ED404A0B"},
|
|
-- [2] = {id = 2,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=b5f830ada8a04ab2bac07efa621ba453_s&infoId=IT00TLAILJ9X7KZ",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-8e07612db47c17ec56fbba613d31cc7b.jpg?time=1628668250&signature=CA7856DD83E45651B5E2274D76D8BF48"},
|
|
-- [3] = {id = 3,strategyLink = "https://mini.eastday.com/nsa/210811133830637498814.html?qid=02034",windowLink = "https://lupic.cdn.bcebos.com/20191203/3016121736_23.jpg"},
|
|
-- [4] = {id = 4,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=b5f830ada8a04ab2bac07efa621ba453_s&infoId=IT003LL8LJF1X9E",windowLink = "https://lupic.cdn.bcebos.com/20210629/938550_23.jpg"},
|
|
-- [5] = {id = 5,strategyLink = "https://mini.eastday.com/nsa/n210811082523736.html?qid=04232",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-361d4790c345bae2c5a5e1706c2b550b.jpg?time=1628668377&signature=B1350B327A0806326DD29054B83B071E"},
|
|
-- [6] = {id = 6,strategyLink = "http://ex.chinadaily.com.cn/exchange/partners/82/rss/channel/cn/columns/sz8srm/stories/WS6111cd6fa3101e7ce975deae.html",windowLink = "http://cn.chinadaily.com.cn/image/2018/j-2.jpg"},
|
|
-- [7] = {id = 7,strategyLink = "https://pc.yiyouliao.com/msn/article.html?recId=bdba7a24fe304b598695dbd25219f8e4_s&infoId=II003JLZ9IT187M",windowLink = "https://img-nos.yiyouliao.com/inforec-20210811-9987eceb8e5181eadb24778c05d9195b.jpg?time=1628668882&signature=842592897E6CE7C3DB594FAFC515B22E"},
|
|
-- [8] = {id = 8,strategyLink = "https://mini.eastday.com/nsa/210811065335765353208.html?qid=02034",windowLink = "https://lupic.cdn.bcebos.com/20200412/3062717289_23_800_349.jpg"},
|
|
--}
|
|
if fun then
|
|
fun(msg)
|
|
end
|
|
return
|
|
else
|
|
datas = msg.secretvolume
|
|
end
|
|
coroutine.start(function()
|
|
for k,v in ipairs(datas) do
|
|
this.GetATaiChuMiJuanData(v)
|
|
--local time = 0
|
|
while(not DynamicActivityManager.GetwwwProgress()) do
|
|
coroutine.wait(0.01)
|
|
--time = time + 0.01
|
|
end
|
|
--LogGreen("k:"..k.." time:"..time)
|
|
end
|
|
CheckRedPointStatus(RedPointType.TaiChuMiJuan)
|
|
end)
|
|
if fun then
|
|
fun(msg)
|
|
end
|
|
end
|
|
|
|
function this.GetwwwProgress()
|
|
return this.IsFisish
|
|
end
|
|
|
|
function this.GetATaiChuMiJuanData(data)
|
|
this.IsFisish = true
|
|
local str = string.match(data.windowLink,"^%s*(.-)%s*$")
|
|
if not this.TaiChuMiJuanData[data.id] or this.TaiChuMiJuanData[data.id].windowLink ~= str then
|
|
this.IsFisish = false
|
|
coroutine.start(function()
|
|
local www = WWW.New(str)
|
|
coroutine.www(www)
|
|
local m_sprite
|
|
local tex2d = www.texture
|
|
if www.error or not www.texture then
|
|
Log("data.windowLink:"..str)
|
|
LogError(string.format("data.windowLink:%s下载失败error:%s",data.windowLink,www.error))
|
|
m_sprite = Util.LoadSprite("taichuMiJuanDefaultBanner")
|
|
else
|
|
m_sprite = Sprite.Create(tex2d, Rect.New(0, 0, tex2d.width, tex2d.height), Vector2.New(0, 0));
|
|
end
|
|
if not this.TaiChuMiJuanData[data.id] then
|
|
this.TaiChuMiJuanData[data.id] = {}
|
|
end
|
|
this.TaiChuMiJuanData[data.id].id = data.id
|
|
this.TaiChuMiJuanData[data.id].linkAddress = string.match(data.strategyLink,"^%s*(.-)%s*$")
|
|
this.TaiChuMiJuanData[data.id].windowLink = str
|
|
this.TaiChuMiJuanData[data.id].sprite = m_sprite
|
|
this.IsFisish = true
|
|
end)
|
|
else
|
|
return this.TaiChuMiJuanData[data.id]
|
|
end
|
|
end
|
|
|
|
function this.CheckRedPointTaiChu()
|
|
if (not PlayerPrefs.HasKey("TaiChu"..PlayerManager.uid) or PlayerPrefs.GetString("TaiChu"..PlayerManager.uid) ~= TimeStampToDateStr2(GetTimeStamp())) and LengthOfTable(this.TaiChuMiJuanData) > 0 then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function this.SetSelectIndex(dataType,goodsId,b)
|
|
this.selectIndex.dataType = dataType
|
|
this.selectIndex.goodsId = goodsId
|
|
if b and b == 1 then
|
|
else
|
|
this.selectIndex2.dataType = dataType
|
|
this.selectIndex2.goodsId = goodsId
|
|
end
|
|
end
|
|
|
|
function this.Initialize()
|
|
this.TaiChuMiJuanData = {}
|
|
end
|
|
|
|
function this.AddUIList(jumpId)
|
|
table.insert(this.OpenUIList,jumpId)
|
|
for i,v in ipairs(this.OpenUIList) do
|
|
-- Log("AddUIList:"..v)
|
|
end
|
|
end
|
|
function this.RemoveUIList()
|
|
if #this.OpenUIList > 0 then
|
|
table.remove(this.OpenUIList,#this.OpenUIList)
|
|
end
|
|
for i,v in ipairs(this.OpenUIList) do
|
|
-- Log("RemoveUIList:"..v)
|
|
end
|
|
end
|
|
function this.ChangeUIList(jumpId)
|
|
if #this.OpenUIList < 1 then
|
|
this.OpenUIList[1] = jumpId
|
|
else
|
|
this.OpenUIList[#this.OpenUIList] = jumpId
|
|
end
|
|
for i,v in ipairs(this.OpenUIList) do
|
|
-- Log("ChangeUIList:"..v)
|
|
end
|
|
end
|
|
|
|
function this.SheJiGetRankData(type,activityId,fun)
|
|
local allRankData,myRankData
|
|
RankingManager.InitData(type,function ()
|
|
allRankData,myRankData = RankingManager.GetRankingInfo()
|
|
if fun then
|
|
fun(allRankData,myRankData)
|
|
end
|
|
end,activityId)
|
|
end
|
|
|
|
function this.SetCurLevel(level)--社稷大典的等级
|
|
this.curLevel = level
|
|
end
|
|
|
|
function this.SheJiCheckRedPoint()
|
|
local ActInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.Celebration)--活动数据
|
|
local canGetRewardList={}
|
|
if ActInfo then
|
|
local curScore = ActInfo.mission[1].progress
|
|
local actReward = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",ActInfo.activityId)
|
|
local setting = ConfigManager.GetConfigDataByKey(ConfigName.GodSacrificeSetting,"ActivityId",ActInfo.activityId)
|
|
--检测宝箱是否有可领取
|
|
for i = 1, #ActInfo.mission do
|
|
local curLevel = curScore/actReward[1].Values[2][1]
|
|
if ActInfo.mission[i].state == 0 and curLevel >= i then
|
|
table.insert(canGetRewardList,ActInfo.mission[i])
|
|
end
|
|
end
|
|
|
|
local canGet = false
|
|
--检测中央大锅是否可领取
|
|
if GetTimeStamp() > ActInfo.value and GetTimeStamp() < (ActInfo.value + setting.LastTime * 60) then
|
|
--领过--进入倒计时
|
|
canGet = false
|
|
elseif GetTimeStamp() > ActInfo.value and GetTimeStamp() > (ActInfo.value + setting.LastTime * 60) then
|
|
--没到时间--进入倒计时
|
|
canGet = false
|
|
else
|
|
--可领取
|
|
canGet = true
|
|
end
|
|
if #canGetRewardList > 0 or canGet then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
end
|
|
|
|
function this.GetBaoKuData()
|
|
|
|
local actData={}--全部数据
|
|
local initCardDatas = {}--35个矿坑的初始数据
|
|
local finalCardDatas = {}--35个矿坑抽取后的数据
|
|
local allData = {}--总奖励数据
|
|
local curBasicPool = 0
|
|
local curFinalPool = 0
|
|
|
|
local ActInfo = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.YiJingBaoKu)--活动数据
|
|
local BlessingConfigNew = ConfigManager.GetConfigDataByKey(ConfigName.BlessingConfigNew,"ActivityId",ActInfo.activityId)
|
|
local RewardAllConfig = ConfigManager.GetConfig(ConfigName.BlessingRewardPoolNew)
|
|
--领取过的35条数据
|
|
for i = 1, 99 do
|
|
if ActInfo.mission[i] then
|
|
local v = ActInfo.mission[i]
|
|
if v.missionId < 100 then
|
|
local data = {}
|
|
data.Id = v.missionId
|
|
data.rewardId = v.progress
|
|
data.reward = {}
|
|
if v.progress ~= 0 then
|
|
data.reward = RewardAllConfig[v.progress].Reward
|
|
data.configId = RewardAllConfig[v.progress].Id
|
|
end
|
|
-- --LogGreen("Id:"..v.missionId.." rewardId:"..v.progress.." ")
|
|
table.insert(finalCardDatas,data)
|
|
end
|
|
end
|
|
end
|
|
local BasicPoolId = string.split(BlessingConfigNew.BasicPoolId, "#")
|
|
--大奖和当前层数数据
|
|
for i = 1, 1100 do
|
|
if ActInfo.mission[i] then
|
|
local v = ActInfo.mission[i]
|
|
if v.missionId == 100 then
|
|
actData.curLevel = v.progress
|
|
curBasicPool = tonumber(BasicPoolId[v.progress])
|
|
actData.poolId = curBasicPool
|
|
curFinalPool = BlessingConfigNew.FinalPoolId
|
|
elseif v.missionId > 1000 then
|
|
local data = {}
|
|
data.rewardId = v.missionId-1000
|
|
data.progress = v.progress
|
|
-- LogYellow("rewardId:"..data.rewardId.." data.progress:"..data.progress)
|
|
data.configId = RewardAllConfig[data.rewardId].Id
|
|
table.insert(allData,data)
|
|
end
|
|
end
|
|
end
|
|
--初始的坑的35条数据
|
|
local RewardConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.BlessingRewardPoolNew,"PoolId",curBasicPool)
|
|
local index = 1
|
|
for i = 1, #RewardConfig do
|
|
local j = 1
|
|
while(j <= RewardConfig[i].InitializeNum) do
|
|
local data = {}
|
|
if index ~= 18 then
|
|
data.rewardId = RewardConfig[i].Id
|
|
data.reward = {}
|
|
data.reward = RewardConfig[i].Reward
|
|
j = j + 1
|
|
else
|
|
data.rewardId = 0
|
|
data.reward = nil
|
|
end
|
|
table.insert(initCardDatas,data)
|
|
index = index + 1
|
|
end
|
|
end
|
|
|
|
actData.activityId = ActInfo.activityId
|
|
actData.curBasicPool = curBasicPool
|
|
actData.curFinalPool = curFinalPool
|
|
actData.selectId = ActInfo.value
|
|
actData.endTime = ActInfo.endTime
|
|
-- LogPink("大奖Id:"..ActInfo.value)
|
|
|
|
actData.initCardDatas = initCardDatas
|
|
actData.finalCardDatas = finalCardDatas
|
|
actData.allData = allData
|
|
|
|
return actData
|
|
end
|
|
|
|
--宝库奖励的剩余数据
|
|
function this.GetLeftRewardData()
|
|
local actData = this.GetBaoKuData()
|
|
local finalCardDatas = actData.finalCardDatas
|
|
local RewardConfig = ConfigManager.GetAllConfigsDataByKey(ConfigName.BlessingRewardPoolNew,"PoolId",actData.poolId)--初始所有奖励数据
|
|
local data={}
|
|
for i = 1, #RewardConfig do
|
|
data[RewardConfig[i].Id] = {}
|
|
data[RewardConfig[i].Id].id = RewardConfig[i].Id
|
|
data[RewardConfig[i].Id].reward = RewardConfig[i].Reward
|
|
data[RewardConfig[i].Id].progress = RewardConfig[i].InitializeNum
|
|
data[RewardConfig[i].Id].limit = RewardConfig[i].InitializeNum
|
|
end
|
|
|
|
-- LogYellow("#finalCardDatas:"..#finalCardDatas.." actData.selectId:"..actData.selectId)
|
|
for i = 1, #finalCardDatas do
|
|
if finalCardDatas[i].rewardId and finalCardDatas[i].rewardId ~= 0 and finalCardDatas[i].rewardId ~= actData.selectId then
|
|
-- LogYellow("i:"..i.." rewardId:"..tostring(finalCardDatas[i].rewardId) .." progress"..tonumber(data[finalCardDatas[i].rewardId].progress))
|
|
data[finalCardDatas[i].rewardId].progress = data[finalCardDatas[i].rewardId].progress - 1
|
|
end
|
|
end
|
|
return data
|
|
end
|
|
|
|
function this.LingShouOrigiUpData()
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
|
|
local activityId = ActData.activityId
|
|
local LSrewardData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",activityId)
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
|
|
local singleRecruit = array[1]
|
|
local curScore = 0
|
|
local mergePool = singleRecruit.MergePool
|
|
local poolId = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",mergePool).pool_id
|
|
local tempData = ConfigManager.GetConfigDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId)
|
|
local showData = {}
|
|
showData.sasId = 0
|
|
showData.monsterId = tempData.Reward[1]
|
|
showData.iconId = LSrewardData[1].Reward[1][1]
|
|
showData.battleId = tempData.Fakebattle
|
|
return showData
|
|
end
|
|
|
|
function this.LingShouBuildData()
|
|
local rewardData={}
|
|
local showData={}
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
|
|
local activityId = ActData.activityId
|
|
local LSrewardData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",activityId)
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
|
|
local singleRecruit = array[1]
|
|
local tenRecruit = array[2]
|
|
local curScore = 0
|
|
--第一条为选择抽取的灵兽信息
|
|
for index, value in ipairs(ActData.mission) do
|
|
local v = ActData.mission[index]
|
|
if v.missionId == 0 then
|
|
if v.progress == 0 then
|
|
local mergePool = singleRecruit.MergePool
|
|
local poolId = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",mergePool).pool_id
|
|
local tempData = ConfigManager.GetConfigDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId)
|
|
showData.sasId = 0
|
|
showData.monsterId = tempData.Reward[1]
|
|
local tempConfigId = ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalSummon,"ActivityID",activityId,"FocusID",showData.monsterId)
|
|
showData.battleId = tempConfigId.Fakebattle
|
|
-- LogYellow("Id:"..tostring(tempData.Id).." poolId:"..tostring(poolId).."FocusID:"..tostring(showData.monsterId).." Fakebattle:"..tostring(tempConfigId.Fakebattle))
|
|
-- for _, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.SpiritAnimalSummon)) do
|
|
-- LogPink("Id:"..tostring(configInfo.Id).." FocusID:"..tostring(configInfo.FocusID).." ActivityID:"..tostring(configInfo.ActivityID).." OriginalItem:"..tostring(configInfo.OriginalItem).." Fakebattle:"..tostring(configInfo.Fakebattle))
|
|
-- end
|
|
else
|
|
local tempData = SpiritAnimalSummonConfig[v.progress]
|
|
showData.sasId = tempData.Id
|
|
showData.monsterId = tempData.FocusID
|
|
showData.battleId = tempData.Fakebattle
|
|
-- LogGreen("Id:"..tostring(tempData.Id).." FocusID:"..tostring(tempData.FocusID).." Fakebattle:"..tostring(tempData.Fakebattle))
|
|
end
|
|
end
|
|
end
|
|
--剩下的是奖励信息
|
|
for i = 1, #LSrewardData do
|
|
local v = LSrewardData[i]
|
|
for index, value in ipairs(ActData.mission) do
|
|
if v.Id == value.missionId then
|
|
local data = {}
|
|
data.missionId = value.missionId
|
|
data.reward = {}
|
|
data.num = v.Reward[1][2]
|
|
data.value = v.Values[1][1]
|
|
curScore = ActData.mission[index].progress
|
|
if curScore >= data.value then
|
|
if value.state == 0 then
|
|
data.state = 1--可领的
|
|
else
|
|
data.state = 2--领完的
|
|
end
|
|
else
|
|
data.state = 0--不可领的
|
|
end
|
|
table.insert(rewardData,data)
|
|
end
|
|
end
|
|
end
|
|
return rewardData,showData,curScore
|
|
end
|
|
|
|
--灵兽宝阁红点检测
|
|
function this.LingShouUpCheckRed()
|
|
local freeTime = 0
|
|
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
|
|
if not ActData then
|
|
return false
|
|
end
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",ActData.activityId)
|
|
local freeTimesId=lotterySetting[array[1].Id].FreeTimes
|
|
if freeTimesId > 0 then
|
|
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
|
end
|
|
|
|
local rewardData,showData,curScore = DynamicActivityManager.LingShouBuildData()
|
|
for i = 1, #rewardData do
|
|
if rewardData[i].state == 1 or freeTime >=1 then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--新将来袭获取数据
|
|
function this.XinJiangBuildData()
|
|
local data={}
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.XinJiangLaiXi)
|
|
local newHeroData = ConfigManager.GetConfigData(ConfigName.NewHeroConfig,ActData.activityId)
|
|
data.endTime = ActData.endTime
|
|
data.fightTime = PrivilegeManager.GetPrivilegeRemainValue(2012)
|
|
data.buyTime = PrivilegeManager.GetPrivilegeRemainValue(2013)
|
|
data.money = BagManager.GetTotalItemNum(UpViewRechargeType.XinJiangCoin)
|
|
local rewardGroupId = newHeroData.DropList[#newHeroData.DropList][2]
|
|
data.reward = ConfigManager.GetConfigData(ConfigName.RewardGroup,rewardGroupId).ShowItem
|
|
data.activityId = ActData.activityId
|
|
return data
|
|
end
|
|
|
|
function this.XiangYaoBuildData()
|
|
local rewardData={}
|
|
local showData={}
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.XiangYaoDuoBao)
|
|
local activityId = ActData.activityId
|
|
local LSrewardData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",activityId)
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
|
|
local singleRecruit = array[1]
|
|
local tenRecruit = array[2]
|
|
local curScore = 0
|
|
--第一条为选择抽取的英雄信息
|
|
for index, value in ipairs(ActData.mission) do
|
|
local v = ActData.mission[index]
|
|
if v.missionId == 0 then
|
|
local mergePool = singleRecruit.MergePool
|
|
local poolId = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",mergePool).pool_id
|
|
local tempData = ConfigManager.GetConfigDataByKey(ConfigName.LotteryRewardConfig,"Pool",poolId)
|
|
showData.sasId = 0
|
|
showData.monsterId = tempData.Reward[1]
|
|
end
|
|
end
|
|
--剩下的是奖励信息
|
|
for i = 1, #LSrewardData do
|
|
local v = LSrewardData[i]
|
|
for index, value in ipairs(ActData.mission) do
|
|
if v.Id == value.missionId then
|
|
local data = {}
|
|
data.missionId = value.missionId
|
|
data.reward = v.Reward
|
|
data.iconId = v.Reward[1][1]
|
|
data.num = v.Reward[1][2]
|
|
data.value = v.Values[1][1]
|
|
curScore = ActData.mission[index].progress
|
|
if curScore >= data.value then
|
|
if value.state == 0 then
|
|
data.state = 1--可领的
|
|
else
|
|
data.state = 2--领完的
|
|
end
|
|
else
|
|
data.state = 0--不可领的
|
|
end
|
|
table.insert(rewardData,data)
|
|
end
|
|
end
|
|
end
|
|
return rewardData,showData,curScore
|
|
end
|
|
|
|
--升星有礼拿数据
|
|
function this.ShengXingYouLiGetData()
|
|
local data={}
|
|
local actData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.ShengXingYouLi)
|
|
data.activityId = actData.activityId
|
|
data.endTime = actData.endTime
|
|
data.mission = {}
|
|
local rewardData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",data.activityId)
|
|
data.heroId = rewardData[1].Values[1][1]
|
|
for i = 1, #actData.mission do
|
|
local d={}
|
|
d.missionId = actData.mission[i].missionId
|
|
d.state = actData.mission[i].state
|
|
d.progress = actData.mission[i].progress
|
|
-- LogYellow("state:"..d.state.." progress:"..d.progress)
|
|
d.need = rewardData[i].Values[2][1]
|
|
d.reward = rewardData[i].Reward
|
|
d.word = GetLanguageStrById(rewardData[i].ContentsShow)
|
|
d.jump = rewardData[i].Jump[1]
|
|
table.insert(data.mission,d)
|
|
end
|
|
return data
|
|
end
|
|
|
|
--检测升星有礼的红点
|
|
function this.CheckShengXingYouLiRedPoint()
|
|
local activeData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.ShengXingYouLi)
|
|
if activeData then
|
|
for i = 1, #activeData.mission do
|
|
local sConFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig, activeData.mission[i].missionId)
|
|
if sConFigData then
|
|
local value = sConFigData.Values[2][1]
|
|
if activeData.mission[i].state == 0 and activeData.mission[i].progress >= value then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
--新将来袭红点
|
|
function this.CheckXinJiangLaiXiRedPoint()
|
|
local fightTime = PrivilegeManager.GetPrivilegeRemainValue(2012)
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.XinJiangLaiXi)
|
|
if not ActData then
|
|
return false
|
|
end
|
|
if fightTime > 0 then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
--降妖夺宝红点
|
|
function this.CheckXiangYaoDuoBaoRedPoint()
|
|
local freeTime = 0
|
|
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
|
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.XiangYaoDuoBao)
|
|
if not ActData then
|
|
return false
|
|
end
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",ActData.activityId)
|
|
local freeTimesId=lotterySetting[array[1].Id].FreeTimes
|
|
if freeTimesId > 0 then
|
|
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
|
end
|
|
|
|
local rewardData,showData,curScore = DynamicActivityManager.XiangYaoBuildData()
|
|
for i = 1, #rewardData do
|
|
if rewardData[i].state == 1 or freeTime >=1 then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function this.GetActivityTableDataByPageInde(pageIndex)
|
|
local activityDic = {}
|
|
local functionDic = {}
|
|
local activityGroupsData = {}
|
|
local activityDatas = {}
|
|
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityGroups,"PageType",pageIndex)
|
|
for i = 1 , #configs do
|
|
if configs[i].ActiveType > 0 then
|
|
if not activityDic[configs[i].ActiveType] then
|
|
if configs[i].ShopData and configs[i].ShopData[1][1] == -9999 then
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct)
|
|
if id and id > 0 and ActivityGiftManager.IsQualifiled(ActivityTypeDef.DynamicAct) and GlobalActivity[id].ShowArt == configs[i].ActId then
|
|
activityDic[configs[i].ActiveType] = configs[i]
|
|
table.insert(activityGroupsData,configs[i])
|
|
end
|
|
else
|
|
activityDic[configs[i].ActiveType] = configs[i]
|
|
table.insert(activityGroupsData,configs[i])
|
|
end
|
|
end
|
|
elseif configs[i].FunType > 0 then
|
|
if not activityDic[configs[i].FunType] then
|
|
functionDic[configs[i].FunType] = configs[i]
|
|
table.insert(activityGroupsData,configs[i])
|
|
end
|
|
elseif configs[i].ShopData and configs[i].ShopData[1][1] == -9999 then
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct)
|
|
if id and id > 0 and ActivityGiftManager.IsQualifiled(ActivityTypeDef.DynamicAct) and GlobalActivity[id].ShowArt == configs[i].ActId then
|
|
table.insert(activityGroupsData,configs[i])
|
|
end
|
|
elseif configs[i].ActiveType == 0 and configs[i].FunType == 0 then
|
|
table.insert(activityGroupsData,configs[i])
|
|
end
|
|
end
|
|
table.sort(activityGroupsData,function(a,b)
|
|
if a.Sort == b.Sort then
|
|
return a.ActId > b.ActId
|
|
else
|
|
return a.Sort < b.Sort
|
|
end
|
|
end)
|
|
return activityGroupsData
|
|
end
|
|
|
|
-- 判段跳转index活动是否开启
|
|
function this.IsActivityOpenByJumpIndex(pageIndex, jumpIndex)
|
|
local tb = this.GetActivityTableDataByPageInde(pageIndex)
|
|
for i = 1, #tb do
|
|
if tb[i].Sort == jumpIndex then
|
|
if tb[i].IfBack then
|
|
if tb[i].ActiveType > 0 then
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(tb[i].ActiveType)
|
|
-- return id and id > 0 and ActivityGiftManager.IsQualifiled(tb[i].ActiveType)
|
|
if not ActivityGiftManager.IsQualifiled(tb[i].ActiveType) then
|
|
return 1
|
|
end
|
|
return id and id > 0 and ActivityGiftManager.IsQualifiled(tb[i].ActiveType)
|
|
elseif tb[i].FunType > 0 then
|
|
return ActTimeCtrlManager.SingleFuncState(tb[i].FunType)
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
end
|
|
return true
|
|
end
|
|
|
|
|
|
-- 玩家是否有资格开启
|
|
function this.IsQualifiled(id)
|
|
-- 相同类型活动解锁类型相同,所以只判断第一个
|
|
local data = ConfigManager.GetConfigData(ConfigName.ActivityGroups,id)
|
|
if not data then return true end
|
|
-- 当前玩家等级
|
|
local qualifiled = false
|
|
local playerLv = PlayerManager.level
|
|
local openRule = data.OpenRules
|
|
if not openRule or #openRule < 1 then
|
|
return true
|
|
end
|
|
if openRule[1] == 1 then -- 关卡开启
|
|
qualifiled = FightPointPassManager.IsFightPointPass(openRule[2])
|
|
elseif openRule[1] == 2 then -- 等级开启
|
|
qualifiled = playerLv >= openRule[2]
|
|
elseif openRule[1] == 3 then -- 工坊等级开启
|
|
qualifiled = WorkShopManager.WorkShopData.lv >= openRule[2]
|
|
end
|
|
return qualifiled
|
|
end
|
|
|
|
function this.GetGiftDataByType(ShopData)
|
|
local rechargeNum = VipManager.GetChargedNum()--已经充值的金额
|
|
local lv = PlayerManager.level
|
|
local shopData = {}
|
|
for i = 1,#ShopData do
|
|
if ShopData[i][1] == DataType.Direct and RECHARGEABLE then
|
|
local topspeedData = this.ResetShopData(OperatingManager.GetGiftGoodsInfoList(ShopData[i][2]), ShopData[i][3], ShopData[i][1])
|
|
for i = 1, #topspeedData do
|
|
-- if lv >= topspeedData[i].data.shopItemData.LevelLinit[1] and lv <= topspeedData[i].data.shopItemData.LevelLinit[2] then
|
|
table.insert(shopData,topspeedData[i])
|
|
-- end
|
|
end
|
|
elseif ShopData[i][1] == DataType.Shop then
|
|
local topspeedData = this.ResetShopData(ShopManager.GetShopDataByType(ShopData[i][2]).storeItem, ShopData[i][2], ShopData[i][1])
|
|
for i = 1, #topspeedData do
|
|
if (not topspeedData[i].data.shopItemData.ShowRule) or (rechargeNum >= topspeedData[i].data.shopItemData.ShowRule[2]) then
|
|
table.insert(shopData,topspeedData[i])
|
|
end
|
|
end
|
|
elseif ShopData[i][1] == DataType.Activity then
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(ShopData[i][4])
|
|
if id and id > 0 and GlobalActivity[id] then
|
|
local topspeedData = {}
|
|
for j = 1 ,#GlobalActivity[id].CanBuyRechargeId do
|
|
table.insert(topspeedData,OperatingManager.GetGiftGoodsInfo(ShopData[i][2],GlobalActivity[id].CanBuyRechargeId[j]))
|
|
end
|
|
LogGreen("#topspeedData:"..#topspeedData)
|
|
topspeedData = this.ResetShopData(topspeedData,ShopData[i][3],1)
|
|
for j = 1, #topspeedData do
|
|
-- if lv >= topspeedData[i].data.shopItemData.LevelLinit[1] and lv <= topspeedData[i].data.shopItemData.LevelLinit[2] then
|
|
table.insert(shopData,topspeedData[j])
|
|
-- end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
table.sort(shopData,function(a,b)
|
|
if a.sortId == b.sortId then
|
|
if a.DataType == b.DataType and a.DataType == DataType.Direct then
|
|
return rechargeCommodityConfig[a.data.shopData.goodsId].Sequence < rechargeCommodityConfig[b.data.shopData.goodsId].Sequence
|
|
elseif a.DataType == b.DataType and a.DataType == DataType.Shop then
|
|
return a.data.shopData.id < b.data.shopData.id
|
|
else
|
|
return a.DataType > b.DataType
|
|
end
|
|
else
|
|
return a.sortId > b.sortId
|
|
end
|
|
end)
|
|
return shopData
|
|
end
|
|
|
|
-- 商店数据重组
|
|
function this.ResetShopData(shopData, buyType, DataTypeIndex)
|
|
local newData = {}
|
|
local boughtNum = 0
|
|
local limitNum = 0
|
|
for i = 1, #shopData do
|
|
newData[#newData + 1] = this.CreatSingleData(shopData[i],DataTypeIndex,buyType)
|
|
end
|
|
return newData
|
|
end
|
|
|
|
function this.CreatSingleData(shopData,DataTypeIndex,buyType)
|
|
local _data = {}
|
|
local data = {}
|
|
local curSortId = 0--临时一个数值 只用做排序用
|
|
if DataTypeIndex == DataType.Shop then
|
|
data.shopData = shopData
|
|
data.shopItemData = shopItemConfig[shopData.id]
|
|
data.shows = data.shopItemData.Goods
|
|
data.tipImageText = Language[11356]
|
|
data.tagName = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,data.shows[1][1]).Name)
|
|
data.boughtNum = ShopManager.GetShopItemHadBuyTimes(buyType, shopData.id)
|
|
data.limitNum = ShopManager.GetShopItemLimitBuyCount(shopData.id)
|
|
if data.limitNum == -1 then
|
|
curSortId = 3
|
|
elseif data.limitNum - data.boughtNum > 0 then
|
|
curSortId = 2
|
|
end
|
|
data.costId,data.finalNum,data.oriCostNum = ShopManager.calculateBuyCost(buyType, shopData.id, 1)
|
|
data.price = data.finalNum
|
|
elseif DataTypeIndex == DataType.Direct and rechargeCommodityConfig[shopData.goodsId].ShowType == buyType then
|
|
data.shopData = shopData
|
|
data.shopItemData = rechargeCommodityConfig[shopData.goodsId]
|
|
data.shows = data.shopItemData.RewardShow
|
|
data.tagName = GetLanguageStrById(data.shopItemData.Name)
|
|
data.boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift,shopData.goodsId)
|
|
data.limitNum = rechargeCommodityConfig[shopData.goodsId].Limit
|
|
if data.limitNum == -1 then
|
|
curSortId = 2
|
|
elseif data.limitNum - data.boughtNum > 0 then
|
|
curSortId = 1
|
|
end
|
|
data.costId = nil
|
|
data.finalNum = MoneyUtil.GetMoney(data.shopItemData.Price)
|
|
data.oriCostNum = nil
|
|
if data.shopItemData.DailyUpdate == 7 then
|
|
data.tipImageText = Language[11699]
|
|
elseif data.shopItemData.DailyUpdate == 15 then
|
|
data.tipImageText = Language[11700]
|
|
elseif data.shopItemData.DailyUpdate == 30 then
|
|
data.tipImageText = Language[11357]
|
|
elseif shopData.goodsId == 9107 then
|
|
data.tipImageText = Language[12298]
|
|
else
|
|
data.tipImageText = nil
|
|
end
|
|
data.price = string.format(MoneyUtil.GetMoneyUnitName(), data.finalNum)
|
|
data.endTime = shopData.endTime
|
|
else
|
|
return nil
|
|
end
|
|
data.buyInfo = Language[10580]..data.limitNum - data.boughtNum..Language[10048]
|
|
_data.data = data
|
|
_data.DataType = DataTypeIndex
|
|
_data.sortId = curSortId
|
|
_data.buyType = buyType
|
|
return _data
|
|
end
|
|
|
|
local stateSort = {
|
|
[1] = 1,
|
|
[2] = 4,
|
|
[0] = 3,
|
|
[-1] = 2,
|
|
}
|
|
|
|
function this.GetMissionDataByActId(activityId)
|
|
local actiInfo = ActivityGiftManager.GetActivityInfoByType(activityId)
|
|
local havaBought = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, GlobalActivity[activityId].CanBuyRechargeId[1])--当前礼包ID(101\102\103\104\105)
|
|
local data = {}
|
|
for k,v in ipairs(actiInfo.mission) do
|
|
table.insert(data,this.CreatSingleMissionData(v,havaBought))
|
|
end
|
|
table.sort(data, function(a, b)
|
|
if stateSort[a.state] == stateSort[b.state] then
|
|
return a.missionId < b.missionId
|
|
else
|
|
return stateSort[a.state] > stateSort[b.state]
|
|
end
|
|
end)
|
|
return data
|
|
end
|
|
|
|
function this.CreatSingleMissionData(missionData,havaBought)
|
|
local data = {}
|
|
data.missionId = missionData.missionId
|
|
data.shows = actRewardConfig[missionData.missionId].Reward
|
|
data.itemName = GetLanguageStrById(itemConfig[data.shows[1][1]].Name)
|
|
data.content = Language[11367]..actRewardConfig[data.missionId].Values[1][2]..Language[11368]
|
|
data.isCanGetReward = PlayerManager.level >= actRewardConfig[data.missionId].Values[1][2]
|
|
--0 未领取(等级已达到,未购买基金) 1 已领取 -1 未达到等级 2可领取
|
|
if missionData.state == 0 then
|
|
if PlayerManager.level < actRewardConfig[data.missionId].Values[1][2] then
|
|
data.state = -1
|
|
elseif havaBought.isBought > 0 then
|
|
data.state = 2
|
|
else
|
|
data.state = 0
|
|
end
|
|
else
|
|
data.state = missionData.state
|
|
end
|
|
--LogGreen("data.state:"..data.state)
|
|
return data
|
|
end
|
|
|
|
function this.RecrutDetailData(actType)
|
|
if actType == ActivityTypeDef.LingShouBaoGe then
|
|
return DynamicActivityManager.LingShouBuildData()
|
|
elseif actType == ActivityTypeDef.XiangYaoDuoBao then
|
|
return DynamicActivityManager.XiangYaoBuildData()
|
|
else
|
|
return nil,nil,nil
|
|
end
|
|
end
|
|
|
|
--寻宝迷踪红点检测
|
|
function this.XunBaoMiZongRedCheck()
|
|
local actData = CommonActPageManager.GetData(ActivityTypeDef.XunBaoMiZong)
|
|
if not actData then return false end
|
|
local configData = ConfigManager.GetConfigDataByKey(ConfigName.LotterySetting,"ActivityId",actData.activityId)
|
|
local itemNum = configData.CostItem[1]
|
|
if BagManager.GetTotalItemNum(itemNum[1]) >= itemNum[2] then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
return this |