135 lines
4.5 KiB
Lua
135 lines
4.5 KiB
Lua
require("Base/BasePanel")
|
|
MonsterCampMainPanel = Inherit(BasePanel)
|
|
local this = MonsterCampMainPanel
|
|
local orginLayer
|
|
local monsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup)
|
|
local monsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
|
local trails = {}
|
|
|
|
--初始化组件(用于子类重写)
|
|
function MonsterCampMainPanel:InitComponent()
|
|
orginLayer = 0
|
|
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
|
this.waveNum = Util.GetGameObject(self.gameObject, "Bg/waveImg/wave"):GetComponent("Text")
|
|
this.nextWave = Util.GetGameObject(self.gameObject, "Bg/btnWave")
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
for i = 1 ,4 do
|
|
table.insert(trails,Util.GetGameObject(self.gameObject, "Bg/SiLingDi/trail"..i))
|
|
end
|
|
this.btnShenYing = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/shenyingPro")
|
|
this.shenYingProgressText = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Text"):GetComponent("Text")
|
|
this.shenYingProgressIma = Util.GetGameObject(self.gameObject, "Bg/SiLingDi/progress/Image"):GetComponent("Image")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function MonsterCampMainPanel:BindEvent()
|
|
Util.AddClick(this.btnBack, function ()
|
|
PlayerManager.carbonType = 1
|
|
UIManager.OpenPanel(UIName.CarbonTypePanelV2)
|
|
self:ClosePanel()
|
|
end)
|
|
|
|
Util.AddClick(this.nextWave, function ()
|
|
JumpManager.GoJump(1011)
|
|
end)
|
|
|
|
Util.AddClick(this.btnShenYing, function ()
|
|
|
|
end)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function MonsterCampMainPanel:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function MonsterCampMainPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function MonsterCampMainPanel:OnOpen(...)
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.MonsterCamp })
|
|
end
|
|
|
|
function MonsterCampMainPanel:OnShow()
|
|
this.waveNum.text = MonsterCampManager.monsterWave
|
|
this.shenYingProgressText = "16/100"
|
|
this.shenYingProgressIma.fillAmount = 16/100
|
|
LogGreen("#trails:"..#trails)
|
|
for i = 1,#trails do
|
|
local singleFourElementData = MonsterCampManager.GetCurFourElementMonsterInfo(i)
|
|
this:SetSingleTrailData(trails[i],singleFourElementData)
|
|
end
|
|
end
|
|
|
|
function this:GetOpenTime(id)
|
|
local str = nil
|
|
local isFunction = false
|
|
local config = ConfigManager.GetConfigData(ConfigName.CampTowerSetting,1)
|
|
if config then
|
|
for k,v in ipairs(config.CampOpenDay) do
|
|
isFunction = false
|
|
for n,m in ipairs(v) do
|
|
if tonumber(n) == 1 and tonumber(m) == id then
|
|
isFunction = true
|
|
else
|
|
if isFunction then
|
|
if str then
|
|
str =str.. Language[12304]..NumConvertWeek[tonumber(m)]
|
|
else
|
|
str = Language[12305]..NumConvertWeek[tonumber(m)]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
LogBlue(str.." 宝镜开启时间")
|
|
return str
|
|
end
|
|
|
|
function MonsterCampMainPanel:SetSingleTrailData(go,data)
|
|
local title = Util.GetGameObject(go, "title/Text"):GetComponent("Text")
|
|
local curwave = Util.GetGameObject(go, "curwave"):GetComponent("Text")
|
|
local canFightWave = Util.GetGameObject(go, "canFightWave"):GetComponent("Text")
|
|
local openTime = Util.GetGameObject(go, "openTime"):GetComponent("Text")
|
|
LogGreen("data.fourElementType:"..data.fourElementType)
|
|
title.text = FourElementName[data.fourElementType]
|
|
curwave.text = (data.monsterWave + 1).."层"
|
|
canFightWave.text = data.canFightTime
|
|
openTime.text = this:GetOpenTime(data.fourElementType).."开启"
|
|
if data.openState == 1 then
|
|
--不置灰
|
|
else
|
|
--置灰
|
|
end
|
|
Util.AddOnceClick(go,function()
|
|
if data.openState == 1 then
|
|
UIManager.OpenPanel(UIName.FourElementMonsterCampPanel,data.fourElementType)
|
|
else
|
|
PopupTipPanel.ShowTip("未在开启时间内!")
|
|
end
|
|
end)
|
|
end
|
|
|
|
function MonsterCampMainPanel:OnSortingOrderChange()
|
|
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function MonsterCampMainPanel:OnClose()
|
|
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function MonsterCampMainPanel:OnDestroy()
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
end
|
|
|
|
return MonsterCampMainPanel |