Example #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;
         }
     }
 }
Example #2
0
 public SceneAssetRequest(string path, bool addictive)
 {
     Url = path;
     XAsset.Get().GetAssetBundleName(path, out m_AssetBundleName);
     m_SceneName     = Path.GetFileNameWithoutExtension(Url);
     m_LoadSceneMode = addictive ? LoadSceneMode.Additive : LoadSceneMode.Single;
 }
Example #3
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);
        }
Example #4
0
 internal override void Load()
 {
     if (!string.IsNullOrEmpty(m_AssetBundleName))
     {
         m_Bundle    = XAsset.Get().LoadBundleAsync(m_AssetBundleName);
         m_LoadState = ELoadState.LoadAssetBundle;
     }
     else
     {
         LoadSceneAsync();
     }
 }
Example #5
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;
     }
 }
Example #6
0
        public void OnClear()
        {
            OnMessage("数据清除完毕");
            OnProgress(0);
            _versions.Clear();
            _downloader.Clear();
            _step = EStep.Wait;
            _reachabilityChanged = false;

            XAsset.Get().Clear();

            if (listener != null)
            {
                listener.OnClear();
            }

            if (Directory.Exists(_savePath))
            {
                Directory.Delete(_savePath, true);
            }
        }
Example #7
0
        private void Request_completed(IAssetRequest ar)
        {
            m_Request.Completed = null;
            if (m_Request.AssetBundle == null)
            {
                base.Error = "assetBundle == null";
            }
            else
            {
                var manifest = m_Request.AssetBundle.LoadAsset <XAssetManifest>(m_AssetName);
                if (manifest == null)
                {
                    base.Error = "manifest == null";
                }
                else
                {
                    XAsset.Get().OnLoadManifest(manifest);
                    m_Request.AssetBundle.Unload(true);
                    m_Request.AssetBundle = null;
                }
            }

            m_LoadState = ELoadState.Loaded;
        }
Example #8
0
 internal override void Load()
 {
     m_Bundle    = XAsset.Get().LoadBundleAsync(m_AssetBundleName);
     m_LoadState = ELoadState.LoadAssetBundle;
 }