276 lines
13 KiB
Lua
276 lines
13 KiB
Lua
CommonActPageManager = {}
|
|
local this = CommonActPageManager
|
|
local dataList = {}
|
|
this.TaSuiLingXiaoMsg = nil
|
|
this.TaSuiLingXiaoHistoryDmg = 0
|
|
|
|
function this.Initialize()
|
|
end
|
|
|
|
--初始化活动的特殊数据
|
|
local TypeUpdateFunc = {
|
|
[ActivityTypeDef.YunYouShangRen] = function ()
|
|
local curData = dataList[ActivityTypeDef.YunYouShangRen]
|
|
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ComposeActivity,"ActivityId",curData.activityId)
|
|
for i = 1, #curData.rewards do
|
|
for j = 1, #configData do
|
|
if curData.rewards[i].missionId == configData[j].Id then
|
|
curData.rewards[i].otherData.needItems = configData[j].NeedItems
|
|
curData.rewards[i].otherData.count = configData[j].Count
|
|
curData.rewards[i].otherData.composeType = configData[j].ComposeType
|
|
curData.rewards[i].otherData.selectId = 0
|
|
end
|
|
end
|
|
end
|
|
table.sort(dataList[ActivityTypeDef.YunYouShangRen].rewards,function (a,b)
|
|
if a.progress == 0 and b.progress > 0 then
|
|
return false
|
|
end
|
|
if a.progress > 0 and b.progress == 0 then
|
|
return true
|
|
end
|
|
return a.missionId < b.missionId
|
|
-- if a.progress == b.progress then
|
|
-- else
|
|
-- return a.progress > b.progress
|
|
-- end
|
|
end)
|
|
end,
|
|
[ActivityTypeDef.ContinuityRecharge] = function ()
|
|
this.GetExpertData(3,ActivityTypeDef.ContinuityRecharge)
|
|
end,
|
|
[ActivityTypeDef.UpStarExper] = function ()--进阶达人
|
|
this.GetExpertData(1,ActivityTypeDef.UpStarExper)
|
|
end,
|
|
[ActivityTypeDef.Talisman] = function ()--法宝达人
|
|
this.GetExpertData(1,ActivityTypeDef.Talisman)
|
|
end,
|
|
[ActivityTypeDef.SoulPrint] = function ()--魂印达人
|
|
this.GetExpertData(1,ActivityTypeDef.SoulPrint)
|
|
end,
|
|
[ActivityTypeDef.EquipExper] = function ()--装备达人
|
|
this.GetExpertData(1,ActivityTypeDef.EquipExper)
|
|
end,
|
|
[ActivityTypeDef.EnergyExper] = function ()--体力达人
|
|
this.GetExpertData(2,ActivityTypeDef.EnergyExper)
|
|
end,
|
|
[ActivityTypeDef.FindTreasureExper] = function ()--寻宝达人
|
|
this.GetExpertData(1,ActivityTypeDef.FindTreasureExper)
|
|
end,
|
|
[ActivityTypeDef.ExpeditionExper] = function ()--天宫达人
|
|
this.GetExpertData(1,ActivityTypeDef.ExpeditionExper)
|
|
end,
|
|
[ActivityTypeDef.FastExplore] = function ()--极速达人
|
|
this.GetExpertData(2,ActivityTypeDef.FastExplore)
|
|
end,
|
|
[ActivityTypeDef.GoldExper] = function ()--点金达人
|
|
this.GetExpertData(2,ActivityTypeDef.GoldExper)
|
|
end,
|
|
[ActivityTypeDef.FightExper] = function ()--副本达人
|
|
this.GetExpertData(2,ActivityTypeDef.FightExper)
|
|
end,
|
|
[ActivityTypeDef.AreaExper] = function ()
|
|
this.GetExpertData(2,ActivityTypeDef.AreaExper)
|
|
end,
|
|
[ActivityTypeDef.slhjExper] = function ()--森罗幻境达人
|
|
this.GetExpertData(2,ActivityTypeDef.slhjExper)
|
|
end,
|
|
[ActivityTypeDef.LuckyTurnExper] = function ()--探宝达人
|
|
this.GetExpertData(2,ActivityTypeDef.LuckyTurnExper)
|
|
end,
|
|
[ActivityTypeDef.RecruitExper] = function ()--征募达人
|
|
this.GetExpertData(2,ActivityTypeDef.RecruitExper)
|
|
end,
|
|
[ActivityTypeDef.SecretBoxExper] = function ()--秘宝达人
|
|
this.GetExpertData(2,ActivityTypeDef.SecretBoxExper)
|
|
end,
|
|
[ActivityTypeDef.AccumulativeRechargeExper] = function ()---日累计充值
|
|
this.GetExpertData(2,ActivityTypeDef.AccumulativeRechargeExper)
|
|
end,
|
|
[ActivityTypeDef.UpLvAct] = function ()---日累计充值
|
|
this.GetExpertData(4,ActivityTypeDef.UpLvAct)
|
|
end,
|
|
[ActivityTypeDef.TaSuiLingXiao] = function ()--踏碎凌霄
|
|
local curData = dataList[ActivityTypeDef.TaSuiLingXiao]
|
|
local configData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",curData.activityId)
|
|
for i = 1, #curData.rewards do
|
|
for j = 1, #configData do
|
|
if curData.rewards[i].missionId == configData[j].Id then
|
|
curData.rewards[i].otherData.Values = configData[j].Values
|
|
curData.rewards[i].otherData.Reward = configData[j].Reward
|
|
curData.rewards[i].otherData.Sort = configData[j].Sort
|
|
end
|
|
end
|
|
end
|
|
|
|
table.sort(curData.rewards,function (a,b)
|
|
if a.state == b.state then
|
|
return a.missionId < b.missionId
|
|
else
|
|
return a.state < b.state
|
|
end
|
|
end)
|
|
end
|
|
}
|
|
|
|
function this.GetExpertData(indexType,actType)
|
|
local curData = dataList[actType]
|
|
local actId = ActivityGiftManager.GetActivityIdByType(actType)
|
|
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", actId)
|
|
for i = 1, #curData.rewards do
|
|
for j = 1, #actRewardConfigs do
|
|
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
|
|
if indexType == 3 then -- 3 积天豪礼
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][2]
|
|
curData.rewards[i].otherData.info = ""
|
|
if curData.rewards[i].state == 1 then
|
|
curData.rewards[i].otherData.state = 2
|
|
elseif curData.rewards[i].progress == 1 then
|
|
curData.rewards[i].otherData.state = 0
|
|
else
|
|
curData.rewards[i].otherData.state = 1
|
|
end
|
|
elseif indexType == 4 then --升级限量豪礼
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
|
|
curData.rewards[i].otherData.info = ""
|
|
if curData.rewards[i].state == 1 then
|
|
curData.rewards[i].otherData.state = 2
|
|
else
|
|
if curData.rewards[i].progress > 0 then
|
|
if PlayerManager.level >= curData.rewards[i].otherData.Values then
|
|
curData.rewards[i].otherData.state = 0
|
|
else
|
|
curData.rewards[i].otherData.state = 1
|
|
end
|
|
else
|
|
curData.rewards[i].otherData.state = 3
|
|
end
|
|
curData.rewards[i].otherData.info = string.format(Language[12299],curData.rewards[i].progress)
|
|
end
|
|
else --日累计充值 达人
|
|
if actType == ActivityTypeDef.AccumulativeRechargeExper then
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][1]
|
|
else
|
|
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
|
|
end
|
|
if curData.rewards[i].state == 1 then
|
|
curData.rewards[i].otherData.state = 2
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
|
else
|
|
if indexType == 1 then
|
|
if curData.rewards[i].progress < curData.rewards[i].otherData.Values then
|
|
curData.rewards[i].otherData.state = 1
|
|
else
|
|
curData.rewards[i].otherData.state = 0
|
|
end
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].progress,curData.rewards[i].otherData.Values)
|
|
if curData.rewards[i].progress > curData.rewards[i].otherData.Values then
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
|
end
|
|
elseif indexType == 2 then
|
|
-- LogPink("curData.value:"..tostring(curData.value).." "..tostring(curData.rewards[i].otherData.Values))
|
|
if curData.value < curData.rewards[i].otherData.Values then
|
|
curData.rewards[i].otherData.state = 1
|
|
else
|
|
curData.rewards[i].otherData.state = 0
|
|
end
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.value,curData.rewards[i].otherData.Values)
|
|
if curData.value > curData.rewards[i].otherData.Values then
|
|
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].otherData.Values,curData.rewards[i].otherData.Values)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
curData.rewards[i].otherData.Reward = actRewardConfigs[j].Reward
|
|
curData.rewards[i].otherData.ContentsShow = actRewardConfigs[j].ContentsShow
|
|
curData.rewards[i].otherData.Sort = actRewardConfigs[j].Sort
|
|
if actRewardConfigs[j].Jump then
|
|
curData.rewards[i].otherData.Jump = actRewardConfigs[j].Jump[1]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
table.sort(dataList[actType].rewards,function (a,b)
|
|
if a.state == b.state then
|
|
return a.missionId < b.missionId
|
|
else
|
|
return a.state < b.state
|
|
end
|
|
end)
|
|
end
|
|
|
|
function this.GetData(actType)
|
|
if not dataList[actType] then
|
|
dataList[actType] = this.InitSingleTypeData(actType)
|
|
end
|
|
this.UpdateSingleTypeData(actType)
|
|
if TypeUpdateFunc[actType] then
|
|
TypeUpdateFunc[actType]()
|
|
end
|
|
return dataList[actType]
|
|
end
|
|
|
|
function this.InitSingleTypeData(actType)
|
|
local singleTypeData = {}
|
|
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
|
Log("InitData activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
|
singleTypeData.activityId = data.activityId
|
|
singleTypeData.value = data.value
|
|
singleTypeData.startTime = data.startTime
|
|
singleTypeData.endTime = data.endTime
|
|
singleTypeData.rewards = {}
|
|
for i = 1, #data.mission do
|
|
local reward = {}
|
|
reward.missionId = data.mission[i].missionId or 0
|
|
reward.progress = data.mission[i].progress or 0
|
|
reward.state = data.mission[i].state or 0
|
|
reward.otherData = {}
|
|
table.insert(singleTypeData.rewards,reward)
|
|
end
|
|
return singleTypeData
|
|
end
|
|
|
|
function this.UpdateSingleTypeData(actType)
|
|
local data = ActivityGiftManager.GetActivityTypeInfo(actType)
|
|
-- LogPink("Update".." activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime))
|
|
dataList[actType].activityId = data.activityId--应该无变化
|
|
dataList[actType].value = data.value
|
|
dataList[actType].startTime = data.startTime--应该无变化
|
|
dataList[actType].endTime = data.endTime--应该无变化
|
|
for i = 1, #data.mission do
|
|
for j = 1, #dataList[actType].rewards do
|
|
if data.mission[i].missionId == dataList[actType].rewards[j].missionId then
|
|
dataList[actType].rewards[j].missionId = data.mission[i].missionId or 0--应该无变化
|
|
dataList[actType].rewards[j].progress = data.mission[i].progress or 0
|
|
dataList[actType].rewards[j].state = data.mission[i].state or 0
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function this.CheckSingleRed(data)
|
|
local NeedCost = ConfigManager.GetConfigData(ConfigName.ComposeBook,data.otherData.needItems[1]).NeedCost
|
|
if data.progress > 0 then
|
|
if BagManager.GetTotalItemNum(NeedCost[1][1]) >= NeedCost[1][2] then
|
|
local list = BagManager.GetBagItemDataByItemType(ItemBaseType.Equip)
|
|
local EquipedEquipList = HeroManager.GetEquipedEquipList()
|
|
for i = 1, #data.otherData.needItems do
|
|
for j = 1, #list do
|
|
if data.otherData.needItems[i] == list[j].itemConfig.Id then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
for i = 1, #data.otherData.needItems do
|
|
for j = 1, #EquipedEquipList do
|
|
if data.otherData.needItems[i] == EquipedEquipList[j] then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
return CommonActPageManager |