【三界降魔】

dev_chengFeng
ZhangBiao 2021-10-28 17:23:56 +08:00
parent 0903782f0e
commit 9c9beb78da
1 changed files with 53 additions and 96 deletions

View File

@ -4,7 +4,6 @@ local this = DemonSlayerNewPanel
local sortingOrder = 0 local sortingOrder = 0
local actRankConfig = ConfigManager.GetConfig(ConfigName.ActivityRankingReward) local actRankConfig = ConfigManager.GetConfig(ConfigName.ActivityRankingReward)
local itemsGrid = {}--item重复利用 local itemsGrid = {}--item重复利用
local state = 0
local allRankData,myRankData local allRankData,myRankData
local npcList={} local npcList={}
@ -51,11 +50,7 @@ function DemonSlayerNewPanel:BindEvent()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.DemonSlayerNew, pos.x, pos.y) UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.DemonSlayerNew, pos.x, pos.y)
end) end)
Util.AddClick(this.btnRank, function() Util.AddClick(this.btnRank, function()
if state == 0 then
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[4]) UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[4])
elseif state == 1 then
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[11])
end
end) end)
end end
@ -89,18 +84,13 @@ function DemonSlayerNewPanel:Refresh(isAnim)
end end
function DemonSlayerNewPanel:SetRank(ActInfo) function DemonSlayerNewPanel:SetRank(ActInfo)
if state == 0 then
RankingManager.InitData(RANK_TYPE.MONSTER_RANK,function () RankingManager.InitData(RANK_TYPE.MONSTER_RANK,function ()
allRankData,myRankData = RankingManager.GetRankingInfo() allRankData,myRankData = RankingManager.GetRankingInfo()
for i = 1, 3 do self:SetPlayer()
local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text")
item.text = Language[10423]
end
end) end)
elseif state == 1 then end
RankingManager.InitData(RANK_TYPE.GOLD_EXPER,function ()
allRankData,myRankData = RankingManager.GetRankingInfo() function DemonSlayerNewPanel:SetPlayer()
for i = 1, 3 do for i = 1, 3 do
local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text") local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text")
local image = Util.GetGameObject(this.pos,"pos"..i.."/ren"):GetComponent("Image") local image = Util.GetGameObject(this.pos,"pos"..i.."/ren"):GetComponent("Image")
@ -130,18 +120,11 @@ function DemonSlayerNewPanel:SetRank(ActInfo)
item.text = Language[10423] item.text = Language[10423]
end end
end end
end,ActInfo.activityId)
end
end end
function DemonSlayerNewPanel:SetState(ActInfo) function DemonSlayerNewPanel:SetState(ActInfo)
local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400 local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400
local time1 = ActInfo.endTime - GetTimeStamp() local time1 = ActInfo.endTime - GetTimeStamp()
state = time1 - extraTime > 0 and 0 or 1
this.textNum:SetActive(state == 0)
if state == 0 then
local num = 0 local num = 0
for i = 1, #ActInfo.rewards do for i = 1, #ActInfo.rewards do
num = ActInfo.rewards[i].otherData.Values[1][2] - ActInfo.rewards[i].progress num = ActInfo.rewards[i].otherData.Values[1][2] - ActInfo.rewards[i].progress
@ -152,7 +135,6 @@ function DemonSlayerNewPanel:SetState(ActInfo)
end end
this.tips:SetActive(num <= 0) this.tips:SetActive(num <= 0)
this.obj:SetActive(num > 0) this.obj:SetActive(num > 0)
end
end end
function DemonSlayerNewPanel:OnShowData(ActInfo,isAnim) function DemonSlayerNewPanel:OnShowData(ActInfo,isAnim)
@ -216,17 +198,8 @@ function DemonSlayerNewPanel:SetTime(ActInfo)
local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400 local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400
--设置一进去的时间,不设置的话一进去会不对 --设置一进去的时间,不设置的话一进去会不对
local time = ActInfo.endTime - GetTimeStamp() - extraTime local time = ActInfo.endTime - GetTimeStamp() - extraTime
local timeStr = "" local timeStr = "距活动结束:%s"
if time > 0 then this.timeText.text = string.format(timeStr,TimeToFelaxible(time))
timeStr = "距活动结束:%s"
else
timeStr = "距活动关闭:%s"
end
if time > 3600 then
this.timeText.text = string.format(timeStr,TimeToDHM(time))
else
this.timeText.text = string.format(timeStr,TimeToMS(time))
end
if self.timer then if self.timer then
self.timer:Stop() self.timer:Stop()
@ -234,7 +207,6 @@ function DemonSlayerNewPanel:SetTime(ActInfo)
end end
--计时器 --计时器
self.timer = Timer.New(function () self.timer = Timer.New(function ()
if state == 0 then
local time = ActInfo.endTime - GetTimeStamp() - extraTime local time = ActInfo.endTime - GetTimeStamp() - extraTime
if time > 3600 then if time > 3600 then
this.timeText.text = string.format(timeStr,TimeToDHM(time)) this.timeText.text = string.format(timeStr,TimeToDHM(time))
@ -243,22 +215,7 @@ function DemonSlayerNewPanel:SetTime(ActInfo)
end end
time = time -1 time = time -1
if time <= 0 then if time <= 0 then
DemonSlayerNewPanel:Refresh() DemonSlayerNewPanel:ClosePanel()
end
elseif state == 1 then
local time = ActInfo.endTime - GetTimeStamp()
if time > 3600 then
this.timeText.text = string.format(timeStr,TimeToDHM(time))
else
this.timeText.text = string.format(timeStr,TimeToMS(time))
end
time = time -1
if time <= 0 then
if self.timer then
self.timer:Stop()
self.timer = nil
end
end
end end
end,1,-1,true) end,1,-1,true)
self.timer:Start() self.timer:Start()