Manifest for all the AssetBundles in the build.

Inheritance: UnityEngine.Object
        public IEnumerator Init()
        {
            #if UNITY_EDITOR
            if (AssetBundleUtility.SimulateAssetBundleInEditor)
            {
                yield break;
            }
            #endif
            if (mAssetBundleManifest != null)
            {
                Resources.UnloadAsset(mAssetBundleManifest);
                mAssetBundleManifest = null;
            }
            LoadSceneAsyncOpe = null;
            mAssetBundleInfos = null;
            UnloadAllAssetBundles(true);

            //解析version文件
            string error = "";
            Int64 versionID;
            byte[] versionBytes = File.ReadAllBytes(Path.Combine(AssetBundleUtility.LocalAssetBundlePath, AssetBundleUtility.VersionFileName));
            if (!AssetBundleUtility.ResolveEncryptedVersionData(versionBytes, ref mAssetBundleInfos, out versionID, out error))
            {
                Debug.LogErrorFormat("resolve version file failed: {0}", error);
                yield break;
            }

            //加载Manifest
            AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(AssetBundleName2FilePath(AssetBundleUtility.GetPlatformName() + AssetBundleUtility.AssetBundleExtension));
            yield return bundleRequest;
            AssetBundleRequest assetRequest = bundleRequest.assetBundle.LoadAssetAsync<AssetBundleManifest>("AssetBundleManifest");
            yield return assetRequest;
            mAssetBundleManifest = assetRequest.asset as AssetBundleManifest;
            bundleRequest.assetBundle.Unload(false);
        }
    IEnumerator Start()
    {
        //manifestをロード
        using (WWW www = new WWW (path + manifestName)) {
            yield return www;
            if (!string.IsNullOrEmpty (www.error)) {
                Debug.Log (www.error);
                yield break;
            }

            manifest = (AssetBundleManifest)www.assetBundle.LoadAsset ("AssetBundleManifest");
            yield return null;
            www.assetBundle.Unload (false);
        }

        //sceneをロード
        using (WWW www = WWW.LoadFromCacheOrDownload (path + bundleName, manifest.GetAssetBundleHash (bundleName))) {
            yield return www;
            if (!string.IsNullOrEmpty (www.error)) {
                Debug.Log (www.error);
                yield break;
            }

            Application.LoadLevel (sceneName);
            yield return null;

            www.assetBundle.Unload (false);
        }
    }
Exemple #3
0
        public static AssetBundleManifest Create(UnityEngine.AssetBundleManifest manifest)
        {
            AssetBundleManifest result = new AssetBundleManifest()
            {
                Version = DateTime.Now.ToString("yyyyMMddHHmmss")
            };

            if (manifest == null)
            {
                return(result);
            }

            List <string> assetbundleNames = new List <string>();

            assetbundleNames.AddRange(manifest.GetAllAssetBundles());
            foreach (var name in assetbundleNames)
            {
                AssetBundleInfo info = new AssetBundleInfo()
                {
                    AssetBundleName = name,
                    Hash128         = manifest.GetAssetBundleHash(name).ToString()
                };
                info.AssetPaths.AddRange(AssetDatabase.GetAssetPathsFromAssetBundle(name));
                var dependencies = manifest.GetAllDependencies(name);
                foreach (var depName in dependencies)
                {
                    info.Dependencies.Add(assetbundleNames.IndexOf(depName));
                }
                result.Infos.Add(info);
            }
            return(result);
        }
        protected override IEnumerator GenerateLoadProcess()
        {
            string target = GetPlatformFolderForAssetBundles ();
            string baseUrl = Path.Combine (ResourceManager.Instance.assetBundleDomain, target);

            string manifestUrl = Path.Combine (baseUrl, target);
            using (WWW www = new WWW (manifestUrl))
            {
                while (www.progress < 1.0f || www.isDone == false)
                {
                    progress = www.progress;
                    yield return null;
                }
                if (www.assetBundle == null)
                {
                    Failed (www.error);
                    yield break;
                }

                AssetBundleRequest async = www.assetBundle.LoadAssetAsync ("AssetBundleManifest");
                while (async.progress < 0.9f || async.isDone == false)
                {
                    yield return null;
                }
                if (async.asset == null)
                {
                    Failed ("AssetBundle.LoadAssetAsync");
                    yield break;
                }

                assetBundleManifest = async.asset as AssetBundleManifest;
                Successed ();
            }
        }
