qinglong commit

dev_chengFeng
jiaoyangna 2020-08-22 20:22:30 +08:00
parent 4477c38a25
commit adff7af35a
4 changed files with 37 additions and 26 deletions

View File

@ -63,9 +63,9 @@ function this:AddListener()
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess, this.refresh) Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess)
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh) Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess)
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose,this.Closefunction) Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose)
end end
this.Closefunction = function() this.Closefunction = function()
Timer.New(function() Timer.New(function()

View File

@ -2,7 +2,7 @@ QinglongSerectTreasureManager = {}
local this = QinglongSerectTreasureManager local this = QinglongSerectTreasureManager
local TreasureSunlongConfig = ConfigManager.GetConfig(ConfigName.TreasureSunlongConfig) local TreasureSunlongConfig = ConfigManager.GetConfig(ConfigName.TreasureSunlongConfig)
local TreasureSunLongTaskConfig = ConfigManager.GetConfig(ConfigName.TreasureSunLongTaskConfig) local TreasureSunLongTaskConfig = ConfigManager.GetConfig(ConfigName.TreasureSunLongTaskConfig)
local rewardData = {}--表内活动任务数据 this.rewardData = {}--表内活动任务数据
local taskData = {} local taskData = {}
this.scoreId = 0 this.scoreId = 0
this.score = 0 this.score = 0
@ -14,19 +14,19 @@ function this.Initialize()
end end
function this.InitializeData() function this.InitializeData()
rewardData = {} this.rewardData = {}
taskData = {} taskData = {}
this.scoreId = TreasureSunlongConfig[1].Integral[1][1] this.scoreId = TreasureSunlongConfig[1].Integral[1][1]
for i, v in ConfigPairs(TreasureSunlongConfig) do for i, v in ConfigPairs(TreasureSunlongConfig) do
rewardData[v.Level] = {} this.rewardData[v.Level] = {}
rewardData[v.Level].level = v.Level this.rewardData[v.Level].level = v.Level
rewardData[v.Level].activityId = v.ActivityId this.rewardData[v.Level].activityId = v.ActivityId
if v.Integral then if v.Integral then
rewardData[v.Level].needScore = v.Integral[1][2] this.rewardData[v.Level].needScore = v.Integral[1][2]
else else
rewardData[v.Level].needScore = 0 this.rewardData[v.Level].needScore = 0
end end
rewardData[v.Level].Reward = {} this.rewardData[v.Level].Reward = {}
local temp = {} local temp = {}
if v.Reward then if v.Reward then
for n,m in ipairs(v.Reward) do for n,m in ipairs(v.Reward) do
@ -38,7 +38,7 @@ function this.InitializeData()
table.insert(temp,{ type = 2,item = { m[1] , m[2] } }) table.insert(temp,{ type = 2,item = { m[1] , m[2] } })
end end
end end
rewardData[v.Level].Reward = temp this.rewardData[v.Level].Reward = temp
end end
for i, v in ConfigPairs(TreasureSunLongTaskConfig) do for i, v in ConfigPairs(TreasureSunLongTaskConfig) do
if not taskData[v.Type] then if not taskData[v.Type] then
@ -56,27 +56,37 @@ end
function this.UpdateTreasureState() function this.UpdateTreasureState()
local level = this.GetLevel() local level = this.GetLevel()
for k,v in pairs(rewardData) do for k,v in pairs(this.rewardData) do
if level > k then if level < k then
v.state = -2 v.state = -2
else
v.state = 0
end end
end end
this.activityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody) this.activityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody)
local TreasureRewardState = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody) local TreasureRewardState = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody)
if TreasureRewardState and TreasureRewardState.mission then if TreasureRewardState and TreasureRewardState.mission then
--state -2 未达成 -1 普通和额外全部领取 0未领取 1激活秘宝可以再次领取 --state -2 未达成 -1 普通和额外全部领取 0未领取 1激活秘宝可以再次领取
for k,v in ipairs(TreasureRewardState.mission) do for k,v in ipairs(TreasureRewardState.mission) do
if v and level >= v.missionId then if v and level >= v.missionId then
rewardData[v.missionId].state = v.state this.rewardData[v.missionId].state = v.state
else else
rewardData[v.missionId].state = -2 this.rewardData[v.missionId].state = -2
end end
end end
end end
end end
function this.UpdateTreasureState2()
local level = this.GetLevel()
for k,v in pairs(this.rewardData) do
if level < k then
v.state = -2
elseif v.state == -2 then
v.state = 0
end
end
end
function this.UpdateTrailWeekTime(msg) function this.UpdateTrailWeekTime(msg)
LogRed("msg.weekTime:"..msg.weekTime) LogRed("msg.weekTime:"..msg.weekTime)
this.traiWeekTime = msg.weekTime this.traiWeekTime = msg.weekTime
@ -114,12 +124,13 @@ function this.GetScore()
end end
function this.SetSingleRewardState(id,state) function this.SetSingleRewardState(id,state)
rewardData[id].state = state this.rewardData[id].state = state
LogBlue("SetSingleRewardState:id:"..id.." state:"..state)
end end
function this.GetAllRewardData() function this.GetAllRewardData()
local temp ={} local temp ={}
for i, v in pairs(rewardData) do for i, v in pairs(this.rewardData) do
if i ~= 0 and v.activityId == this.activityId then if i ~= 0 and v.activityId == this.activityId then
table.insert(temp,v) table.insert(temp,v)
end end
@ -128,7 +139,7 @@ function this.GetAllRewardData()
end end
function this.GetRewardData(lv) function this.GetRewardData(lv)
return rewardData[lv] return this.rewardData[lv]
end end
function this.SetLevel(_level) function this.SetLevel(_level)
@ -159,7 +170,7 @@ function this.GetQinglongSerectTreasureRedPot()
return false return false
end end
local state = this.GetTreasureState() local state = this.GetTreasureState()
for i, v in pairs(rewardData) do for i, v in pairs(this.rewardData) do
if i ~= 0 then if i ~= 0 then
if v.state == 0 or (v.state == 1 and state > 0) then if v.state == 0 or (v.state == 1 and state > 0) then
return true return true

View File

@ -642,7 +642,7 @@ function this.RefreshTreasureLevel(buffer)
msg:ParseFromString(data) msg:ParseFromString(data)
LogGreen("青龙秘宝等级更新了:"..msg.level) LogGreen("青龙秘宝等级更新了:"..msg.level)
QinglongSerectTreasureManager.SetLevel(msg.level) QinglongSerectTreasureManager.SetLevel(msg.level)
QinglongSerectTreasureManager.UpdateTreasureState() QinglongSerectTreasureManager.UpdateTreasureState2()
end end
--幸运转盘 --幸运转盘

View File

@ -61,7 +61,7 @@ function this:OnShow(_parent,...)
rewardData = QinglongSerectTreasureManager.GetAllRewardData() rewardData = QinglongSerectTreasureManager.GetAllRewardData()
this:showRewardQinglong() this:showRewardQinglong()
end end
this.tip.text = "<color=#60A22C>解锁高阶战令,激活进阶</color><color=#95523B>专属奖励+直升15级</color><color=#60A22C>解锁立获限定称号+限定气泡</color>" this.tip.text = "<color=#60A22C>解锁高阶战令,激活进阶</color><color=#95523B>专属奖励+直升15级</color>"
end end
--充值成功 --充值成功