miduo_client/Assets/ManagedResources/~Lua/Modules/TianShuMiJuan/TianShuMiJuanMainPanel.lua

86 lines
2.3 KiB
Lua
Raw Normal View History

2021-03-16 17:37:32 +08:00
require("Base/BasePanel")
local TianShuMiJuanMainPanel = Inherit(BasePanel)
local this = TianShuMiJuanMainPanel
-- Tab管理器
local TabBox = require("Modules/Common/TabBox")
--初始化组件(用于子类重写)
function TianShuMiJuanMainPanel:InitComponent()
-- 上部货币显示
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
end
--绑定事件(用于子类重写)
function TianShuMiJuanMainPanel:BindEvent()
-- 初始化Tab管理器
this.PageTabCtrl = TabBox.New()
this.PageTabCtrl:SetTabAdapter(this.PageTabAdapter)
this.PageTabCtrl:SetTabIsLockCheck(this.PageTabIsLockCheck)
this.PageTabCtrl:SetChangeTabCallBack(this.OnPageTabChange)
-- 关闭界面打开主城
Util.AddClick(this.btnBack, function()
this:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function TianShuMiJuanMainPanel:AddListener()
end
--移除事件监听(用于子类重写)
function TianShuMiJuanMainPanel:RemoveListener()
end
--界面打开时调用(用于子类重写)
function TianShuMiJuanMainPanel:OnOpen(chooseIndex)
end
-- 打开,重新打开时回调
function TianShuMiJuanMainPanel:OnShow()
end
----==========================一级页签相关===========================================
-- tab按钮自定义显示设置
function this.PageTabAdapter(tab, index, status)
local img = Util.GetGameObject(tab, "img"):GetComponent("Image")
local lock = Util.GetGameObject(tab, "lock")
local redpot = Util.GetGameObject(tab, "redpot")
img.sprite = Util.LoadSprite(tabs[index][status])
img:SetNativeSize()
local islock = status == "lock"
Util.SetGray(img.gameObject, islock)
lock:SetActive(islock)
-- 判断是否需要检测红点
redpot:SetActive(false)
if not islock then
this.ClearPageRedpot(index)
this.BindPageRedpot(index, redpot)
end
end
-- tab可用性检测
function this.PageTabIsLockCheck(index)
return false
end
-- tab改变事件
function this.OnPageTabChange(index)
end
--界面关闭时调用(用于子类重写)
function TianShuMiJuanMainPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function TianShuMiJuanMainPanel:OnDestroy()
SubUIManager.Close(this.UpView)
end
return this