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

113 lines
3.6 KiB
Lua

require("Base/BasePanel")
GodsWayListPanel = Inherit(BasePanel)
--初始化组件(用于子类重写)
function GodsWayListPanel:InitComponent()
self.itemList={}
self.spLoader = SpriteLoader.New()
-- 屏幕适配修改
for i = 1, 2 do
local item = Util.GetGameObject(self.gameObject, "circle/otherBtn"..i)
--self.itemList[i]=item
table.insert(self.itemList,item)
end
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 GodsWayListPanel:BindEvent()
Util.AddClick(self.backBtn,function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function GodsWayListPanel:AddListener()
end
--移除事件监听(用于子类重写)
function GodsWayListPanel:RemoveListener()
end
--跨服
function GodsWayListPanel:OnOpen()
self.UpView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
end
--界面打开时调用(用于子类重写)
function GodsWayListPanel:OnShow(...)
local dataList=GodsWayTowerManager.GetTowerData()
for i=1, #self.itemList do
LogError(" key========="..i)
local data=dataList[i]
local floorTxt=Util.GetGameObject(self.itemList[i], "floorBg/Text"):GetComponent("Text")
local rankTxt=Util.GetGameObject(self.itemList[i], "rankTxt"):GetComponent("Text")
local freeTxt=Util.GetGameObject(self.itemList[i], "sweepTxt"):GetComponent("Text")
local buyTxt=Util.GetGameObject(self.itemList[i], "buyTxt"):GetComponent("Text")
local btn=Util.GetGameObject(self.itemList[i], "btn")
local redpoint=Util.GetGameObject(self.itemList[i], "redPoint")
local config=ConfigManager.GetConfigData(ConfigName.DuoDuiTowerConfig,i)
local freeTime,buyTime=GodsWayTowerManager.GetTimeTip(i)
freeTxt.text="今日可扫荡次数:"..freeTime
buyTxt.text="今日可购买扫荡次数:"..buyTime
redpoint:SetActive(freeTime>0 and CheckFunctionOpen(138+i) )
if data then
if data.floor<=0 then
floorTxt.text="".."1"..""
else
floorTxt.text=""..data.floor..""
end
if data.rank<=0 then
rankTxt.text="暂无排名"
else
rankTxt.text="排名:"..data.rank
end
else
floorTxt.text="第1层"
rankTxt.text="暂无排名"
end
Util.AddClick(btn, function()
local isOpen=CheckFunctionOpen(138+i)
if isOpen then
UIManager.OpenPanel(UIName.GodsWayTowerPanel,i)
self:ClosePanel()
else
if i==1 then
--PopupTipPanel.ShowTip(Language[11330])
else
--PopupTipPanel.ShowTip("需二队塔通关100层后开启")
PopupTipPanel.ShowTip("暂未开启")
end
end
end)
end
end
function GodsWayListPanel:BtnClick(id)
end
function GodsWayListPanel:OnSortingOrderChange()
--Util.AddParticleSortLayer(self.effect, self.sortingOrder + 1)
--Util.AddParticleSortLayer(self.wind, self.sortingOrder + 1)
end
--界面关闭时调用(用于子类重写)
function GodsWayListPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function GodsWayListPanel:OnDestroy()
self.itemList={}
self.spLoader:Destroy()
end
return GodsWayListPanel