TCX_LongZhu
DESKTOP-MMO982B\User 2025-02-20 18:20:58 +08:00
parent 75f1909fd1
commit 456fb83d83
1 changed files with 171 additions and 92 deletions

View File

@ -2,8 +2,8 @@
local ArenaTypePanel = Inherit(BasePanel)
local this = ArenaTypePanel
local state=0
local tipStr=nil
local state = 0
local tipStr = nil
--初始化组件(用于子类重写)
function ArenaTypePanel:InitComponent()
this.spLoader = SpriteLoader.New()
@ -11,24 +11,37 @@ function ArenaTypePanel:InitComponent()
this.btnArena = Util.GetGameObject(self.gameObject, "content/btnArena")
this.btnTopMatch = Util.GetGameObject(self.gameObject, "content/btnTopMatch")
this.btnYXLD = Util.GetGameObject(self.gameObject, "content/btnYXLD")
this.yxld_Name = Util.GetGameObject(this.btnYXLD, "Name"):GetComponent("Text")
this.yxld_normal = Util.GetGameObject(this.btnYXLD, "normal")
this.yxld_lock = Util.GetGameObject(this.btnYXLD, "lock")
this.yxld_lockTip = Util.GetGameObject(this.yxld_lock, "Tip"):GetComponent("Text")
this.yxld_Season = Util.GetGameObject(this.yxld_normal, "Season"):GetComponent("Text")
this.yxld_SeasonTime = Util.GetGameObject(this.yxld_normal, "Season/Time"):GetComponent("Text")
this.yxld_Score = Util.GetGameObject(this.yxld_normal, "Score/Text"):GetComponent("Text")
this.yxld_Rank = Util.GetGameObject(this.yxld_normal, "Rank/Text"):GetComponent("Text")
this.yxld_RankNane = Util.GetGameObject(this.yxld_normal, "Rank"):GetComponent("Text")
this.yxld_Redpot = Util.GetGameObject(this.btnYXLD, "bg/redpot")
this.Arena_Name = Util.GetGameObject(this.btnArena, "Name"):GetComponent("Text")
this.Arena_Season = Util.GetGameObject(this.btnArena, "Season/Text"):GetComponent("Text")
this.Arena_Season = Util.GetGameObject(this.btnArena, "Season"):GetComponent("Text")
this.Arena_SeasonTime = Util.GetGameObject(this.btnArena, "Season/Time"):GetComponent("Text")
this.Arena_Score = Util.GetGameObject(this.btnArena, "Score/Text"):GetComponent("Text")
this.Arena_Rank = Util.GetGameObject(this.btnArena, "Rank/Text"):GetComponent("Text")
this.Arena_Score = Util.GetGameObject(this.btnArena, "Score"):GetComponent("Text")
this.Arena_Rank = Util.GetGameObject(this.btnArena, "Rank"):GetComponent("Text")
this.Arena_RankNane = Util.GetGameObject(this.btnArena, "RankName"):GetComponent("Text")
this.TopMatch_Normal = Util.GetGameObject(this.btnTopMatch, "normal")
this.TopMatch_NormalBG = Util.GetGameObject(this.btnTopMatch, "nBg")
this.TopMatch_Name = Util.GetGameObject(this.btnTopMatch, "Name"):GetComponent("Text")
this.TopMatch_SeasonState=Util.GetGameObject(this.TopMatch_Normal, "Season"):GetComponent("Text")
this.TopMatch_Season = Util.GetGameObject(this.TopMatch_Normal, "Season/Text"):GetComponent("Text")
this.TopMatch_SeasonState = Util.GetGameObject(this.TopMatch_Normal, "Season"):GetComponent("Text")
this.TopMatch_Season = Util.GetGameObject(this.TopMatch_Normal, "Season"):GetComponent("Text")
this.TopMatch_SeasonTime = Util.GetGameObject(this.TopMatch_Normal, "Season/Time"):GetComponent("Text")
this.TopMatch_StageObj = Util.GetGameObject(this.TopMatch_Normal, "Stage")
this.TopMatch_BestRankObj = Util.GetGameObject(this.TopMatch_Normal, "BestRank")
this.TopMatch_Stage = Util.GetGameObject(this.TopMatch_Normal, "Stage/Text"):GetComponent("Text")
this.TopMatch_Rank = Util.GetGameObject(this.TopMatch_Normal, "MyRank/Text"):GetComponent("Text")
this.TopMatch_BestRank = Util.GetGameObject(this.TopMatch_Normal, "BestRank/Text"):GetComponent("Text")
this.TopMatch_Stage = Util.GetGameObject(this.TopMatch_Normal, "Stage"):GetComponent("Text")
this.TopMatch_Rank = Util.GetGameObject(this.TopMatch_Normal, "MyRank"):GetComponent("Text")
this.TopMatch_BestRank = Util.GetGameObject(this.TopMatch_Normal, "BestRank"):GetComponent("Text")
this.TopMatch_Red = Util.GetGameObject(this.btnTopMatch, "bg/redpot")
this.TopMatch_Lock = Util.GetGameObject(this.btnTopMatch, "lock")
this.TopMatch_LockBg = Util.GetGameObject(this.btnTopMatch, "lBg")
@ -47,28 +60,39 @@ function ArenaTypePanel:BindEvent()
JumpManager.GoJump(8001)
end)
Util.AddClick(this.btnTopMatch, function()
-- local isOpen = ActTimeCtrlManager.IsSwitchOpen(FUNCTION_OPEN_TYPE.TOP_MATCH)
-- if not isOpen then
-- PopupTipPanel.ShowTip("巅峰赛暂未开放")
-- return
-- end
--UIManager.OpenPanel(UIName.ArenaTopMatchPanel)
if state<1 or state==2 or state==4 then
PopupTipPanel.ShowTip(tipStr)
if state < 1 or state == 2 or state == 4 then
PopupTipPanel.ShowTip(GetLanguageStrById(tipStr))
return
end
if JumpServerManager.stage==1 or JumpServerManager.stage==3 then
if JumpServerManager.stage == 1 or JumpServerManager.stage == 3 then
UIManager.OpenPanel(UIName.JumpServerHightLadderPanel)
end
end)
Util.AddClick(this.btnYXLD, function()
local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
if isOpen then
NetManager.CrossYuXuLunDaoGetInfoRequest(1, function(msg)
UIManager.OpenPanel(UIName.WorldArenaMainPanel, msg)
end)
else
local tip = GetFunctionOpenTip(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
PopupTipPanel.ShowTip(tip)
end
end)
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
if PlayerPrefs.HasKey("ArenaTypePanel"..PlayerManager.uid) then
if PlayerPrefs.HasKey("ArenaTypePanel" .. PlayerManager.uid) then
DynamicActivityManager.isopenJingjishilian = false
else
PlayerPrefs.SetInt("ArenaTypePanel"..PlayerManager.uid,1)
PlayerPrefs.SetInt("ArenaTypePanel" .. PlayerManager.uid, 1)
DynamicActivityManager.isopenJingjishilian = true
end
this:ClosePanel()
@ -76,7 +100,7 @@ function ArenaTypePanel:BindEvent()
BindRedPointObject(RedPointType.Arena_Type_Normal, this.btnArenaRedpot)
BindRedPointObject(RedPointType.JumpServer_HightLadder, this.TopMatch_Red)
BindRedPointObject(RedPointType.WorldArena_reward, this.yxld_Redpot)
end
--添加事件监听(用于子类重写)
@ -105,26 +129,27 @@ end
-- 打开,重新打开时回调
function ArenaTypePanel:OnShow()
-- 竞技场
if ArenaManager.resetData==nil then
if ArenaManager.resetData == nil then
NetManager.NewArenaResetRequest()
end
LogError("ArenaManager.resetData.isFirst=="..ArenaManager.resetData.isFirst.." #ArenaManager.resetData.drop=="..#ArenaManager.resetData.drop)
if ArenaManager.resetData and (ArenaManager.resetData.isFirst==1 or #ArenaManager.resetData.drop>0) then
UIManager.OpenPanel(UIName.ArenaNewUpRankPanel,ArenaManager.resetData)
ArenaManager.resetData=nil
LogError("ArenaManager.resetData.isFirst==" ..
ArenaManager.resetData.isFirst .. " #ArenaManager.resetData.drop==" .. #ArenaManager.resetData.drop)
if ArenaManager.resetData and (ArenaManager.resetData.isFirst == 1 or #ArenaManager.resetData.drop > 0) then
UIManager.OpenPanel(UIName.ArenaNewUpRankPanel, ArenaManager.resetData)
ArenaManager.resetData = nil
end
NetManager.GetNewArenaInfoRequest(function()
-- NetManager.RequestArenaRankData(1, function()
this.RefreshArenaShow()
-- end)
-- NetManager.RequestArenaRankData(1, function()
this.RefreshArenaShow()
-- end)
end)
--罗浮争锋
--this.RefreshTopMatchShow()
local isOpen=CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
if isOpen then
NetManager.QueryLuofuRegisterInfoRequest(function ()
if JumpServerManager.stage==1 or JumpServerManager.stage==3 then
JumpServerManager.GetWorldArenaInfoRequest(JumpServerManager.arenaType,function()
NetManager.QueryLuofuRegisterInfoRequest(function()
if JumpServerManager.stage == 1 or JumpServerManager.stage == 3 then
JumpServerManager.GetWorldArenaInfoRequest(JumpServerManager.arenaType, function()
this.RefreshTopMatchShow()
-- 计时器
if this.TimeCounter then return end
@ -141,6 +166,21 @@ function ArenaTypePanel:OnShow()
end
local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
if isOpen then
LogError("玉虚论道已开启=======================================")
NetManager.CrossYuXuLunDaoGetInfoRequest(1, function(msg)
--UIManager.OpenPanel(UIName.WorldArenaMainPanel,msg)
this.RefreshYXLDShow(msg)
end)
else
this.RefreshYXLDShow()
end
-- 巅峰战
-- ArenaTopMatchManager.RequestTopMatchBaseInfo(function()
-- this.RefreshTopMatchShow()
@ -154,20 +194,53 @@ end
-- 刷新竞技场显示
function this.RefreshArenaShow()
this.Arena_Name.text = "天下第一武道会"--ArenaManager.GetArenaName()
this.Arena_Name.text = ArenaManager.GetArenaName()
local baseData = ArenaManager.GetArenaBaseData()
this.Arena_Score.text = baseData.score
this.Arena_Score.text = GetLanguageStrById("我的积分:") .. baseData.score
local _, myRankInfo = ArenaManager.GetRankInfo()
local myRank = myRankInfo.personInfo.rank
if myRank < 0 then
myRank = Language[10036]
end
this.Arena_Rank.text = myRank
this.Arena_RankNane.text=ConfigManager.GetConfigData(ConfigName.ArenaRoom,baseData.roomId).ArenaRoomName --baseData.rankName
this.Arena_Rank.text = GetLanguageStrById("我的排名:") .. myRank
this.Arena_RankNane.text = GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ArenaRoom, baseData.roomId)
.ArenaRoomName) --baseData.rankName
local serData = ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.ARENA)
local startDate = os.date("%m.%d", serData.startTime)
local endDate = os.date("%m.%d", serData.endTime)
this.Arena_Season.text = string.format("%s-%s", startDate, endDate)
this.Arena_Season.text = GetLanguageStrById("当前赛季:") .. string.format("%s-%s", startDate, endDate)
end
-- 刷新竞技场显示
function this.RefreshYXLDShow(_msg)
this.yxld_Name.text = Language[10087]
local yxTip = ""
if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_YuXu) then
this.yxld_lock:SetActive(true)
this.yxld_normal:SetActive(false)
this.yxld_lockTip.text = GetFunctionOpenTip(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
else
this.yxld_lock:SetActive(false)
this.yxld_normal:SetActive(true)
local myRank = 0
if _msg then
this.yxld_Score.text = GetLanguageStrById("我的积分:") .. _msg.newMyscore
myRank = _msg.myRank
else
this.yxld_Score.text = GetLanguageStrById("我的积分:") .. WorldArenaManager.GetNewScore()
myRank = WorldArenaManager.GetMyRank()
end
if myRank <= 0 then
myRank = Language[10036]
end
this.yxld_Rank.text = GetLanguageStrById("我的排名:") .. myRank
--this.yxld_RankNane.text=ConfigManager.GetConfigData(ConfigName.ArenaRoom,baseData.roomId).ArenaRoomName --baseData.rankName
local serData = ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
local startDate = os.date("%m.%d", serData.startTime)
local endDate = os.date("%m.%d", serData.endTime)
this.yxld_Season.text = GetLanguageStrById("当前赛季:") .. string.format("%s-%s", startDate, endDate)
end
end
-- 刷新巅峰战显示
@ -189,8 +262,8 @@ function this.RefreshTopMatchShow()
-- local titleName, stageName = ArenaTopMatchManager.GetCurTopMatchName()
-- this.TopMatch_Name.text = titleName
-- this.TopMatch_Stage.text = stageName
-- this.TopMatch_Rank.text = tmData.myrank <= 0 and Language[10036] or ArenaTopMatchManager.GetRankNameByRank(tmData.myrank)
-- this.TopMatch_BestRank.text = tmData.maxRank <= 0 and Language[10086] or this.GetRankName(tmData.maxRank)
-- this.TopMatch_Rank.text = tmData.myrank <= 0 and "未上榜" or ArenaTopMatchManager.GetRankNameByRank(tmData.myrank)
-- this.TopMatch_BestRank.text = tmData.maxRank <= 0 and "无" or this.GetRankName(tmData.maxRank)
-- else
-- this.TopMatch_Normal:SetActive(false)
-- this.TopMatch_Lock:SetActive(true)
@ -201,37 +274,35 @@ function this.RefreshTopMatchShow()
-- this.TopMatch_Lock_Title.text = string.format("%s解锁", ActTimeCtrlManager.GetSwitchOpenTip(FUNCTION_OPEN_TYPE.TOP_MATCH))
-- end
this.TopMatch_Name.text = "沙鲁大赛"
this.TopMatch_Name.text = Language[10088]
--判断功能是否开启
if not CheckFunctionOpen(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then
state=-6
state = -6
tipStr = GetFunctionOpenTip(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
else
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then
state = -1
tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
tipStr = ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
end
--判断世界等级是否够
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).WorldLevel
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting, 1).WorldLevel
if PlayerManager.worldLeve < conFigWorldLevel then --如果世界等级不足
state = -2
tipStr = string.format("世界等级到达%s后开启",conFigWorldLevel)
tipStr = string.format(Language[10089], conFigWorldLevel)
end
--判断是否在赛季中
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) == false then --如果未解锁
state = -3
tipStr = "赛季过渡中!"
tipStr = Language[10090]
end
if not JumpServerManager.GetHightLadderDataIsStart() then
state = -4
tipStr = string.format("开服第%s周开放",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).OpenWeek)
tipStr = string.format(Language[10091],
ConfigManager.GetConfigData(ConfigName.MServerArenaSetting, 1).OpenWeek)
elseif not JumpServerManager.GetHightLadderDataIsGroup() then
state = -5
tipStr = "未划分跨服分组,无法参与!"
tipStr = Language[10092]
else
state = 1
tipStr = ""
@ -241,71 +312,70 @@ function this.RefreshTopMatchShow()
if state<1 or state==2 or state==4 then
if state < 1 or state == 2 or state == 4 then
this.TopMatch_Normal:SetActive(false)
this.TopMatch_Lock:SetActive(true)
--this.TopMatch_Name.text = "未达到开启条件"
this.TopMatch_Lock_Title.text = tipStr
this.TopMatch_Lock_Time.text = "未达到开启条件"
this.TopMatch_Lock_Time.text = Language[10093]
else
local serData = ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
if serData then
local startDate = os.date("%m.%d", serData.startTime)
local endDate = os.date("%m.%d", serData.endTime)
local state=JumpServerManager.stage
local str=""
if state==JumpServer_Stage.NoStar then
str="赛季报名期:"
elseif state==JumpServer_Stage.RankInit then
str="战斗初始化:"
elseif state==JumpServer_Stage.Attack then
str="赛季对战期:"
elseif state==JumpServer_Stage.End then
str="赛季结算中:"
local state = JumpServerManager.stage
local str = ""
if state == JumpServer_Stage.NoStar then
str = Language[10094]
elseif state == JumpServer_Stage.RankInit then
str = Language[10095]
elseif state == JumpServer_Stage.Attack then
str = Language[10096]
elseif state == JumpServer_Stage.End then
str = Language[10097]
end
this.TopMatch_SeasonState.text=str
this.TopMatch_Season.text = string.format("%s-%s", startDate, endDate)
this.TopMatch_SeasonState.text = str
this.TopMatch_Season.text = GetLanguageStrById("当前赛季:") .. string.format("%s-%s", startDate, endDate)
this.TopMatch_StageObj:SetActive(false)
this.TopMatch_BestRankObj:SetActive(false)
local rank=JumpServerManager.GetHightLadderDataMyRank() <= 1000 and JumpServerManager.GetHightLadderDataMyRank() or "1000+"
this.TopMatch_Rank.text=rank
local rank = JumpServerManager.GetHightLadderDataMyRank() <= 1000 and
JumpServerManager.GetHightLadderDataMyRank() or "1000+"
this.TopMatch_Rank.text = GetLanguageStrById("我的排名:") .. rank
else
this.TopMatch_Season.text = "暂未开放"
this.TopMatch_Season.text = GetLanguageStrById("当前赛季:") .. Language[10098]
end
this.TopMatch_Normal:SetActive(true)
this.TopMatch_NormalBG:SetActive(true)
this.TopMatch_Lock:SetActive(false)
this.TopMatch_LockBg:SetActive(false)
end
end
-- 获取我得排名信息
function this.GetRankName(rank)
if rank == 1 then
return Language[10087]
return Language[10099]
elseif rank == 2 then
return Language[10088]
return Language[10100]
else
local maxTurn = ArenaTopMatchManager.GetEliminationMaxRound()
for i = 1, maxTurn do
if i == maxTurn then
local config = ConfigManager.GetConfigData(ConfigName.ChampionshipSetting, 1)
return config.ChampionshipPlayer..Language[10089]
return config.ChampionshipPlayer .. Language[10101]
end
if rank > math.pow(2, i) and rank <= math.pow(2, i+1) then
return (i+1)..Language[10089]
if rank > math.pow(2, i) and rank <= math.pow(2, i + 1) then
return (i + 1) .. Language[10101]
end
end
end
end
--
function this.TimeUpdate()
local leftTime = ArenaManager.GetLeftTime()
if leftTime <= 0 then
this.RefreshArenaShow()
end
this.Arena_SeasonTime.text = string.format(Language[10090], TimeToHMS(leftTime))
this.Arena_SeasonTime.text = string.format(Language[10102], TimeToHMS(leftTime))
local isOpen = ActTimeCtrlManager.IsSwitchOpen(FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
if isOpen then
@ -316,7 +386,7 @@ function this.TimeUpdate()
-- if leftTime <= 0 then
-- this.RefreshTopMatchShow()
-- end
-- this.TopMatch_SeasonTime.text = string.format(Language[10090], TimeToHMS(leftTime))
-- this.TopMatch_SeasonTime.text = string.format("(剩余时间:%s", TimeToHMS(leftTime))
-- else
-- if startTime then
-- local leftTime = startTime - GetTimeStamp()
@ -324,18 +394,18 @@ function this.TimeUpdate()
-- this.RefreshTopMatchShow()
-- this.TopMatch_SeasonTime.text = ""
-- else
-- this.TopMatch_SeasonTime.text = string.format(Language[10091], TimeToHMS(leftTime))
-- this.TopMatch_SeasonTime.text = string.format("(即将开始:%s", TimeToHMS(leftTime))
-- end
-- else
-- this.RefreshTopMatchShow()
-- this.TopMatch_SeasonTime.text = ""
-- end
-- end
local leftTime=JumpServerManager.GetHightLadderDataEndTime() - GetTimeStamp()
local leftTime = JumpServerManager.GetHightLadderDataEndTime() - GetTimeStamp()
if leftTime <= 0 then
this.RefreshTopMatchShow()
end
this.TopMatch_SeasonTime.text = string.format(Language[10090], TimeToHMS(leftTime))
this.TopMatch_SeasonTime.text = string.format(Language[10102], TimeToHMS(leftTime))
else
-- local startTime, endTime = ArenaTopMatchManager.GetTopMatchTime()
-- if startTime then
@ -345,6 +415,13 @@ function this.TimeUpdate()
-- this.TopMatch_Lock_Time.text = ""
-- end
-- this.TopMatch_Lock_Time.gameObject:SetActive(false)
end
local isOpen = ActTimeCtrlManager.IsSwitchOpen(FUNCTION_OPEN_TYPE.JumpServer_YuXu)
if isOpen then
local yuxuLeft = WorldArenaManager.GetLeftTime()
this.yxld_SeasonTime.text = string.format(Language[10102], TimeToHMS(yuxuLeft))
else
end
end
@ -358,6 +435,8 @@ function ArenaTypePanel:OnDestroy()
this.spLoader:Destroy()
ClearRedPointObject(RedPointType.Arena_Type_Normal, this.btnArenaRedpot)
ClearRedPointObject(RedPointType.JumpServer_HightLadder, this.TopMatch_Red)
ClearRedPointObject(RedPointType.WorldArena_reward, this.yxld_Redpot)
-- SubUIManager.Close(this.UpView)
if this.TimeCounter then
this.TimeCounter:Stop()