Example #1
0
        /// <summary>
        ///卸载
        /// </summary>
        public void AddUnLoadAsset(UnityLODGroupFast fast)
        {
            int           id        = fast.GetInstanceID();
            LoadAssetBase loadAsset = null;

            fast.SetEnableApply();
            if (!m_LoadAsset.TryGetValue(id, out loadAsset))
            {
                return;
            }
            switch (loadAsset.State)
            {
            case Loadm_State.Loading:
                m_LoadCount--;
                loadAsset.UnLoad();
                break;

            case Loadm_State.Instantiated:
                if (!m_ImmediateUnLoad)   //不等待
                {
                    loadAsset.UnLoad();
                    break;
                }
                m_UnLoadCount++;
                loadAsset.ReadyState = Loadm_State.Unloaded;
                break;

            case Loadm_State.Unloaded:
            case Loadm_State.UnLoading:
                break;
            }
        }
Example #2
0
        /// <summary>
        ///加载
        /// </summary>
        public void AddLoadAsset(UnityLODGroupFast fast)
        {
            int           id        = fast.GetInstanceID();
            LoadAssetBase loadAsset = null;

            fast.SetEnableApply();

            if (!m_LoadAsset.TryGetValue(id, out loadAsset))
            {
                loadAsset = s_LoadAssetPool.Spawn();
                m_LoadAsset.Add(id, loadAsset);
            }

            //要准备卸载,把状态改变回来
            if (loadAsset.ReadyState == Loadm_State.Unloaded)
            {
                m_UnLoadCount--;
            }
            loadAsset.ReadyState = Loadm_State.None;
            switch (loadAsset.State)
            {
            case Loadm_State.Instantiated:
                loadAsset.StopCoroutines();
                break;

            case Loadm_State.Loading:
                break;

            case Loadm_State.Unloaded:
                m_LoadCount++;
                loadAsset.Load(fast, this);
                break;

            case Loadm_State.UnLoading:
                m_LoadCount++;
                loadAsset.StopCoroutines();
                loadAsset.Load(null, null);
                break;
            }
        }
Example #3
0
 /// <summary>
 ///节点卸载完毕
 /// </summary>
 public void Unloaded(LoadAssetBase loadAsset, UnityLODGroupFast fast)
 {
     s_LoadAssetPool.UnSpawn(loadAsset);
     m_LoadAsset.Remove(fast.GetInstanceID());
     //UnLoadCount++;
 }