数据报错修改

jiaoyangna 2020-10-16 10:32:50 +08:00
parent e2ebe3ee18
commit 7b368e3cd9
2 changed files with 10 additions and 6 deletions

View File

@ -65,20 +65,20 @@ end
--初始化幸运转盘
function this.InitLuckyTurnTables(msg)
this.luckyTurnTableRewards = {}
if msg.randomItem and #msg.randomItem > 0 then
if msg and msg.randomItem and #msg.randomItem > 0 then
for i = 1, #msg.randomItem do
table.insert(this.luckyTurnTableRewards,msg.randomItem[i])
end
this.luckyluckyTurnTableTimes = msg.randomNum
this.luckyluckyTurnTableRemainTime = msg.randomTime
elseif msg.random and #msg.random > 0 then
elseif msg and msg.random and #msg.random > 0 then
for i = 1, #msg.random do
table.insert(this.luckyTurnTableRewards,msg.random[i])
end
this.luckyluckyTurnTableTimes = this.luckyluckyTurnTableTimes + 1
this.luckyluckyTurnTableRemainTime = msg.overTime
elseif msg and #msg.nextRandom > 0 then
for i = 1, #msg do
elseif msg and msg.nextRandom and #msg.nextRandom > 0 then
for i = 1, #msg.nextRandom do
table.insert(this.luckyTurnTableRewards,msg.nextRandom[i])
end
this.luckyluckyTurnTableTimes = msg.count
@ -97,6 +97,7 @@ function this.InitHeroData(goodsInfo,type)
hero.goodsId = goodsInfo[i].goodsId
hero.goodsIndex = goodsInfo[i].goodsIndex
hero.remainTime = goodsInfo[i].remainTime
LogGreen("hero.goodsId "..hero.goodsId .." hero.goodsIndex:"..hero.goodsIndex.." hero.remainTime"..hero.remainTime)
table.insert(this.HeroData,hero)
end
elseif type == 2 then
@ -104,6 +105,7 @@ function this.InitHeroData(goodsInfo,type)
hero.goodsId = goodsInfo.goodsId
hero.goodsIndex = goodsInfo.goodsIndex
hero.remainTime = goodsInfo.remainTime
LogGreen("hero.goodsId "..hero.goodsId .." hero.goodsIndex:"..hero.goodsIndex.." hero.remainTime"..hero.remainTime)
table.insert(this.HeroData,hero)
end
table.sort(this.HeroData,function(a,b)
@ -129,6 +131,7 @@ function this.InitHeroData(goodsInfo,type)
table.sort(this.HeroData,function(a,b)
return a.goodsIndex > b.goodsIndex
end)
LogGreen("得到的招募数量:"..#this.HeroData)
return this.HeroData
end
@ -200,6 +203,7 @@ function this.InitMonsterData(BackMonsterDatas,type)
table.sort(this.MonsterData,function(a,b)
return a.monsterIndex > b.monsterIndex
end)
LogGreen("得到的怪物数量:"..#this.MonsterData)
return this.MonsterData
end

View File

@ -176,7 +176,7 @@ function this.EventTrigger(_data)
this.bossBtn:SetActive(false)
end
elseif _data.pathType==6 then --转盘
if XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime > 0 then
if XiaoYaoManager.luckyluckyTurnTableTimes > 0 and (XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime > 0) then
this.rouleBtn:SetActive(true)
else
this.rouleBtn:SetActive(false)
@ -248,7 +248,7 @@ function this.InitShowEvent()
if mapData.diceNum>1 then --骰子x2
-- body
end
if XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime > 0 then
if XiaoYaoManager.luckyluckyTurnTableTimes > 0 and (XiaoYaoManager.luckyluckyTurnTableRemainTime - PlayerManager.serverTime > 0) then
this.rouleBtn:SetActive(true)
else
this.rouleBtn:SetActive(false)