Пример #1
0
        /// <summary>
        /// Initializes asset bundle namager and starts download of manifest asset bundle.
        /// Returns the manifest asset bundle downolad operation object.
        /// </summary>
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
#if UNITY_EDITOR
            Log(LogType.Info, "Simulation Mode: " + (SimulateAssetBundleInEditor ? "Enabled" : "Disabled"));
#endif
            if (sInstance == null)
            {
                // Create assetbundle manager gameobject.
            }

#if UNITY_EDITOR
            // If we're in Editor simulation mode, we don't need the manifest assetBundle.
            if (SimulateAssetBundleInEditor)
            {
                return(null);
            }
#endif

            if (string.IsNullOrEmpty(m_BaseDownloadingURL))
            {
                SetSourceAssetBundleURL(Application.persistentDataPath);
            }

            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #2
0
        /// <summary>
        /// Initializes asset bundle namager and starts download of manifest asset bundle.
        /// Returns the manifest asset bundle downolad operation object.
        /// </summary>
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
#if UNITY_EDITOR
            Log(LogType.Info, "Simulation Mode: " + (SimulateAssetBundleInEditor ? "Enabled" : "Disabled"));
#endif

            var go = GameObject.Find("AssetBundleManager");
            if (go == null)
            {
                go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));
                DontDestroyOnLoad(go);
            }

#if UNITY_EDITOR
            // If we're in Editor simulation mode, we don't need the manifest assetBundle.
            if (SimulateAssetBundleInEditor)
            {
                return(null);
            }
#endif

            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #3
0
        // Load AssetBundleManifest.
        // 加载AssetBundle载货单;
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
            /*#if UNITY_EDITOR
             *              Log (LogType.Info, "Simulation Mode: " + (SimulateAssetBundleInEditor ? "Enabled" : "Disabled"));
             #endif */

            var go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));

            DontDestroyOnLoad(go);             //创建AssetBundleManager对象,加载不销毁;

            Debug.Log("manifest assetBundle name: " + manifestAssetBundleName);

/*
 #if UNITY_EDITOR
 *                      // If we're in Editor simulation mode, we don't need the manifest assetBundle.
 *          //如果我们在编辑器模拟模式,我们不需要assetBundle载货单;
 *                      if (SimulateAssetBundleInEditor)
 *                              return null;
 #endif */


            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));

            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #4
0
        // Load AssetBundleManifest.
        /// <summary>
        /// 初始化操作,异步加载资源依赖总览
        /// </summary>
        /// <param name="manifestAssetBundleName">平台名</param>
        /// <returns></returns>
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
#if UNITY_EDITOR
            Log(LogType.Info, "Simulation Mode: " + (SimulateAssetBundleInEditor ? "Enabled" : "Disabled"));
#endif

            // 创建资源管理对象的U3D GameObject 设置为不自动销毁
            var go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));
            DontDestroyOnLoad(go);

#if UNITY_EDITOR
            // If we're in Editor simulation mode, we don't need the manifest assetBundle.
            // 如果是编辑器模式,且处于模式模式,不需要加载资源依赖总览
            if (SimulateAssetBundleInEditor)
            {
                return(null);
            }
#endif

            // 下载资源,以及其依赖信息
            LoadAssetBundle(manifestAssetBundleName, true);
            // 创建异步加载请求,并放入准备处理队列
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest",
                                                                 typeof(AssetBundleManifest));
            m_InProgressOperations.Add(operation);

            return(operation);
        }
Пример #5
0
		public static AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
		{
			AssetBundleManager.LoadAssetBundle(manifestAssetBundleName, true);
			AssetBundleLoadManifestOperation assetBundleLoadManifestOperation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
			AssetBundleManager.m_InProgressOperations.Add(assetBundleLoadManifestOperation);
			return assetBundleLoadManifestOperation;
		}
Пример #6
0
        // Load AssetBundleManifest.
        public static AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
            var go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));

            DontDestroyOnLoad(go);
            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));

            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #7
0
        // Load AssetBundleManifest.
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName)
        {
#if UNITY_EDITOR
            Log(LogType.Info, "Simulation Mode: " + (SimulateAssetBundleInEditor ? "Enabled" : "Disabled"));
#endif

            var go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));
            DontDestroyOnLoad(go);
            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
            m_InProgressOperations.Add(operation);
            return(operation);
        }
        public AssetBundleLoadManifestOperation Initialize()
        {
            if (m_AssetBundleManifest != null)
            {
                return(null);
            }

            LoadAssetBundle(MenuName, true);
            var operation = new AssetBundleLoadManifestOperation(MenuName, "AssetBundleManifest", typeof(AssetBundleManifest));

            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #9
0
        /// <summary>
        /// 加载AssetBundleManifest
        /// </summary>
        /// <param name="manifestAssetBundleName"></param>
        /// <returns></returns>
        public static AssetBundleLoadManifestOperation LoadManifest(string manifestAssetBundleName)
        {
#if UNITY_EDITOR
            // If we're in Editor simulation mode, we don't have to really load the assetBundle and its dependencies.
            if (SimulateAssetBundleInEditor)
            {
                return(null);
            }
#endif
            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
            m_InProgressOperations.Add(operation);
            return(operation);
        }
Пример #10
0
 public static void Initialize()
 {
     if (!AssetBundleManager.m_Instance)
     {
         AssetBundleManager.SetSourceAssetBundleURL(Path.GetFullPath(Application.dataPath).Replace("\\", "/") + "/AssetBundles/");
         AssetBundleManager assetBundleManager = new GameObject("AssetBundleManager").AddComponent <AssetBundleManager>();
         UnityEngine.Object.DontDestroyOnLoad(assetBundleManager);
         AssetBundleManager.m_Instance = assetBundleManager;
         AssetBundleLoadManifestOperation assetBundleLoadManifestOperation = AssetBundleManager.Initialize(Utility.GetPlatformName());
         if (assetBundleLoadManifestOperation != null)
         {
             AssetBundleManager.m_Instance.StartCoroutine(assetBundleLoadManifestOperation);
         }
     }
 }
Пример #11
0
        // Load AssetBundleManifest.
        static public AssetBundleLoadManifestOperation Initialize(string manifestAssetBundleName, GameObject go)
        {
            if (go == null)
            {
                go = new GameObject("AssetBundleManager", typeof(AssetManager));
                DontDestroyOnLoad(go);
            }
            else
            {
                go.AddComponent <AssetManager>();
            }
            LoadAssetBundle(manifestAssetBundleName, true);
            var operation = new AssetBundleLoadManifestOperation(manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));

            m_InProgressOperations.Add(operation);
            return(operation);
        }