Exemple #5
0
 private void ApplyManifest(AssetBundleManifest manifest)
 {
     string[] allbundleNames = manifest.GetAllAssetBundles();
     for (int i = 0; i < allbundleNames.Length; i++)
     {
         string name = allbundleNames[i];
         string[] depends = manifest.GetDirectDependencies(allbundleNames[i]);
         mManifest.Add(name, depends);
     }
 }
	public IABManifestLoader()
	{
		assetManifest = null;

		manifestLoader = null;

		IsLoadFinish = false;

		manifestPath = IPathTools.GetABPath ();
	}
Exemple #7
0
 static public int GetAllAssetBundlesWithVariant(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         var ret = self.GetAllAssetBundlesWithVariant();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #8
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest o;
         o = new UnityEngine.AssetBundleManifest();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.AssetBundleManifest o;
			o=new UnityEngine.AssetBundleManifest();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest o;
         o = new UnityEngine.AssetBundleManifest();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest o;
         o=new UnityEngine.AssetBundleManifest();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
 static int set_m_AssetBundleManifest(IntPtr L)
 {
     try
     {
         UnityEngine.AssetBundleManifest arg0 = (UnityEngine.AssetBundleManifest)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.AssetBundleManifest));
         ResourceManager.m_AssetBundleManifest = arg0;
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int GetAllAssetBundles(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         var ret = self.GetAllAssetBundles();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int QPYX_GetFullManifest_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 1);
         GameAsset.AssetBundleManager    QPYX_obj_YXQP = (GameAsset.AssetBundleManager)ToLua.CheckObject <GameAsset.AssetBundleManager>(L_YXQP, 1);
         UnityEngine.AssetBundleManifest QPYX_o_YXQP   = QPYX_obj_YXQP.GetFullManifest();
         ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Exemple #15
0
 static public int GetAllDependencies(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.GetAllDependencies(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public void AddUnityManifest(UnityEngine.AssetBundleManifest manifest)
 {
     if (manifest == null)
     {
         return;
     }
     string[] inOriginList = manifest.GetAllAssetBundles();
     foreach (var origin in inOriginList)
     {
         allAssetBundles.Add(origin);
         allDependencies.Add(origin, manifest.GetAllDependencies(origin));
         allHash.Add(origin, manifest.GetAssetBundleHash(origin));
     }
 }
Exemple #17
0
 static int LoadAssetBundleManifest(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         ResourceManager obj = (ResourceManager)ToLua.CheckObject <ResourceManager>(L, 1);
         UnityEngine.AssetBundleManifest o = obj.LoadAssetBundleManifest();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int GetAssetBundleHash(IntPtr l)
 {
     try {
         UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l);
         System.String a1;
         checkType(l, 2, out a1);
         var ret = self.GetAssetBundleHash(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int GetAllAssetBundlesWithVariant(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.AssetBundleManifest obj = (UnityEngine.AssetBundleManifest)ToLua.CheckObject <UnityEngine.AssetBundleManifest>(L, 1);
         string[] o = obj.GetAllAssetBundlesWithVariant();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetFullManifest(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         GameAsset.AssetBundleManager    obj = (GameAsset.AssetBundleManager)ToLua.CheckObject <GameAsset.AssetBundleManager>(L, 1);
         UnityEngine.AssetBundleManifest o   = obj.GetFullManifest();
         ToLua.PushSealed(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemple #21
0
 private IEnumerator LoadManifest()
 {
     string path = "file://" + Application.streamingAssetsPath + "/StreamingAssets";
     WWW www = new WWW(path);
     yield return www;
     manifest = www.assetBundle.LoadAsset("AssetBundleManifest") as AssetBundleManifest;
     www.assetBundle.Unload(false);
     StartCoroutine(LoadAB("uilogin", (ab) =>
     {
         GameObject go = Instantiate(ab.LoadAsset("uilogin") as GameObject);
         go.transform.SetParent(mTransform);
         go.transform.localScale = Vector3.one;
         go.transform.localPosition = Vector3.zero;
     }));
 }
Exemple #22
0
    public void DownLoadMainfest(Action<string> onComplete)
    {
        ParseManifestName();

        WWW www = new WWW(DownLoadURL + manifestName);
        Scheduler.Instance.WaitWWW(www, delegate(string error)
        {
            if (string.IsNullOrEmpty(error))
            {
                manifest = www.assetBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
            }

            onComplete(error);
            www.Dispose();
        });
    }
 static int GetAllDependencies(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AssetBundleManifest obj = (UnityEngine.AssetBundleManifest)ToLua.CheckObject <UnityEngine.AssetBundleManifest>(L, 1);
         string   arg0 = ToLua.CheckString(L, 2);
         string[] o    = obj.GetAllDependencies(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int GetAssetBundleHash(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.AssetBundleManifest obj = (UnityEngine.AssetBundleManifest)ToLua.CheckObject(L, 1, typeof(UnityEngine.AssetBundleManifest));
         string arg0           = ToLua.CheckString(L, 2);
         UnityEngine.Hash128 o = obj.GetAssetBundleHash(arg0);
         ToLua.PushValue(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 lhBundleManager(Action onReadyOver)
 {
     if (lhDefine.projectType == ProjectType.develop)
     {
         onReadyOver();
         return;
     }
     m_usedObjectDic = new Dictionary <UnityEngine.Object, UsedObjectData>();
     if (Caching.ready)
     {
         Caching.CleanCache();
     }
     lhCoroutine.StartCoroutine(ELoadManifest(lhDefine.manifestUrl, (manifest) =>
     {
         this.manifest = manifest;
         onReadyOver();
     }));
 }
	public IEnumerator LoadManifest()
	{
		WWW manifest = new WWW (manifestPath);

		yield return manifest;

		if (!string.IsNullOrEmpty (manifest.error)) {
			Debug.Log (manifest.error);
		} else {
			if (manifest.progress >= 1.0f) {
				manifestLoader = manifest.assetBundle;

				assetManifest = manifestLoader.LoadAsset ("AssetBundleManifest") as AssetBundleManifest;

				IsLoadFinish = true;
			}
		}
	}
    private void TableData_Package(BuildTarget _buildTarget)
    {
        ClearDataAB();

        DirectoryInfo dirs = new DirectoryInfo(mStrTableAssetFolder);

        if (dirs == null || (!dirs.Exists))
        {
            Debug.LogError(mStrTableAssetFolder + " 路径为不存在");
            return;
        }

        FileInfo[] files = dirs.GetFiles();

        AssetBundleBuild[] builds = new AssetBundleBuild[1];
        builds[0].assetBundleName    = mStrTableData_ABName;
        builds[0].assetBundleVariant = "unity3d";

        List <string> _assetNames = new List <string>();

        for (int i = 0; i < files.Length; ++i)
        {
            if (!files[i].Name.EndsWith(".meta"))
            {
                _assetNames.Add(mStrTableAssetFolder + files[i].Name);
            }
        }
        builds[0].assetNames = _assetNames.ToArray();

        UnityEngine.AssetBundleManifest _abM = BuildPipeline.BuildAssetBundles(mStrTableAssetBundleTotalFolder,
                                                                               builds,
                                                                               BuildAssetBundleOptions.None,
                                                                               _buildTarget);

        if (_abM != null)
        {
            EditorUtility.DisplayDialog("Excel已经打包完成", "", "确定");
            AssetDatabase.Refresh();
        }
        else
        {
            EditorUtility.DisplayDialog("Excel打包出错", "", "确定");
        }
    }
    static int _CreateUnityEngine_AssetBundleManifest(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.AssetBundleManifest obj = new UnityEngine.AssetBundleManifest();
                ToLua.PushSealed(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.AssetBundleManifest.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        static bool PatchPrefix(IEasyBundle __instance, string key, string rootPath, UnityEngine.AssetBundleManifest manifest, IBundleLock bundleLock)
        {
            EasyBundleHelper esayBundle = new EasyBundleHelper(__instance);

            esayBundle.Key = key;

            var        path = rootPath + key;
            BundleInfo bundle;

            if (Settings.bundles.TryGetValue(key, out bundle))
            {
                path = bundle.Path;
            }

            esayBundle.Path = path;
            esayBundle.KeyWithoutExtension = Path.GetFileNameWithoutExtension(key);

            string[] dependencyKeys = manifest.GetDirectDependencies(key);


            foreach (KeyValuePair <string, BundleInfo> kvp in Settings.bundles)
            {
                if (!key.Equals(kvp.Key))
                {
                    continue;
                }

                List <string> result = dependencyKeys == null ? new List <string>() : dependencyKeys.ToList <string>();
                dependencyKeys = result.Union(kvp.Value.DependencyKeys).ToList <string>().ToArray <string>();
                break;
            }

            esayBundle.DependencyKeys = dependencyKeys;
            esayBundle.LoadState      = new BindableState(ELoadState.Unloaded, null);
            esayBundle.BundleLock     = bundleLock;

            return(false);
        }
	static void BuildAllAssetBundles ()
	{
		assetBundleManifest = BuildPipeline.BuildAssetBundles ("Assets//StreamingAssets/bundle");
		AssetDatabase.Refresh();
		string[] allAssetBundles = assetBundleManifest.GetAllAssetBundles();
		foreach(var assetBundle in allAssetBundles){
			print("AssetBundleName: " + assetBundle);
//			string[] allDependencies = assetBundleManifest.GetAllDependencies(assetBundle);
//			foreach(var dependencie in allDependencies){
//				print("DependAssetBundleName: " + dependencie);
//			}
//			string[] directDependencies = assetBundleManifest.GetDirectDependencies(assetBundle);
//			foreach(var direct in directDependencies){
//				print("DirectDependAssetBundleName: " + direct);
//			}

			string assetsBundlePath = Application.streamingAssetsPath + "/bundle/" + assetBundle;

			if(bundle != null)
				bundle.Unload(true);
			bundle = AssetBundle.LoadFromFile(assetsBundlePath);

			string[] allAssetNames = bundle.GetAllAssetNames();
			foreach(var assetName in allAssetNames){
				print("AssetName: " + assetName);
//				string[] assetPath = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(assetBundle, assetName);
//				foreach(var aPath in assetPath){
//					print("AssetPath: " + aPath);
//					string[] dependencie = AssetDatabase.GetDependencies(aPath);
//					foreach(var dep in dependencie){
//						print("Dependencie: " + dep);
//					}
//				}
			}
		}

	}
Exemple #31
0
        static AssetBundleManifest OutputResult(string resultFile, float useTime, UnityEngine.AssetBundleManifest manifest)
        {
            if (manifest == null)
            {
                return(null);
            }

            AssetBundleManifest result = new AssetBundleManifest();

            result.buildTime = useTime;
            List <AssetBundleManifest.AssetBundleBuild> bundles = new List <AssetBundleManifest.AssetBundleBuild>();

            foreach (var name in manifest.GetAllAssetBundles())
            {
                AssetBundleManifest.AssetBundleBuild bundle = new AssetBundleManifest.AssetBundleBuild();
                bundle.assetBundleName = name;
                bundle.dependency      = manifest.GetDirectDependencies(name);
                bundle.hash            = manifest.GetAssetBundleHash(name).ToString();
                bundles.Add(bundle);
            }
            result.builds = bundles.ToArray();
            File.WriteAllText(resultFile, JsonUtility.ToJson(result, true));
            return(result);
        }
 /// <summary>
 /// 初始化
 /// </summary>
 public void Initialize() {
     byte[] stream = null;
     string uri = string.Empty;
     bundles = new Dictionary<string, AssetBundle>();
     uri = Util.DataPath + AppConst.AssetDirname;
     if (!File.Exists(uri)) return;
     stream = File.ReadAllBytes(uri);
     assetbundle = AssetBundle.CreateFromMemoryImmediate(stream);
     manifest = assetbundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
 }
Exemple #33
0
 public BundleManifest(AssetBundleManifest manifest)
 {
     ApplyManifest(manifest);
 }
Exemple #34
0
 private static extern void INTERNAL_CALL_GetAssetBundleHash(AssetBundleManifest self, string assetBundleName, out Hash128 value);
Exemple #35
0
	// =====ここからメソッド群=====
	
	// 作成したアセットバンドル情報を、ソートしたディクショナリー形式にして返す
	static private SortedDictionary<string, string> CreateAssetbundleSortedDictionary(AssetBundleManifest assetBundleManifest) {
		string[] allAssetBundles = assetBundleManifest.GetAllAssetBundles();
		SortedDictionary<string, string> forSortList = new SortedDictionary<string, string>();
		for( int i = 0; i < allAssetBundles.Length ; i++ ) {
			string hash = assetBundleManifest.GetAssetBundleHash( allAssetBundles[i] ).ToString();

			forSortList.Add(allAssetBundles[i], hash);
		}

		// 結果出力
		Debug.Log("=====SortedDictionary:OutputStart=====");
		foreach(var data in forSortList) {
			Debug.Log("key : " + data.Key + "/" + "Value : " + data.Value);
		}
		Debug.Log("=====SortedDictionary:OutputEnd=====");

		return forSortList;
	}
Exemple #36
0
    private static void CreateModOutputCfg(ModuleBuilder mb, CreateAssetBundlesContext ctx, UnityEngine.AssetBundleManifest manifest)
    {
        var outputRootDir = ctx.outputRootDir;
        var targetDir     = System.IO.Path.Combine(outputRootDir, "out", mb.Cfg.Name);

        System.IO.Directory.CreateDirectory(targetDir);

        // copy bundle files
        foreach (var bb in mb.bundleBuilders)
        {
            var bName       = bb.BundleName;
            var srcFileName = System.IO.Path.Combine(outputRootDir, bName);
            var dstFileName = System.IO.Path.Combine(targetDir, bName);

            System.IO.File.Copy(srcFileName, dstFileName);
        }

        // generate cfg json file
        var mcfg = new ModOutputCfg();

        mcfg.name     = mb.Cfg.Name;
        mcfg.version  = mb.version;
        mcfg.csVer    = ctx.csVersion;
        mcfg.lobbyVer = ctx.lobbyVersion;

        var bcfgList = new List <ModBundleOutputCfg>();

        foreach (var bb in mb.bundleBuilders)
        {
            var bName       = bb.BundleName;
            var srcFileName = System.IO.Path.Combine(outputRootDir, bName);
            var bcfg        = new ModBundleOutputCfg();

            bcfg.name = bName;
            var bytes = System.IO.File.ReadAllBytes(srcFileName);
            bcfg.md5  = NetHelper.MD5(bytes);
            bcfg.size = bytes.Length;

            bcfg.deps = manifest.GetDirectDependencies(bName);
            bcfgList.Add(bcfg);
        }

        mcfg.abList = bcfgList.ToArray();

        var cfgFileName = System.IO.Path.Combine(targetDir, "cfg.json");
        var json        = UnityEngine.JsonUtility.ToJson(mcfg, true);

        System.IO.File.WriteAllText(cfgFileName, json);
    }
    IEnumerator LoadManifest(string platform)
    {
        Debug.Log( "Loading Manifest");

        using(WWW www = new WWW(pathToBundles + platform))
        {
            yield return www;
            if(!string.IsNullOrEmpty(www.error))
            {
                Debug.Log(www.error);
                return false;
            }

            manifest = (AssetBundleManifest)www.assetBundle.LoadAsset("AssetBundleManifest", typeof(AssetBundleManifest));
            yield return null;
            www.assetBundle.Unload(false);
        }

        if (!isReady)
            Debug.Log ("There was an error loading manifest");
        else
            Debug.Log ("Manifest loaded successfully");
    }
Exemple #38
0
 private static void LoadAssetBundleManifest(Action callBack)
 {
     LoadResources.LoadCore(AssetPathConfig.GetPlatformName(), item =>
     {
         AssetBundleManifestObject = item.MainAsset as AssetBundleManifest;
         //LoggerHelper.Error("LoadAssetBundleManifest init: " + AssetBundleManifestObject);
         if (callBack != null)
         {
             callBack();
         }
     }, EResType.None, false, true, false);
 }
    IEnumerator LoadManifest()
    {
        Debug.Log ("Loading Manifest");
        Debug.Log ("スタートロード");
        using (WWW www = new WWW (pathToBundles + platform)) {
            yield return www;
            if (!string.IsNullOrEmpty (www.error)) {
                Debug.Log (www.error);

                return false;
            }
            progressVal = www.progress;
            Debug.Log ("progress" + progressVal.ToString ());
            Debug.Log ("プラットフォーム" + platform);
            Debug.Log (pathToBundles + platform);
            Debug.Log ("マニフェストをロード開始");

            manifest = (AssetBundleManifest)www.assetBundle.LoadAsset ("AssetBundleManifest", typeof(AssetBundleManifest));
            yield return null;
            Debug.Log ("バンドルを解放");
            www.assetBundle.Unload (false);
        }

        if (!isReady) {
            Debug.Log ("There was an error loading manifest");
            Debug.Log ("Manifestをロード出来ませんでした");
        } else {
            Debug.Log ("Manifest loaded successfully");

            Debug.Log ("Manifestをロード完了");
        }
    }
 /// <summary>
 /// 销毁资源
 /// </summary>
 void OnDestroy() {
     if (shared != null) shared.Unload(true);
     if (manifest != null) manifest = null;
     Debug.Log("~ResourceManager was destroy!");
 }
	private string[] GetAssetbundlesNeedsUpdate(AssetBundleManifest servermanifest, AssetBundleManifest localmanifest)
    {
        List<string> result = new List<string>();
        var allassets = servermanifest.GetAllAssetBundles();
        for (int i = 0; i < allassets.Length; i++)
        {
			Debug.Log("compare hash for bundle:" + allassets[i]);
            if (localmanifest.GetAssetBundleHash(allassets[i]).ToString() != servermanifest.GetAssetBundleHash(allassets[i]).ToString())
                result.Add(allassets[i]);
        }

        return result.ToArray();
    }
	void OnInitialize (bool isSuccess, AssetBundleManifest result)
	{
		Debug.Log ("GameController#OnInitialize " + "isSuccess: " + isSuccess + " result: " + result);
	}
Exemple #43
0
    IEnumerator InitManifest()
    {
        string url = "file://" + GameConst.ResRootPath + "AssetInfo";
        if (null == assetBundleManifest)
        {
            WWW www = WWW.LoadFromCacheOrDownload(url, 0);
            yield return www;
            if (null != www.assetBundle)
            {
                assetBundleManifest = www.assetBundle.LoadAsset("AssetBundleManifest") as AssetBundleManifest;
            }
        }
        if (null == assetBundleManifest)
        {
            DebugTool.LogError("cant find the file : " + url);
            yield break;
        }

        string[] bundlePaths = assetBundleManifest.GetAllAssetBundles();
        for (int i = 0; i < bundlePaths.Length; i++)
        {
            string name = bundlePaths[i];
            name = Path.GetFileNameWithoutExtension(name);
            Debug.Log(name + "=>" + bundlePaths[i]);
            _packNameToBundleName[name] = bundlePaths[i];
            _bundleNameToPackName[bundlePaths[i]] = name;
        }
    }
Exemple #44
0
    public static BundleManifest CombineBundleManifest(string outputPath,AssetBundleManifest beforManifest, AssetBundleManifest nowManifest)
    {
        BundleManifest data = new BundleManifest(beforManifest);


        //  remove non exist
        List<string> removeList = new List<string>();
        foreach (var iter in data.mManifest)
        {
            if (File.Exists(outputPath + "/" + iter.Key) == false)
            {
                removeList.Add(iter.Key);
            }
        }

        for (int i = 0; i < removeList.Count; i++)
        {
            data.mManifest.Remove(removeList[i]);
        }


        string nowManifestName = string.Empty;
        string[] allNowManifest = nowManifest.GetAllAssetBundles();
        for (int i = 0; i < allNowManifest.Length; i++)
        {
            nowManifestName = allNowManifest[i];
            string[] nowDepend = nowManifest.GetDirectDependencies(nowManifestName);
            if (data.mManifest.ContainsKey(nowManifestName))
            {
                data.mManifest[nowManifestName] = nowDepend;
            }
            else
            {
                data.mManifest.Add(nowManifestName, nowDepend);
            }
        }

        return data;
    }
Exemple #45
0
    IEnumerator LoadManifestFromWebRequest()
    {
        var url = GetManifestURL();
        var www = new UnityWebRequest(url) { downloadHandler = new DownloadHandlerAssetBundle(url, 0) };
        yield return www.Send();

        var assetBundle = ((DownloadHandlerAssetBundle)(www.downloadHandler)).assetBundle;
        var assets = assetBundle.LoadAllAssets();

        AddLoadedBundleToManager(assetBundle, assets[0].name);

        manifest = (AssetBundleManifest)assets[0];
    }
    static int _CreateAssetBundleManifest(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            AssetBundleManifest obj = new AssetBundleManifest();
            LuaScriptMgr.Push(L, obj);
            return 1;
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: AssetBundleManifest.New");
        }

        return 0;
    }
    private static void UITexture_Package(BuildTarget _buildTarget)
    {
        ClearDataAB();

        DirectoryInfo dirs = new DirectoryInfo(mStrUITextureFolder);

        if (dirs == null || (!dirs.Exists))
        {
            Debug.LogError(mStrUITextureFolder + " 此路径找不到可以打包的UITexture");
            return;
        }

        AssetBundleBuild[] builds = new AssetBundleBuild[1];
        builds[0].assetBundleName    = mStrUITexture_ABName;
        builds[0].assetBundleVariant = "unity3d";

        FileInfo[]    files       = dirs.GetFiles();
        List <string> _assetNames = new List <string>();

        for (int i = 0; i < files.Length; ++i)
        {
            if (!files[i].Name.EndsWith(".meta"))
            {
                _assetNames.Add(mStrUITextureFolder + files[i].Name);
            }
        }
        builds[0].assetNames = _assetNames.ToArray();

        UnityEngine.AssetBundleManifest _abM = BuildPipeline.BuildAssetBundles(mStrUITextureAssetBundleTotalFolder,
                                                                               builds,
                                                                               BuildAssetBundleOptions.None,
                                                                               _buildTarget);

        if (_abM != null)
        {
            EditorUtility.DisplayDialog("UITexture已经打包完成", "", "确定");
            AssetDatabase.Refresh();
        }
        else
        {
            EditorUtility.DisplayDialog("UITexture打包出错", "", "确定");
        }

        ////Unity4.x的方法
        //List<UnityEngine.Object> assets = new List<UnityEngine.Object>();
        //var paths = Directory.GetFiles(mStrUITextureFolder, "*", SearchOption.AllDirectories);
        //foreach (var item in paths)
        //{
        //    var addon = AssetDatabase.LoadAssetAtPath(item.Replace(@"\", "/"), typeof(UnityEngine.Object));
        //    if (addon != null)
        //    {
        //        assets.Add(addon);
        //    }
        //}
        //string UITextureBundleName = "UITexture.unity3d";
        //bool ok = BuildPipeline.BuildAssetBundle(null,
        //    assets.ToArray(),
        //    mStrUITextureAssetBundleTotalFolder + "/" + UITextureBundleName,
        //    BuildAssetBundleOptions.None,
        //    _buildTarget);
        //if (ok)
        //{
        //    EditorUtility.DisplayDialog("UITexture已经打包完成", "", "确定");
        //    AssetDatabase.Refresh();
        //}
        //else
        //{
        //    EditorUtility.DisplayDialog("UITexture打包出错", "", "确定");
        //}
    }
 private static extern void INTERNAL_CALL_GetAssetBundleHash(AssetBundleManifest self, string assetBundleName, out Hash128 value);