示例#1
0
 static public bool IsOperationInProgress(AssetBundleLoadOperation operation)
 {
     if (m_InProgressOperations.Contains(operation))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#2
0
        void ProcessFinishedOperation(AssetBundleLoadOperation operation)
        {
            AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation;

            if (download == null)
            {
                return;
            }

            if (download.error == null)
            {
                m_LoadedAssetBundles.Add(download.assetBundleName, download.assetBundle);
            }
            else
            {
                string msg = string.Format("Failed downloading bundle {0} from {1}: {2}",
                                           download.assetBundleName, download.GetSourceURL(), download.error);
                m_DownloadingErrors.Add(download.assetBundleName, msg);
            }
            m_DownloadingBundles.Remove(download.assetBundleName);
        }
示例#3
0
        void ProcessFinishedOperation(AssetBundleLoadOperation operation)
        {
            AssetBundleDownloadOperation download = operation as AssetBundleDownloadOperation;

            if (download == null)
            {
                return;
            }

            if (String.IsNullOrEmpty(download.error))
            {
                //Debug.Log("[AssetBundleManager] processed downloaded bundle " + download.assetBundleName);
                m_LoadedAssetBundles.Add(download.assetBundleName, download.assetBundle);
            }
            else
            {
                string msg = string.Format("Failed downloading bundle {0} from {1}: {2}",
                                           download.assetBundleName, download.GetSourceURL(), download.error);
                m_DownloadingErrors.Add(download.assetBundleName, msg);
            }
            m_DownloadingBundles.Remove(download.assetBundleName);
        }
示例#4
0
        /// <summary>
        /// Starts a load operation for a level from the given asset bundle.
        /// </summary>
        static public AssetBundleLoadOperation LoadLevelAsync(string assetBundleName, string levelName, bool isAdditive)
        {
            Log(LogType.Info, "Loading " + levelName + " from " + assetBundleName + " bundle");

            AssetBundleLoadOperation operation = null;

#if UNITY_EDITOR
            if (SimulateAssetBundleInEditor)
            {
                operation = new AssetBundleLoadLevelSimulationOperation(assetBundleName, levelName, isAdditive);
            }
            else
#endif
            {
                assetBundleName = RemapVariantName(assetBundleName);
                LoadAssetBundle(assetBundleName, false);
                operation = new AssetBundleLoadLevelOperation(assetBundleName, levelName, isAdditive);

                m_InProgressOperations.Add(operation);
            }

            return(operation);
        }