コード例 #1
0
    /// <summary>
    /// Destory类、卸载资源(Resource,AssetBuddle)
    /// 建议使用 this.Exit();内置缓存逻辑判断与管理
    /// </summary>
    public virtual void Dispose()
    {
        this.RemoveEventListeners();
        ModuleManager.UnRegLifeCycle(this);

        foreach (BaseStagePart part in uiStageParts.Values)
        {
            if (part != null)
            {
                part.Dispose();
            }
        }

        uiStageParts.Clear();
        m_pathList.Clear();
        m_loader.UnLoad(true);
        StageManager.StageDict.Remove(GetName());

        uiStageParts = null;
        m_pathList   = null;
        m_loader     = null;

        if (this.gameObj != null)
        {
            GameObject.DestroyImmediate(this.gameObj);
        }
    }
コード例 #2
0
    public virtual void Show()
    {
        Log.info(this.GetName() + " Show.");

        if (m_loader == null)
        {
            m_loader = new ModuleResLoader(GetName());
        }

        if (m_loader.IsLoaded)
        {
            this.AddEventListeners();
            this.Init();
            this.LoadStagePart();
            if (this.OnPlayBGMCallBack != null)
            {
                this.OnPlayBGMCallBack();
            }
            this.EnterScene();

            StageManager.nowIsMainStage = this.stStageData.isMainStage;
            ModuleManager.UnRegLifeCycle(this);
            //性能优化默认隐藏主场景摄像机
            this.SetSceneMainCamaraShowOrHide();
            return;
        }

        if (m_loader.IsLoading)
        {
            return;
        }
        StartLoad();
    }