Beispiel #1
0
 internal override void Load()
 {
     if (!string.IsNullOrEmpty(m_AssetBundleName))
     {
         m_Bundle = XAsset.Get().LoadBundle(m_AssetBundleName);
         if (m_Bundle != null)
         {
             SceneManager.LoadScene(m_SceneName, m_LoadSceneMode);
         }
     }
     else
     {
         try
         {
             SceneManager.LoadScene(m_SceneName, m_LoadSceneMode);
             m_LoadState = ELoadState.LoadAsset;
         }
         catch (Exception e)
         {
             Debug.LogException(e);
             Error       = e.ToString();
             m_LoadState = ELoadState.Loaded;
         }
     }
 }
Beispiel #2
0
 internal override void Unload()
 {
     if (m_Request != null)
     {
         m_Request.Release();
         m_Request = null;
     }
 }
Beispiel #3
0
        internal override void Unload()
        {
            if (m_Bundle != null)
            {
                m_Bundle.Release();
                m_Bundle = null;
            }

            Asset = null;
        }
Beispiel #4
0
        private void UnloadDependencies(BundleRequest bundle)
        {
            for (var i = 0; i < bundle.Dependencies.Count; i++)
            {
                var item = bundle.Dependencies[i];
                item.Release();
            }

            bundle.Dependencies.Clear();
        }
Beispiel #5
0
        internal override void Load()
        {
            // fix
            // 同一帧,先调异步接口,再调用同步接口,同步接口 bundle.assetBundle 报空
            // (不确定异步加载bundle未完成时的情况)

            m_Bundle = XAsset.Get().LoadBundle(m_AssetBundleName);
            var assetName = Path.GetFileName(Url);

            Asset = m_Bundle.AssetBundle.LoadAsset(assetName, AssetType);
        }
Beispiel #6
0
        private void LoadDependencies(BundleRequest bundle, string assetBundleName, bool asyncRequest)
        {
            var dependencies = GetAllDependencies(assetBundleName);

            if (dependencies.Length <= 0)
            {
                return;
            }
            for (var i = 0; i < dependencies.Length; i++)
            {
                var item = dependencies[i];
                bundle.Dependencies.Add(LoadBundle(item, asyncRequest));
            }
        }
Beispiel #7
0
 internal override void Load()
 {
     m_AssetName = Path.GetFileName(Url);
     if (XAsset.s_RuntimeMode)
     {
         var assetBundleName = m_AssetName.Replace(".asset", ".unity3d").ToLower();
         m_Request           = XAsset.Get().LoadBundle(assetBundleName, true);
         m_Request.Completed = Request_completed;
         m_LoadState         = ELoadState.LoadAssetBundle;
     }
     else
     {
         m_LoadState = ELoadState.Loaded;
     }
 }
Beispiel #8
0
        internal override void Unload()
        {
            if (m_Bundle != null)
            {
                m_Bundle.Release();
            }

            if (m_LoadSceneMode == LoadSceneMode.Additive)
            {
                if (SceneManager.GetSceneByName(m_SceneName).isLoaded)
                {
                    SceneManager.UnloadSceneAsync(m_SceneName);
                }
            }

            m_Bundle = null;
        }
Beispiel #9
0
 internal void UnloadBundle(BundleRequest bundle)
 {
     bundle.Release();
 }