模块管理

2018-07-13  本文已影响0人  nameLogen
场景层次结构
场景层次结构
--[[
    用于模块显示的配置,这里定义样式,在模块创建的时候传入BaseView,如果这里的样式不满足要求,可以新增
    key 自定义 在ctor 方法中需要传
    IsOnly: 是否在当前层次唯一,打开会关闭其他所有模块,除了需要保留的(IsKepp = true),默认false
    IsKeep: 是否在当前层中保留,可以在关闭其他层次保留,比如聊天界面,默认false
    IsCanRepeat: 是否可以重复弹出,某些界面需要重复弹出的时候,比如当前ddt 的空间界面,默认false
    PrefabPath: 对应的prefab 路径 

    保留想法:
    IsGlobalOnly 是否全局唯一,关闭其他所有模块
    IsCache:是否缓存
    IsDespose: 是否在关闭后销毁
]]
WindowConstant.ShowConfig = {
    FixedDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.FixedLayer},
    PopUpDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.PopUpLayer},
    DialogDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = true,LayerType = WindowConstant.LayerType.DialogLayer},
    TipDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.TipLayer},
    FloatDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.FloatLayer},
    GuideDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.GuideLayer},
    LoadingDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.LoadingLayer},
    MaxDefault = {IsOnly = false,IsKeep = false,IsCanRepeat = false,LayerType = WindowConstant.LayerType.MaxTopLayer},
}

return WindowConstant
local MainCityView = class("MainCityView", BaseView)

function MainCityView:ctor()
    MainCityView.super.ctor(self,"Prefabs/UI/Module/MainCity/MainCity.prefab",Module.WindowConstant.ShowConfig.FixedDefault)
end

function MainCityView:onEnter()
    self.PetBtn.onClick:AddListener(function()
        WindowManager:OpenModule(Module.BagView)
        WindowManager:OpenModule(Module.PetView)
    end)
end

return MainCityView

打开模块接口
WindowManager:OpenModule(Module.BagView)
关闭模块接口,有三种方式
WindowManager:CloseModule(Module.BagView)
WindowManager:CloseModule(self)
WindowManager:CloseModule("BagView")

上一篇 下一篇

猜你喜欢

热点阅读