Esempio n. 1
0
        private void RemoveWindow(IModule module, bool isInitiativeClose = true, bool forcedDestroy = false)
        {
            MenuConfig config = configSet [module.MenuId];

            //Debug.Log("MenuManager.RemoveWindow config.name="+config.name+ " module=" + module + "  module.MenuId=" + module.MenuId );

            Debug.Log(config.menuId + "  " + config.name + "config.isDestroy=" + config.isDestroy + "  forcedDestroy=" + forcedDestroy);
            module.CheckOnExit();
            if (config.isDestroy || forcedDestroy)
            {
                Debug.Log(config.menuId + "  " + config.name + "config.isDestroy=" + config.isDestroy + "  forcedDestroy=" + forcedDestroy);
//				if(module.IsActive) module.DestroyModule();
                module.DestroyModule();
                //Coo.assetManager.UnloadUnusedAssets();
            }
            else
            {
                if (module.IsActive)
                {
                    module.IsActive = false;
                }
            }

            int activeScreenFullCount = 0;

            foreach (IModule mod in modules.Values)
            {
                var menuId = mod.MenuId;
                var cfg    = configSet[menuId];
                if (cfg.showType == ShowType.Screen && mod.IsActive)
                {
                    activeScreenFullCount += 1;
                }
            }
            if (activeScreenFullCount <= 0)
            {
                if (Application.loadedLevelName == "Main" && isInitiativeClose)               //主动关闭会默认打开主场景
                {
                    MenuChangeVO menuVO = null;

                    if (!lastOpens.TryGetValue(MenuType.Home, out menuVO))
                    {
                        menuVO               = new MenuChangeVO();
                        menuVO.menuId        = MenuType.Home;
                        menuVO.isToOpen      = true;
                        menuVO.isCloseOthers = false;
                    }
                    CheckMenuVO(menuVO);
                }
            }
        }