【三界降魔】

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 actRankConfig = ConfigManager.GetConfig(ConfigName.ActivityRankingReward)
local itemsGrid = {}--item重复利用
local state = 0
local allRankData,myRankData
local npcList={}
@ -51,11 +50,7 @@ function DemonSlayerNewPanel:BindEvent()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.DemonSlayerNew, pos.x, pos.y)
end)
Util.AddClick(this.btnRank, function()
if state == 0 then
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[4])
elseif state == 1 then
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[11])
end
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[4])
end)
end
@ -89,70 +84,57 @@ function DemonSlayerNewPanel:Refresh(isAnim)
end
function DemonSlayerNewPanel:SetRank(ActInfo)
if state == 0 then
RankingManager.InitData(RANK_TYPE.MONSTER_RANK,function ()
allRankData,myRankData = RankingManager.GetRankingInfo()
for i = 1, 3 do
local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text")
item.text = Language[10423]
RankingManager.InitData(RANK_TYPE.MONSTER_RANK,function ()
allRankData,myRankData = RankingManager.GetRankingInfo()
self:SetPlayer()
end)
end
function DemonSlayerNewPanel:SetPlayer()
for i = 1, 3 do
local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text")
local image = Util.GetGameObject(this.pos,"pos"..i.."/ren"):GetComponent("Image")
local livePrefab = Util.GetGameObject(this.pos,"pos"..i.."/ren")
if allRankData[i] then
image.enabled = false
item.text = allRankData[i].userName
if npcList[i] then
npcList[i]:OnClose()
end
end)
elseif state == 1 then
RankingManager.InitData(RANK_TYPE.GOLD_EXPER,function ()
allRankData,myRankData = RankingManager.GetRankingInfo()
for i = 1, 3 do
local item = Util.GetGameObject(this.pos,"pos"..i.."/name"):GetComponent("Text")
local image = Util.GetGameObject(this.pos,"pos"..i.."/ren"):GetComponent("Image")
local livePrefab = Util.GetGameObject(this.pos,"pos"..i.."/ren")
if allRankData[i] then
image.enabled = false
item.text = allRankData[i].userName
if npcList[i] then
npcList[i]:OnClose()
end
local curPlayerLiveViewData = {
skin = allRankData[i].userSkin,
ride = allRankData[i].userMount,
sex = allRankData[i].sex,
designation = allRankData[i].userTitle
}
npcList[i] = PlayerLiveView:New(livePrefab.transform,2, curPlayerLiveViewData)
if curPlayerLiveViewData.userMount and curPlayerLiveViewData.userMount > 0 and curPlayerLiveViewData.userMount ~= PlayerRide.YUJIAN then
npcList[i]:OnOpen(GetPlayerRoleSingleConFig().Scale11,Vector3.New(0,-102.73,0),WALK_DIR.IDLE_LEFT)
else
npcList[i]:OnOpen(GetPlayerRoleSingleConFig().Scale11,Vector3.New(0,-102.73,0),WALK_DIR.IDLE_FRONT)
end
else
image.enabled = true
item.text = Language[10423]
end
local curPlayerLiveViewData = {
skin = allRankData[i].userSkin,
ride = allRankData[i].userMount,
sex = allRankData[i].sex,
designation = allRankData[i].userTitle
}
npcList[i] = PlayerLiveView:New(livePrefab.transform,2, curPlayerLiveViewData)
if curPlayerLiveViewData.userMount and curPlayerLiveViewData.userMount > 0 and curPlayerLiveViewData.userMount ~= PlayerRide.YUJIAN then
npcList[i]:OnOpen(GetPlayerRoleSingleConFig().Scale11,Vector3.New(0,-102.73,0),WALK_DIR.IDLE_LEFT)
else
npcList[i]:OnOpen(GetPlayerRoleSingleConFig().Scale11,Vector3.New(0,-102.73,0),WALK_DIR.IDLE_FRONT)
end
end,ActInfo.activityId)
else
image.enabled = true
item.text = Language[10423]
end
end
end
function DemonSlayerNewPanel:SetState(ActInfo)
local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400
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
for i = 1, #ActInfo.rewards do
num = ActInfo.rewards[i].otherData.Values[1][2] - ActInfo.rewards[i].progress
if num > 0 then
this.nextLevel.text = num
break
end
local num = 0
for i = 1, #ActInfo.rewards do
num = ActInfo.rewards[i].otherData.Values[1][2] - ActInfo.rewards[i].progress
if num > 0 then
this.nextLevel.text = num
break
end
this.tips:SetActive(num <= 0)
this.obj:SetActive(num > 0)
end
this.tips:SetActive(num <= 0)
this.obj:SetActive(num > 0)
end
function DemonSlayerNewPanel:OnShowData(ActInfo,isAnim)
@ -216,17 +198,8 @@ function DemonSlayerNewPanel:SetTime(ActInfo)
local extraTime = ConfigManager.GetConfigData(ConfigName.GlobalActivity,ActInfo.activityId).GapTime*86400
--设置一进去的时间,不设置的话一进去会不对
local time = ActInfo.endTime - GetTimeStamp() - extraTime
local timeStr = ""
if time > 0 then
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
local timeStr = "距活动结束:%s"
this.timeText.text = string.format(timeStr,TimeToFelaxible(time))
if self.timer then
self.timer:Stop()
@ -234,31 +207,15 @@ function DemonSlayerNewPanel:SetTime(ActInfo)
end
--计时器
self.timer = Timer.New(function ()
if state == 0 then
local time = ActInfo.endTime - GetTimeStamp() - extraTime
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
DemonSlayerNewPanel:Refresh()
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
local time = ActInfo.endTime - GetTimeStamp() - extraTime
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
DemonSlayerNewPanel:ClosePanel()
end
end,1,-1,true)
self.timer:Start()