2021-06-15 20:08:14 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
JumpServerPanel = Inherit(BasePanel)
|
|
|
|
|
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
|
|
|
|
|
local type = {
|
2021-08-24 16:48:41 +08:00
|
|
|
|
[1] = {
|
2021-06-15 20:08:14 +08:00
|
|
|
|
id = JumpServer_Type.HightLadder, --跨服天梯
|
2021-08-24 16:48:41 +08:00
|
|
|
|
bg = "r_Dungeon_rendi_01",
|
2021-06-15 20:08:14 +08:00
|
|
|
|
name = "k_kuafuwanfa_luofuzhengfeng",
|
|
|
|
|
live = "m_chsm_0035_png",
|
|
|
|
|
livePos = Vector2(274.5, -408.1),
|
|
|
|
|
liveSize = Vector2(1612, 1802),
|
|
|
|
|
tipBg = "r_Dungeon_juqingdian",
|
|
|
|
|
resetTime = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
|
|
|
|
|
tip = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
|
2021-08-24 16:48:41 +08:00
|
|
|
|
redPointType = RedPointType.JumpServer_HightLadder,
|
|
|
|
|
tipStr = "",
|
|
|
|
|
state = 0
|
2021-06-15 20:08:14 +08:00
|
|
|
|
},
|
2021-08-24 16:48:41 +08:00
|
|
|
|
[2] = {
|
2021-08-30 15:41:14 +08:00
|
|
|
|
id = JumpServer_Type.YuXuLunDao,
|
|
|
|
|
bg = "r_Dungeon_rendi_01",
|
|
|
|
|
name = "k_kuafuwanfa_luofuzhengfeng",
|
|
|
|
|
live = "m_chsm_0035_png",
|
|
|
|
|
livePos = Vector2(274.5, -408.1),
|
|
|
|
|
liveSize = Vector2(1612, 1802),
|
|
|
|
|
tipBg = "r_Dungeon_juqingdian",
|
|
|
|
|
resetTime = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
|
|
|
|
|
tip = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
|
|
|
|
|
redPointType = RedPointType.JumpServer_HightLadder,
|
|
|
|
|
tipStr = "",
|
|
|
|
|
state = 1
|
2021-06-15 20:08:14 +08:00
|
|
|
|
},
|
2021-08-24 16:48:41 +08:00
|
|
|
|
[3] = {
|
2021-06-15 20:08:14 +08:00
|
|
|
|
id = -1,
|
|
|
|
|
bg = "r_Dungeon_rendi_01"
|
|
|
|
|
},
|
2021-08-24 16:48:41 +08:00
|
|
|
|
[4] = {
|
2021-06-15 20:08:14 +08:00
|
|
|
|
id = -1,
|
|
|
|
|
bg = "r_Dungeon_rendi_01"
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function JumpServerPanel:InitComponent()
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self.spLoader = SpriteLoader.New()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
-- 屏幕适配修改
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot")
|
|
|
|
|
self.btnRoot.transform.localScale = Vector3.one * UIManager.adapterScale
|
|
|
|
|
self.carbons = {}
|
|
|
|
|
self.carbonsRedPoint = {}
|
|
|
|
|
|
|
|
|
|
for i = 1, #type do
|
|
|
|
|
local btn = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/otherBtn"..i)
|
|
|
|
|
table.insert(self.carbons, btn)
|
|
|
|
|
table.insert(self.carbonsRedPoint, Util.GetGameObject(btn, "bg/carbon/redPoint"))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self.effect = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect")
|
|
|
|
|
self.wind = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect/juneng_chenggong/GameObject")
|
|
|
|
|
self.backBtn = Util.GetGameObject(self.gameObject, "backBtn")
|
|
|
|
|
self.AnimRoot = Util.GetGameObject(self.gameObject, "btnRoot/circle/root")
|
|
|
|
|
|
|
|
|
|
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function JumpServerPanel:BindEvent()
|
2021-08-24 16:48:41 +08:00
|
|
|
|
Util.AddClick(self.backBtn,function()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
for i = 1, #type do
|
2021-08-24 16:48:41 +08:00
|
|
|
|
if type[i].redPointType and self.carbons[i] then
|
|
|
|
|
BindRedPointObject(type[i].redPointType, self.carbonsRedPoint[i])
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function JumpServerPanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function JumpServerPanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--跨服
|
|
|
|
|
function JumpServerPanel:OnOpen()
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self.UpView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function JumpServerPanel:OnShow(...)
|
|
|
|
|
for i = 1, #type do
|
2021-08-24 16:48:41 +08:00
|
|
|
|
if type[i].redPointType and self.carbons[i] then
|
2021-06-15 20:08:14 +08:00
|
|
|
|
CheckRedPointStatus(type[i].redPointType)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self:UpdateCarbonContent()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
-- 音效
|
|
|
|
|
-- SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
|
|
|
|
|
end
|
|
|
|
|
|
2021-08-24 16:48:41 +08:00
|
|
|
|
function JumpServerPanel:UpdateCarbonContent()
|
|
|
|
|
for k,v in ipairs(self.carbons) do
|
2021-06-15 20:08:14 +08:00
|
|
|
|
local data = type[k]
|
2021-08-24 16:48:41 +08:00
|
|
|
|
Util.GetGameObject(v, "bg"):GetComponent("Image").sprite = self.spLoader:LoadSprite(data.bg)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if data.id == -1 then
|
|
|
|
|
Util.GetGameObject(v, "bg/carbon"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(v, "bg/InfoBg"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(v, "bg/Text").gameObject:SetActive(true)
|
|
|
|
|
v:GetComponent("Button").enabled = false
|
2021-07-14 15:08:54 +08:00
|
|
|
|
Util.SetGray(v,true)
|
2021-08-24 16:48:41 +08:00
|
|
|
|
else
|
2021-06-15 20:08:14 +08:00
|
|
|
|
Util.GetGameObject(v, "bg/carbon"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(v, "bg/InfoBg"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(v, "bg/InfoBg/InfoBg"):SetActive(false)
|
2021-08-24 16:48:41 +08:00
|
|
|
|
Util.GetGameObject(v, "bg/Text").gameObject:SetActive(false)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
v:GetComponent("Button").enabled = true
|
|
|
|
|
local live = Util.GetGameObject(v, "bg/carbon/Live")
|
|
|
|
|
local name = Util.GetGameObject(v, "bg/carbon/Name")
|
|
|
|
|
local timeReset = Util.GetGameObject(v, "bg/InfoBg/timeReset")
|
2021-08-24 16:48:41 +08:00
|
|
|
|
live:GetComponent("Image").sprite = self.spLoader:LoadSprite(data.live)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
live:GetComponent("RectTransform").localPosition = data.livePos
|
|
|
|
|
live:GetComponent("RectTransform").sizeDelta = data.liveSize
|
2021-08-24 16:48:41 +08:00
|
|
|
|
name:GetComponent("Image").sprite = self.spLoader:LoadSprite(data.name)
|
|
|
|
|
timeReset:GetComponent("Text").text = string.format(data.resetTime)
|
|
|
|
|
self:SystemState(data.id,function()
|
|
|
|
|
if type[k].state < 0 then
|
|
|
|
|
timeReset:GetComponent("Text").text = type[k].tipStr
|
2021-07-14 15:08:54 +08:00
|
|
|
|
Util.SetGray(v,true)
|
|
|
|
|
else
|
|
|
|
|
Util.SetGray(v,false)
|
|
|
|
|
end
|
|
|
|
|
end)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
Util.AddOnceClick(v,function()
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self:BtnClick(data.id)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
2021-07-14 15:08:54 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-08-24 16:48:41 +08:00
|
|
|
|
function JumpServerPanel:BtnClick(id)
|
|
|
|
|
if id <= 0 then PopupTipPanel.ShowTip("敬请期待") return end
|
|
|
|
|
if type[id].state ~= 1 then PopupTipPanel.ShowTip(type[id].tipStr) return end
|
|
|
|
|
|
2021-07-14 15:08:54 +08:00
|
|
|
|
if id == JumpServer_Type.HightLadder then
|
2021-08-24 16:48:41 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.JumpServerHightLadderPanel)
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
2021-08-30 15:41:14 +08:00
|
|
|
|
|
|
|
|
|
if id == JumpServer_Type.YuXuLunDao then
|
|
|
|
|
UIManager.OpenPanel(UIName.WorldArenaMainPanel)
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-08-24 16:48:41 +08:00
|
|
|
|
function JumpServerPanel:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(self.effect, self.sortingOrder + 1)
|
|
|
|
|
Util.AddParticleSortLayer(self.wind, self.sortingOrder + 1)
|
2021-07-14 15:08:54 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-08-24 16:48:41 +08:00
|
|
|
|
function JumpServerPanel:SystemState(id,fun)
|
|
|
|
|
if id <= 0 then return -6,"敬请期待" end
|
2021-08-23 19:44:18 +08:00
|
|
|
|
local func = function ()
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
fun = nil
|
|
|
|
|
end
|
|
|
|
|
return
|
|
|
|
|
end
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if id == JumpServer_Type.HightLadder then
|
2021-08-24 16:48:41 +08:00
|
|
|
|
--判断功能是否开启
|
2021-07-14 15:48:34 +08:00
|
|
|
|
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = -1
|
|
|
|
|
type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.JumpServer_HightLadder)
|
2021-07-08 10:36:33 +08:00
|
|
|
|
end
|
2021-08-24 16:48:41 +08:00
|
|
|
|
--判断世界等级是否够
|
2021-06-15 20:08:14 +08:00
|
|
|
|
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).WorldLevel
|
|
|
|
|
if PlayerManager.worldLeve < conFigWorldLevel then --如果世界等级不足
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = -2
|
|
|
|
|
type[id].tipStr = string.format("世界等级到达%s后开启!",conFigWorldLevel)
|
2021-08-23 19:44:18 +08:00
|
|
|
|
func()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
2021-08-24 16:48:41 +08:00
|
|
|
|
--判断是否在赛季中
|
2021-06-15 20:08:14 +08:00
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) == false then --如果未解锁
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = -3
|
|
|
|
|
type[id].tipStr = "赛季过渡中!"
|
2021-08-23 19:44:18 +08:00
|
|
|
|
func()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
JumpServerManager.GetWorldArenaInfoRequest(function()
|
2021-07-14 15:08:54 +08:00
|
|
|
|
if not JumpServerManager.GetHightLadderDataIsStart() then
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = -4
|
|
|
|
|
type[id].tipStr = string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).OpenWeek)
|
2021-07-14 15:08:54 +08:00
|
|
|
|
elseif not JumpServerManager.GetHightLadderDataIsGroup() then
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = -5
|
|
|
|
|
type[id].tipStr = "未划分跨服分组,无法参与!"
|
2021-07-13 11:28:36 +08:00
|
|
|
|
else
|
2021-08-24 16:48:41 +08:00
|
|
|
|
type[id].state = 1
|
|
|
|
|
type[id].tipStr = ""
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
2021-08-24 16:48:41 +08:00
|
|
|
|
func()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end)
|
2021-08-30 15:41:14 +08:00
|
|
|
|
elseif id== JumpServer_Type.HightLadder then
|
|
|
|
|
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function JumpServerPanel:OnClose()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function JumpServerPanel:OnDestroy()
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self.carbons = {}
|
2021-06-15 20:08:14 +08:00
|
|
|
|
for i = 1, #type do
|
2021-08-24 16:48:41 +08:00
|
|
|
|
if type[i].redPointType and self.carbons[i] then
|
|
|
|
|
ClearRedPointObject(type[i].redPointType, self.carbonsRedPoint[i])
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-08-24 16:48:41 +08:00
|
|
|
|
self.spLoader:Destroy()
|
2021-06-15 20:08:14 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return JumpServerPanel
|