miduo_client/Assets/ManagedResources/~Lua/Modules/JumpServer/JumpServerPanel.lua

171 lines
6.3 KiB
Lua

require("Base/BasePanel")
JumpServerPanel = Inherit(BasePanel)
local this = JumpServerPanel
local orginLayer = 0
local carbons = {}
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local type = {
[1] = {
id = JumpServer_Type.HightLadder, --跨服天梯
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
},
[2] = {
id = -1,
bg = "r_Dungeon_rendi_01"
},
[3] = {
id = -1,
bg = "r_Dungeon_rendi_01"
},
[4] = {
id = -1,
bg = "r_Dungeon_rendi_01"
},
}
--初始化组件(用于子类重写)
function JumpServerPanel:InitComponent()
-- 屏幕适配修改
this.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot")
this.btnRoot.transform.localScale = Vector3.one * UIManager.adapterScale
this.hightLadderBtn = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/HightLadderBtn")
table.insert(carbons, this.hightLadderBtn)
this.otherBtn1 = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/otherBtn1")
table.insert(carbons, this.otherBtn1)
this.otherBtn2 = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/otherBtn2")
table.insert(carbons, this.otherBtn2)
this.otherBtn3 = Util.GetGameObject(self.gameObject, "btnRoot/circle/root/otherBtn3")
table.insert(carbons, this.otherBtn3)
this.effect = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect")
this.wind = Util.GetGameObject(self.gameObject, "CarbonTypePanel_effect/juneng_chenggong/GameObject")
orginLayer = 0
this.backBtn = Util.GetGameObject(self.gameObject, "backBtn")
this.AnimRoot = Util.GetGameObject(self.gameObject, "btnRoot/circle/root")
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
end
--绑定事件(用于子类重写)
function JumpServerPanel:BindEvent()
Util.AddClick(this.backBtn,function()
self:ClosePanel()
end)
for i = 1, #type do
if type[i].redPointType and carbons[i] then
BindRedPointObject(type[i].redPointType, Util.GetGameObject(carbons[i], "bg/carbon/redPoint"))
end
end
end
--添加事件监听(用于子类重写)
function JumpServerPanel:AddListener()
end
--移除事件监听(用于子类重写)
function JumpServerPanel:RemoveListener()
end
--跨服
function JumpServerPanel:OnOpen()
this.UpView:OnOpen({showType = UpViewOpenType.ShowRight, panelType = PanelType.Main})
end
--界面打开时调用(用于子类重写)
function JumpServerPanel:OnShow(...)
for i = 1, #type do
if type[i].redPointType and carbons[i] then
CheckRedPointStatus(type[i].redPointType)
end
end
this.UpdateCarbonContent()
-- 音效
-- SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
end
function this.UpdateCarbonContent()
for k,v in ipairs(carbons) do
local data = type[k]
Util.GetGameObject(v, "bg"):GetComponent("Image").sprite = Util.LoadSprite(data.bg)
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
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")
-- local di = Util.GetGameObject(v, "bg/InfoBg/InfoBg/Image")
-- local dropContent = Util.GetGameObject(v, "bg/InfoBg/InfoBg/dropContent")
live:GetComponent("Image").sprite = Util.LoadSprite(data.live)
live:GetComponent("RectTransform").localPosition = data.livePos
live:GetComponent("RectTransform").sizeDelta = data.liveSize
name:GetComponent("Image").sprite = Util.LoadSprite(data.name)
timeReset:GetComponent("Text").text =string.format(data.resetTime)
-- dropContent:GetComponent("Text").text =string.format(data.tip)
-- di:GetComponent("Image").sprite = Util.LoadSprite(data.tipBg)
Util.AddOnceClick(v,function()
this.BtnClick(data.id)
end)
end
if data.id == -1 then
Util.SetGray(v,true)
else
Util.SetGray(v,not ActTimeCtrlManager.SingleFuncState(data.id))
-- Util.SetGray(v,not ActTimeCtrlManager.SingleFuncState(data.id))
end
end
end
function this.BtnClick(id)
if id == JumpServer_Type.HightLadder then
if ActTimeCtrlManager.SingleFuncState(id) == false then --如果未解锁
PopupTipPanel.ShowTip(ActTimeCtrlManager.SystemOpenTip(JumpServer_Type.HightLadder))
return
end
UIManager.OpenPanel(UIName.JumpServerHightLadderPanel)
else
PopupTipPanel.ShowTip("敬请期待")
end
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(this.effect, self.sortingOrder - orginLayer)
Util.AddParticleSortLayer(this.wind, self.sortingOrder - orginLayer)
end
--界面关闭时调用(用于子类重写)
function JumpServerPanel:OnClose()
for i = 1, #type do
if type[i].redPointType and carbons[i] then
ClearRedPointObject(type[i].redPointType, Util.GetGameObject(carbons[i], "bg/carbon/redPoint"))
end
end
end
--界面销毁时调用(用于子类重写)
function JumpServerPanel:OnDestroy()
end
return JumpServerPanel