require("Base/BasePanel") JumpServerPanel = Inherit(BasePanel) local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig) local globalSys = ConfigManager.GetConfig(ConfigName.GlobalSystemConfig) local type = { [JumpServer_Type.HightLadder] = { id = JumpServer_Type.HightLadder, --跨服天梯 funcId = FUNCTION_OPEN_TYPE.JumpServer_HightLadder, sort = 1, bg = "r_Dungeon_rendi_03", 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("%s",specialConfig[97].Value), tip = string.format("%s",specialConfig[97].Value), redPointType = RedPointType.JumpServer_HightLadder, tipStr = "", state = 0 }, [JumpServer_Type.YuXuLunDao] = { id = JumpServer_Type.YuXuLunDao, funcId = FUNCTION_OPEN_TYPE.JumpServer_YuXu, sort = 3, bg = "r_Dungeon_rendi_01", name = "y_yuxulundao_yuxurukou_zh", live = "lingjijuyuan", livePos = Vector2(149, 13), liveSize = Vector2(1024, 356), tipBg = "r_Dungeon_juqingdian", resetTime = string.format("%s",specialConfig[127].Value), tip = string.format("%s",specialConfig[127].Value), redPointType = RedPointType.WorldArena_reward, tipStr = "", state = 0, }, [JumpServer_Type.QiJieShiLian] = { id = JumpServer_Type.QiJieShiLian, funcId = FUNCTION_OPEN_TYPE.QIJIESHILIAN, sort = 2, bg = "m_syjm_0026_png", name = "q_qjsl_rikou_ysz", live = "", livePos = Vector2(0,0), liveSize = Vector2(0,0), tipBg = "r_Dungeon_juqingdian", resetTime = string.format("%s",specialConfig[127].Value), tip = "", redPointType = RedPointType.QiJieShiLian, tipStr = "", state = 0, }, [JumpServer_Type.LingMaiMiJing] = { id = JumpServer_Type.LingMaiMiJing, funcId = FUNCTION_OPEN_TYPE.LINGMAIMIJING, sort = 4, bg = "r_Dungeon_rendi_01", name = "l_lmmj_rukouzi", live = "z_zddh_yj", livePos = Vector2(251,-26), liveSize = Vector2(550,500), tipBg = "r_Dungeon_rendi_01", resetTime = string.format("%s",specialConfig[137].Value), tip = "", redPointType = RedPointType.LingMaiMiJing, tipStr = "", state = 0, }, } --初始化组件(用于子类重写) function JumpServerPanel:InitComponent() self.spLoader = SpriteLoader.New() -- 屏幕适配修改 self.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot") -- self.btnRoot.transform.localScale = Vector3.one * UIManager.adapterScale self.carbons = {} self.carbonsRedPoint = {} for k,v in pairs(type) do local btn = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/otherBtn"..v.sort) self.carbons[k] = btn self.carbonsRedPoint[k] = 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) end --绑定事件(用于子类重写) function JumpServerPanel:BindEvent() Util.AddClick(self.backBtn,function() self:ClosePanel() end) for k,v in pairs(type) do if v.redPointType and self.carbons[k] then BindRedPointObject(v.redPointType, self.carbonsRedPoint[k]) end end end --添加事件监听(用于子类重写) function JumpServerPanel:AddListener() end --移除事件监听(用于子类重写) function JumpServerPanel:RemoveListener() end --跨服 function JumpServerPanel:OnOpen() self.UpView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main}) end --界面打开时调用(用于子类重写) function JumpServerPanel:OnShow(...) for k,v in pairs(type) do if v.redPointType and self.carbons[k] then CheckRedPointStatus(v.redPointType) end end JumpServerManager.GetWorldArenaInfoRequest(function() self:UpdateCarbonContent() end) -- 音效 -- SoundManager.PlayMusic(SoundConfig.BGM_Carbon) end function JumpServerPanel:UpdateCarbonContent() for k,v in ipairs(self.carbons) do local data = type[k] Util.GetGameObject(v, "bg"):GetComponent("Image").sprite = self.spLoader:LoadSprite(data.bg) if data.id == -1 or globalSys[data.funcId].IsOpen == 0 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 Util.SetGray(v,true) else Util.GetGameObject(v, "bg/carbon"):SetActive(true) Util.GetGameObject(v, "bg/InfoBg"):SetActive(true) Util.GetGameObject(v, "bg/InfoBg/InfoBg"):SetActive(false) Util.GetGameObject(v, "bg/Text").gameObject:SetActive(false) 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") live:GetComponent("Image").sprite = self.spLoader:LoadSprite(data.live) live:GetComponent("RectTransform").localPosition = data.livePos live:GetComponent("RectTransform").sizeDelta = data.liveSize 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 Util.SetGray(v,true) else Util.SetGray(v,false) end end) Util.AddOnceClick(v,function() self:BtnClick(data.id) end) end end end 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 if id == JumpServer_Type.HightLadder then UIManager.OpenPanel(UIName.JumpServerHightLadderPanel) end if id == JumpServer_Type.YuXuLunDao then NetManager.CrossYuXuLunDaoGetInfoRequest(1,function(msg) UIManager.OpenPanel(UIName.WorldArenaMainPanel,msg) end) end if id == JumpServer_Type.QiJieShiLian then local qiejieConfig = ConfigManager.GetConfig(ConfigName.QijieStage) NetManager.SevenWorldInfoRequest(0,function (msg) QiJieShiLianManager.IsLock = false if qiejieConfig[msg.id] then UIManager.OpenPanel(UIName.QiJieShiLianPanel) else LogError("七界试炼不存在该ID:"..tostring(msg.id)) PopupTipPanel.ShowTip("无法进入,请联系客服!") end end) end if id == JumpServer_Type.LingMaiMiJing then NetManager.GetLingMaiInfoRequest(0,function () if LingMaiMiJingManager.state == 0 then PopupTipPanel.ShowTip("今日不开放灵脉秘境玩法!") else if not LingMaiMiJingManager.GetData() then LogError("灵脉试炼数据为空") PopupTipPanel.ShowTip("灵脉暂无法进入,请耐心等待!") return end UIManager.OpenPanel(UIName.LingMaiMiJingPanel) end end) end end function JumpServerPanel:OnSortingOrderChange() Util.AddParticleSortLayer(self.effect, self.sortingOrder + 1) Util.AddParticleSortLayer(self.wind, self.sortingOrder + 1) end function JumpServerPanel:SystemState(id,fun) if id <= 0 then return -6,"敬请期待" end local func = function () if fun then fun() fun = nil end end if id == JumpServer_Type.HightLadder then --判断功能是否开启 if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) then type[id].state = -1 type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.JumpServer_HightLadder) func() return end --判断世界等级是否够 local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).WorldLevel if PlayerManager.worldLeve < conFigWorldLevel then --如果世界等级不足 type[id].state = -2 type[id].tipStr = string.format("世界等级到达%s后开启!",conFigWorldLevel) func() return end --判断是否在赛季中 if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.JumpServer_HightLadder) == false then --如果未解锁 type[id].state = -3 type[id].tipStr = "赛季过渡中!" func() return end if not JumpServerManager.GetHightLadderDataIsStart() then type[id].state = -4 type[id].tipStr = string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).OpenWeek) elseif not JumpServerManager.GetHightLadderDataIsGroup() then type[id].state = -5 type[id].tipStr = "未划分跨服分组,无法参与!" else type[id].state = 1 type[id].tipStr = "" end func() elseif id== JumpServer_Type.YuXuLunDao then -- 判断功能是否开启 if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_YuXu) then type[id].state = -1 type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.JumpServer_YuXu) func() return end -- 跨服相关判断 if not JumpServerManager.GetYuxuIsStart() then type[id].state = -4 type[id].tipStr = string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,2).OpenWeek) elseif not JumpServerManager.GetHightLadderDataIsGroup() then type[id].state = -5 type[id].tipStr = "未划分跨服分组,无法参与!" else type[id].state = 1 type[id].tipStr = "" end func() elseif id== JumpServer_Type.QiJieShiLian then -- 判断功能是否开启 if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.QIJIESHILIAN) then type[id].state = -1 type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.QIJIESHILIAN) func() return end -- 跨服相关判断 if not JumpServerManager.GetQiJieIsStart() then type[id].state = -4 type[id].tipStr = string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,3).OpenWeek) elseif not JumpServerManager.GetHightLadderDataIsGroup() then type[id].state = -5 type[id].tipStr = "未划分跨服分组,无法参与!" else type[id].state = 1 type[id].tipStr = "" end func() elseif id== JumpServer_Type.LingMaiMiJing then -- 判断功能是否开启 if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.LINGMAIMIJING) then type[id].state = -1 type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.LINGMAIMIJING) func() return end -- 跨服相关判断 if not JumpServerManager.GetLingMaiIsStart() then type[id].state = -4 type[id].tipStr = string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerLodeSetting,1).OpenWeek) elseif not JumpServerManager.GetHightLadderDataIsGroup() then type[id].state = -5 type[id].tipStr = "未划分跨服分组,无法参与!" else type[id].state = 1 type[id].tipStr = "" end func() end end --界面关闭时调用(用于子类重写) function JumpServerPanel:OnClose() end --界面销毁时调用(用于子类重写) function JumpServerPanel:OnDestroy() self.carbons = {} for k,v in pairs(type) do if v.redPointType and self.carbons[k] then ClearRedPointObject(v.redPointType, self.carbonsRedPoint[k]) end end self.spLoader:Destroy() end return JumpServerPanel