Beispiel #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()
        {
#if UNITY_EDITOR
            SimulateAssetBundleInEditor = false;
#endif
            return(Initialize(AssetsUtility.GetPlatformName()));
        }
Beispiel #2
0
        public static AssetBundle LoadAB(string abPath)
        {
            if (abDic.ContainsKey(abPath) == true)
            {
                return(abDic [abPath]);
            }
            if (manifest == null)
            {
                //string ane = AssetsManager.ASSETBUNDLE_PATH + AssetsUtility.GetPlatformName () + "/" + AssetsUtility.GetPlatformName ();
                AssetBundle manifestBundle = AssetBundle.LoadFromFile(AssetsManager.ASSETBUNDLE_PATH +
                                                                      AssetsUtility.GetPlatformName() + "/" + AssetsUtility.GetPlatformName());
                manifest = (AssetBundleManifest)manifestBundle.LoadAsset("AssetBundleManifest");
            }
            if (manifest != null)
            {
                // 2.获取依赖文件列表
                string [] cubedepends = manifest.GetAllDependencies(abPath);

                for (int index = 0; index < cubedepends.Length; index++)
                {
                    //Debug.Log(cubedepends[index]);
                    // 3.加载所有的依赖资源
                    LoadAB(cubedepends [index]);
                }

                // 4.加载资源
                abDic [abPath] = AssetBundle.LoadFromFile(AssetsManager.ASSETBUNDLE_PATH + AssetsUtility.GetPlatformName() + "/" + abPath);

                return(abDic [abPath]);
            }
            return(null);
        }