示例#1
0
 public bool Cancel()
 {
     if (Status == TaskStatus.Running)
     {
         if (bundleTask.Cancel())
         {
             mAssetBundleHelper.Unload(mBundleName);
         }
         Status    = TaskStatus.Canceled;
         mCallback = null;
         return(true);
     }
     return(false);
 }
示例#2
0
        /// <summary>
        /// 加载场景
        /// </summary>
        /// <param name="scenePath"></param>
        /// <param name="isAdditive"></param>
        public void LoadScene(string scenePath, bool isAdditive)
        {
            LoadSceneMode mode            = isAdditive ? LoadSceneMode.Additive : LoadSceneMode.Single;
            string        assetBundleName = mAssetManifest[scenePath];

            string[] split     = scenePath.Replace('\\', '/').Split('/');
            string   sceneName = split[split.Length - 1].Replace(".unity", "");

            if (!UnityUtility.IsSceneInBuildSetting(sceneName))
            {
                AssetBundle assetBundle = mAssetBundleHelper.LoadAssetBundle(assetBundleName);
                UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName, mode);
                mAssetBundleHelper.Unload(assetBundleName);
            }
            else
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName, mode);
            }
        }