468 lines
22 KiB
Lua
468 lines
22 KiB
Lua
require("Base/BasePanel")
|
||
JumpServerHightLadderPanel = Inherit(BasePanel)
|
||
local this = JumpServerHightLadderPanel
|
||
local datas = {}
|
||
local liveNodeList = {}
|
||
local goList = {}
|
||
local stage = 0
|
||
local enterable = false
|
||
local JoinRank = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).JoinRank
|
||
local isFirstRefresh = false
|
||
--初始化组件(用于子类重写)
|
||
function JumpServerHightLadderPanel:InitComponent()
|
||
this.spLoader = SpriteLoader.New()
|
||
this.timeText = Util.GetGameObject(self.gameObject, "titleObg/timeImage/Text")
|
||
this.helpBtn = Util.GetGameObject(self.gameObject,"HelpBtn")
|
||
this.helpPos = this.helpBtn:GetComponent("RectTransform").localPosition
|
||
this.sortBtn = Util.GetGameObject(self.gameObject,"rightBtns/sortBtn")
|
||
this.rewardSortBtn = Util.GetGameObject(self.gameObject,"rightBtns/rewardSortBtn")
|
||
this.recordBtn = Util.GetGameObject(self.gameObject,"rightBtns/recordBtn")
|
||
this.shopBtn = Util.GetGameObject(self.gameObject,"rightBtns/shopBtn")
|
||
this.formationBtn = Util.GetGameObject(self.gameObject,"rightBtns/formationBtn")
|
||
this.backBtn = Util.GetGameObject(self.gameObject, "backBtn")
|
||
|
||
-- this.singlePre = Util.GetGameObject(self.gameObject, "middleObg/singlePre")
|
||
-- this.rect = Util.GetGameObject(self.gameObject, "middleObg/rect")
|
||
-- this.scrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,this.rect.transform,this.singlePre,
|
||
-- nil,Vector2.New(1079.9,1533.4),1,1,Vector2.New(0,0))
|
||
-- this.scrollView.moveTween.MomentumAmount = 1
|
||
-- this.scrollView.moveTween.Strength = 2
|
||
for i = 1, 4 do
|
||
goList[i] = Util.GetGameObject(self.gameObject, "middleObg/rect/singlePre (".. i ..")")
|
||
end
|
||
|
||
this.mySortText = Util.GetGameObject(self.gameObject, "endObg/mySortText")
|
||
this.sdBtn = Util.GetGameObject(self.gameObject,"endObg/sdBtn")
|
||
this.numInfo = Util.GetGameObject(self.gameObject, "endObg/numInfo")
|
||
Util.GetGameObject(self.gameObject,"endObg/sdBtn/Text"):GetComponent("Text").text = "扫 荡"
|
||
Util.GetGameObject(self.gameObject, "endObg/numInfo/mianfeiText"):GetComponent("Text").text = "免费次数:"
|
||
this.mianfeiText = Util.GetGameObject(self.gameObject, "endObg/numInfo/mianfeiText/Text"):GetComponent("Text")
|
||
Util.GetGameObject(self.gameObject, "endObg/numInfo/buyText"):GetComponent("Text").text = "购买次数:"
|
||
this.buyText = Util.GetGameObject(self.gameObject, "endObg/numInfo/buyText/Text"):GetComponent("Text")
|
||
this.addNumBtn = Util.GetGameObject(self.gameObject,"endObg/numInfo/addNumBtn/click")
|
||
this.canPlayerTipText = Util.GetGameObject(self.gameObject, "endObg/canPlayerTipText")
|
||
|
||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
||
end
|
||
|
||
--绑定事件(用于子类重写)
|
||
function JumpServerHightLadderPanel:BindEvent()
|
||
Util.AddClick(this.backBtn,function()
|
||
self:ClosePanel()
|
||
end)
|
||
Util.AddClick(this.helpBtn,function()
|
||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.JumpServerHeightLadder,this.helpPos.x,this.helpPos.y)
|
||
end)
|
||
Util.AddClick(this.sortBtn,function()
|
||
JumpServerManager.SetCurPersonInfo(nil)
|
||
UIManager.OpenPanel(UIName.RankingSingleListPanel,rankKingList[18])
|
||
end)
|
||
Util.AddClick(this.rewardSortBtn,function()
|
||
UIManager.OpenPanel(UIName.JumpServerHightLadderRewardSortPanel,FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
|
||
end)
|
||
Util.AddClick(this.recordBtn,function()
|
||
UIManager.OpenPanel(UIName.JumpServerHightLadderRecordPopup)
|
||
end)
|
||
Util.AddClick(this.shopBtn,function()
|
||
JumpManager.GoJump(20002)
|
||
end)
|
||
Util.AddClick(this.formationBtn,function()
|
||
-- if not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then
|
||
-- PopupTipPanel.ShowTip(Language[10082])
|
||
-- return
|
||
-- end
|
||
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.JUMPSERVER_HIGHTLADDER)
|
||
end)
|
||
|
||
Util.AddClick(this.sdBtn,function()
|
||
--条件判断
|
||
this.BuyVipFun(1,2,function()
|
||
--直接战斗
|
||
JumpServerManager.StarFightHightLadder(nil,1,function(msg)
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_MIANFEINUM, 1)--更新特权
|
||
this.RefreshBuyNum()
|
||
this.OnShowPanel()
|
||
end)
|
||
end)
|
||
|
||
end)
|
||
Util.AddClick(this.addNumBtn,function()
|
||
this.BuyVipFun(2,nil)
|
||
end)
|
||
end
|
||
|
||
--添加事件监听(用于子类重写)
|
||
function JumpServerHightLadderPanel:AddListener()
|
||
Game.GlobalEvent:AddEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderPanel, this.OnShowPanel)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Privilege.OnPrivilegeZeroUpdate, this.RefreshBuyNum)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Privilege.OnPrivilegeUpdate, this.RefreshBuyNum)
|
||
-- Game.GlobalEvent:AddEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderNum, this.RefreshBuyNum)
|
||
end
|
||
|
||
--移除事件监听(用于子类重写)
|
||
function JumpServerHightLadderPanel:RemoveListener()
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderPanel, this.OnShowPanel)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Privilege.OnPrivilegeZeroUpdate, this.RefreshBuyNum)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Privilege.OnPrivilegeUpdate, this.RefreshBuyNum)
|
||
-- Game.GlobalEvent:AddEvent(GameEvent.JumpServerHeightLadder.UpdateHeightLadderNum, this.RefreshBuyNum)
|
||
end
|
||
|
||
--跨服
|
||
function JumpServerHightLadderPanel:OnOpen()
|
||
FormationManager.GetFormationByID(FormationTypeDef.JUMPSERVER_HIGHTLADDER)
|
||
this.UpView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.JumpServerHightLadder})
|
||
this.RefreshOnOpen()
|
||
isFirstRefresh = false
|
||
end
|
||
|
||
--界面打开时调用(用于子类重写)
|
||
function JumpServerHightLadderPanel:OnShow()
|
||
local timeStr = "后开始"
|
||
if stage == JumpServer_Stage.Attack then
|
||
timeStr = "后结束"
|
||
elseif stage == JumpServer_Stage.End then
|
||
timeStr = "后开始"
|
||
end
|
||
this.RemainTimeDown(this.timeText,this.timeText:GetComponent("Text"),JumpServerManager.GetHightLadderDataEndTime(),timeStr)
|
||
end
|
||
function JumpServerHightLadderPanel.RefreshOnOpen()
|
||
JumpServerManager.GetWorldArenaInfoRequest()
|
||
end
|
||
function this:OnSortingOrderChange()
|
||
-- Util.AddParticleSortLayer(this.effect, self.sortingOrder - orginLayer)
|
||
end
|
||
function this.OnShowPanel()
|
||
stage = JumpServerManager.GetHightLadderDatastage()
|
||
datas = JumpServerManager.GetHightLadderDataArenaInfo()
|
||
enterable = JumpServerManager.GetHightLadderDataEnterable()
|
||
LogPink("datas.arenaEnemys "..#datas.arenaEnemys)
|
||
for i = 1, 4 do
|
||
local curData = datas.arenaEnemys[i] or {}
|
||
this.ShowSingleData(goList[i],curData,i)
|
||
end
|
||
|
||
|
||
this.canPlayerTipText:SetActive(false)
|
||
this.mySortText:SetActive(false)
|
||
this.sdBtn:SetActive(false)
|
||
this.numInfo:SetActive(false)
|
||
local timeStr = ""
|
||
LogPink("stage "..stage)
|
||
this.canPlayerTipText.transform.localPosition = Vector3.New(1.3, 46.5, 0)
|
||
this.canPlayerTipText:GetComponent("Text").text =""-- "本服千战逐胜台前"..JoinRank.."名可以参加"
|
||
timeStr = "后开始"
|
||
--1 未开始 2 战斗阶段 3 膜拜阶段
|
||
if stage == JumpServer_Stage.NoStar then
|
||
this.canPlayerTipText:SetActive(true)
|
||
elseif stage == JumpServer_Stage.Attack then
|
||
timeStr = "后结束"
|
||
if enterable then
|
||
this.mySortText:SetActive(true)
|
||
this.sdBtn:SetActive(true)
|
||
this.numInfo:SetActive(true)
|
||
local myRank = JumpServerManager.GetHightLadderDataMyRank() <= 1000 and JumpServerManager.GetHightLadderDataMyRank() or "1000+"
|
||
this.mySortText:GetComponent("Text").text = "我的排名:".. myRank
|
||
this.RefreshBuyNum()
|
||
else
|
||
this.canPlayerTipText:SetActive(true)
|
||
end
|
||
elseif stage == JumpServer_Stage.End then
|
||
timeStr = "后开始"
|
||
if enterable then
|
||
if GetTimeStampCorrespondingWeekNum(GetTimeStamp()) >= 2 and GetTimeStampCorrespondingWeekNum(GetTimeStamp()) < 3 then--优化,战斗阶段结束后的下个周二零点后(本服竞技场重置),不再显示上期排名和邮件提示,改为显示:本服千战逐胜台前100名可参加
|
||
this.canPlayerTipText:GetComponent("Text").text ="" --"本服千战逐胜台前"..JoinRank.."名可以参加"
|
||
else
|
||
this.canPlayerTipText.transform.localPosition = Vector3.New(1.3,11.85, 0)
|
||
local myRank = JumpServerManager.GetHightLadderDataMyRank() <= 1000 and JumpServerManager.GetHightLadderDataMyRank() or "1000+"
|
||
this.mySortText:GetComponent("Text").text = "我的排名:".. myRank
|
||
if JumpServerManager.GetHightLadderDataMyRank() <= 1000 then
|
||
this.canPlayerTipText:GetComponent("Text").text = "已通过邮件发放排名奖励"
|
||
else
|
||
this.canPlayerTipText:GetComponent("Text").text = "无法获得排名奖励"
|
||
end
|
||
this.mySortText:SetActive(true)
|
||
end
|
||
else
|
||
end
|
||
this.canPlayerTipText:SetActive(true)
|
||
end
|
||
this.RemainTimeDown(this.timeText,this.timeText:GetComponent("Text"),JumpServerManager.GetHightLadderDataEndTime(),timeStr)
|
||
end
|
||
function this.RefreshBuyNum()
|
||
LogGreen("JumpServerManager.GetCanBattleCount() "..JumpServerManager.GetCanBattleCount())
|
||
LogGreen("JumpServerManager.GetCanBuyBattleCount() "..JumpServerManager.GetCanBuyBattleCount())
|
||
this.mianfeiText.text = JumpServerManager.GetCanBattleCount()
|
||
this.buyText.text = JumpServerManager.GetCanBuyBattleCount()
|
||
end
|
||
function this.ShowSingleData(go,data,i)
|
||
if not data then return end
|
||
local playerInfo = Util.GetGameObject(go, "playerInfo")
|
||
local sdBtn = Util.GetGameObject(go, "sdBtn")
|
||
local cliclBtn = Util.GetGameObject(go, "click")
|
||
local sdBtnRedPoint = Util.GetGameObject(go, "sdBtn/redPoint")
|
||
local dianzanImage = Util.GetGameObject(go, "sdBtn/dianzanImage")
|
||
local liveDef = Util.GetGameObject(go, "liveDef")
|
||
playerInfo:SetActive(false)
|
||
sdBtn:SetActive(false)
|
||
liveDef:SetActive(false)
|
||
sdBtnRedPoint:SetActive(false)
|
||
dianzanImage:SetActive(false)
|
||
--1 未开始 2 战斗阶段 3 膜拜阶段
|
||
if stage == JumpServer_Stage.NoStar then
|
||
sdBtn:SetActive(true)
|
||
liveDef:SetActive(true)
|
||
Util.GetGameObject(go, "sdBtn/Text"):SetActive(true)
|
||
Util.GetGameObject(go, "sdBtn/Text"):GetComponent("Text").text = "虚以待位"
|
||
local str = "s_sanjiechumo_ren_1"--i % 2 > 0 and "s_sanjiechumo_ren_1" or "s_sanjiechumo_ren_2"
|
||
Util.GetGameObject(go, "liveDef"):GetComponent("Image").sprite = this.spLoader:LoadSprite(str)
|
||
Util.AddOnceClick(sdBtn,function()
|
||
|
||
end)
|
||
Util.AddOnceClick(cliclBtn,function()
|
||
|
||
end)
|
||
elseif stage == JumpServer_Stage.Attack and data and data.personInfo then
|
||
playerInfo:SetActive(true)
|
||
sdBtn:SetActive(true)
|
||
Util.GetGameObject(go, "sdBtn/Text"):SetActive(true)
|
||
Util.GetGameObject(go, "sdBtn/Text"):GetComponent("Text").text = "挑 战"
|
||
Util.GetGameObject(go, "playerInfo/name/nameText"):GetComponent("Text").text = data.personInfo.servername.." "..data.personInfo.name
|
||
Util.GetGameObject(go, "playerInfo/warPower/powerBtn/value"):GetComponent("Text").text = data.personInfo.totalForce
|
||
Util.GetGameObject(go, "playerInfo/warPower/Text"):GetComponent("Text").text = "第".. data.personInfo.rank .."名"
|
||
local live = Util.GetGameObject(go, "playerInfo/live")
|
||
this.LocadPersonInfoLive(go,data.personInfo,live.transform)--NameManager.roleSex
|
||
sdBtnRedPoint:SetActive(JumpServerManager.GetCanBattleCount() > 0 and enterable)
|
||
Util.AddOnceClick(sdBtn,function()
|
||
if not enterable then
|
||
--PopupTipPanel.ShowTip("本服千战逐胜台前"..JoinRank.."名可以参加")
|
||
PopupTipPanel.ShowTip("条件不足,无法参战")
|
||
return
|
||
end
|
||
this.BuyVipFun(1,1,function()
|
||
--直接战斗
|
||
JumpServerManager.StarFightHightLadder(data.personInfo,0,function(msg)
|
||
if msg then
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_MIANFEINUM, 1)--更新特权
|
||
this.OnShowPanel()
|
||
end
|
||
this.RefreshBuyNum()
|
||
end)
|
||
end)
|
||
end)
|
||
Util.AddOnceClick(cliclBtn,function()
|
||
JumpServerManager.SetCurPersonInfo(data.personInfo)
|
||
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.personInfo.uid, PLAYER_INFO_VIEW_TYPE.JUPMSERVER,data.personInfo.servername)
|
||
end)
|
||
elseif stage == JumpServer_Stage.End and data and data.personInfo then
|
||
playerInfo:SetActive(true)
|
||
sdBtn:SetActive(true)
|
||
LogPink("data.personInfo.name "..data.personInfo.name.." data.personInfo.rank "..data.personInfo.rank.." data.hadProud "..tostring(data.hadProud))
|
||
Util.GetGameObject(go, "playerInfo/name/nameText"):GetComponent("Text").text = data.personInfo.servername.." "..data.personInfo.name
|
||
Util.GetGameObject(go, "playerInfo/warPower/powerBtn/value"):GetComponent("Text").text = data.personInfo.totalForce
|
||
Util.GetGameObject(go, "playerInfo/warPower/Text"):GetComponent("Text").text = "第".. data.personInfo.rank .."名"
|
||
local live = Util.GetGameObject(go, "playerInfo/live")
|
||
this.LocadPersonInfoLive(go,data.personInfo,live.transform)
|
||
sdBtnRedPoint:SetActive(not data.hadProud)
|
||
Util.GetGameObject(go, "sdBtn/Text"):GetComponent("Text").text = "膜 拜"
|
||
Util.GetGameObject(go, "sdBtn/Text"):SetActive(not data.hadProud)
|
||
Util.GetGameObject(go, "sdBtn/dianzanImage/Text"):GetComponent("Text").text = data.worshipTime
|
||
dianzanImage:SetActive(data.hadProud)
|
||
if data.hadProud then
|
||
sdBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("Btn_hz_cheng_01")
|
||
else
|
||
sdBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("Btn_hz_cheng_01")
|
||
end
|
||
|
||
|
||
Util.AddOnceClick(sdBtn,function()
|
||
if not data.hadProud then
|
||
JumpServerManager.GetWorldArenaProudRequest(data.personInfo,function(msg)
|
||
this.RefreshOnOpen()
|
||
end)
|
||
end
|
||
end)
|
||
Util.AddOnceClick(cliclBtn,function()
|
||
JumpServerManager.SetCurPersonInfo(nil)
|
||
UIManager.OpenPanel(UIName.PlayerInfoPopup, data.personInfo.uid, PLAYER_INFO_VIEW_TYPE.JUPMSERVER,data.personInfo.servername)
|
||
end)
|
||
end
|
||
end
|
||
function this.LocadPersonInfoLive(go,data,live)
|
||
-- if liveNodeList[go] then
|
||
-- poolManager:UnLoadLive(liveNodeList[go].name, liveNodeList[go].go, PoolManager.AssetType.GameObject)
|
||
-- end
|
||
-- local npc = roleSex == ROLE_SEX.BOY and "live2d_npc_map_boy" or "live2d_npc_map_nv"
|
||
-- local scale = roleSex == ROLE_SEX.BOY and Vector3.one * 0.26 or Vector3.one * 0.16
|
||
-- local live2d = poolManager:LoadLive(npc, live,scale, Vector3.zero)
|
||
-- local SkeletonGraphic = live2d:GetComponent("SkeletonGraphic")
|
||
-- if SkeletonGraphic then
|
||
-- SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
|
||
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
|
||
-- end
|
||
-- liveNodeList[go] = {name=npc, go=live2d}
|
||
|
||
if liveNodeList[go] then
|
||
liveNodeList[go]:OnClose()
|
||
liveNodeList[go] = nil
|
||
end
|
||
local curPlayerLiveViewData = {
|
||
skin = data.userSkin,
|
||
sex = data.gender,
|
||
ride = data.userMount,
|
||
designation = 0--data.userTitle,
|
||
}
|
||
liveNodeList[go] = PlayerLiveView:New(live.transform,2, curPlayerLiveViewData,this.sortingOrder)
|
||
liveNodeList[go]:SetNameHeight(-2.5)
|
||
if data.userMount and data.userMount > 0 and data.userMount ~= PlayerRide.YUJIAN then
|
||
liveNodeList[go]:OnOpen(GetPlayerRoleSingleConFig().Scale6,Vector3.New(0,-118.65,0),WALK_DIR.IDLE_LEFT)
|
||
else
|
||
liveNodeList[go]:OnOpen(GetPlayerRoleSingleConFig().Scale6,Vector3.New(0,-118.65,0),WALK_DIR.IDLE_FRONT)
|
||
end
|
||
-- liveNodeList[go] = {name=npc, go=live2d}
|
||
end
|
||
--刷新倒计时显示
|
||
function this.RemainTimeDown(_timeTextExpertgo,_timeTextExpert,timeDown,str)
|
||
if timeDown - GetTimeStamp() > 0 then
|
||
if _timeTextExpertgo then
|
||
_timeTextExpertgo:SetActive(true)
|
||
end
|
||
if _timeTextExpert then
|
||
_timeTextExpert.text = this.TimeStampToDateString(timeDown - GetTimeStamp())..str
|
||
end
|
||
if this.timer then
|
||
this.timer:Stop()
|
||
this.timer = nil
|
||
end
|
||
this.timer = Timer.New(function()
|
||
if _timeTextExpert then
|
||
-- LogGreen(" 跨服天梯 "..this.TimeStampToDateString(timeDown)..str)
|
||
_timeTextExpert.text = this.TimeStampToDateString(timeDown - GetTimeStamp())..str
|
||
end
|
||
if timeDown - GetTimeStamp() < 0 then
|
||
if _timeTextExpertgo then
|
||
_timeTextExpertgo:SetActive(false)
|
||
end
|
||
this.timer:Stop()
|
||
this.timer = nil
|
||
if not isFirstRefresh then
|
||
Timer.New(function()
|
||
LogError("跨服天梯前端刷新")
|
||
JumpServerManager.GetWorldArenaInfoRequest()
|
||
isFirstRefresh = true
|
||
end, 2):Start()
|
||
end
|
||
end
|
||
-- timeDown = timeDown - 1
|
||
end, 1, -1, true)
|
||
this.timer:Start()
|
||
else
|
||
if _timeTextExpertgo then
|
||
_timeTextExpertgo:SetActive(false)
|
||
end
|
||
if not isFirstRefresh then
|
||
Timer.New(function()
|
||
LogError("跨服天梯前端刷新")
|
||
JumpServerManager.GetWorldArenaInfoRequest()
|
||
isFirstRefresh = true
|
||
end, 2):Start()
|
||
end
|
||
end
|
||
end
|
||
|
||
function this.TimeStampToDateString(second)
|
||
local day = math.floor(second / (24 * 3600))
|
||
local minute = math.floor(second / 60) % 60
|
||
local sec = second % 60
|
||
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
|
||
if day > 0 then
|
||
return string.format("%d天%02d时%02d分%02d秒",day, hour, minute, sec)
|
||
else
|
||
return string.format("%02d时%02d分%02d秒", hour, minute, sec)
|
||
end
|
||
end
|
||
|
||
function this.BuyVipFun(type,warOrSd,fun)
|
||
if type == 1 then
|
||
if JumpServerManager.GetCanBattleCount() <= 0 then --今日已无剩余次数!
|
||
if JumpServerManager.GetCanBuyBattleCount() <= 0 then
|
||
PopupTipPanel.ShowTip("今日已无挑战次数!")
|
||
else
|
||
--是否花费XX妖晶购买1次挑战次数并发起挑战?
|
||
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP, JumpServerManager.shopGoodId, 1)
|
||
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig,costId).Name
|
||
local tipStr = warOrSd == 1 and "是否花费%s%s购买1次挑战次数并发起挑战?" or "是否花费%s%s购买1次挑战次数并进行扫荡?"
|
||
MsgPanel.ShowTwo(string.format( tipStr,finalNum,itemName), nil, function()
|
||
--买东西
|
||
if finalNum > BagManager.GetItemCountById(costId) then
|
||
PopupTipPanel.ShowTip(string.format("%s不足!",itemName))
|
||
return
|
||
end
|
||
--买东西
|
||
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,JumpServerManager.shopGoodId,1,function()
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_BUYNUM, 1)--更新特权
|
||
local tipStr2 = warOrSd == 1 and "挑战成功!" or "扫荡成功!"
|
||
if warOrSd == 2 then
|
||
PopupTipPanel.ShowTip(tipStr2)
|
||
end
|
||
if fun then
|
||
fun ()
|
||
end
|
||
end)
|
||
end)
|
||
|
||
end
|
||
else
|
||
if warOrSd == 1 then
|
||
if fun then
|
||
fun ()
|
||
end
|
||
else
|
||
MsgPanel.ShowTwo("扫荡后可直接获得挑战奖励并保持当前排名,确定消耗一次挑战次数进行扫荡?", nil, function()
|
||
if fun then
|
||
fun ()
|
||
end
|
||
end)
|
||
end
|
||
end
|
||
elseif type == 2 then
|
||
if JumpServerManager.GetCanBuyBattleCount() <= 0 then
|
||
PopupTipPanel.ShowTip("今日已无购买剩余次数!")
|
||
else
|
||
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP, JumpServerManager.shopGoodId, 1)
|
||
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig,costId).Name
|
||
local tipStr = "是否花费%s%s购买1次挑战次数?"
|
||
MsgPanel.ShowTwo(string.format( tipStr,finalNum,itemName), nil, function()
|
||
--买东西
|
||
if finalNum > BagManager.GetItemCountById(costId) then
|
||
PopupTipPanel.ShowTip(string.format(Language[11652],itemName))
|
||
return
|
||
end
|
||
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,JumpServerManager.shopGoodId,1,function()
|
||
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.JUMPSERVER_GIGHTLADDER_BUYNUM, 1)--更新特权
|
||
this.RefreshBuyNum()
|
||
end)
|
||
end)
|
||
end
|
||
end
|
||
|
||
end
|
||
|
||
--界面关闭时调用(用于子类重写)
|
||
function JumpServerHightLadderPanel:OnClose()
|
||
if this.timer then
|
||
this.timer:Stop()
|
||
this.timer = nil
|
||
end
|
||
end
|
||
|
||
--界面销毁时调用(用于子类重写)
|
||
function JumpServerHightLadderPanel:OnDestroy()
|
||
for key, value in pairs(liveNodeList) do
|
||
-- poolManager:UnLoadLive(value.name, value.go, PoolManager.AssetType.GameObject)
|
||
-- liveNodeList = {}
|
||
value:OnClose()
|
||
end
|
||
this.spLoader:Destroy()
|
||
end
|
||
|
||
return JumpServerHightLadderPanel |