Example #1
0
    public IEnumerator GetObj(string resName, PackObj ret)
    {
        if (!string.IsNullOrEmpty(res [resName].Value))
        {
            var ab  = res [resName].Value;
            var arr = abDepend [ab].AsArray;
            List <AssetBundle> allBundles = new List <AssetBundle> ();
            foreach (var ab2 in arr)
            {
                var abName = (ab2 as JSONNode).Value;
                yield return(StartCoroutine(LoadAb(abName, ret)));

                if (ret.obj != null)
                {
                    allBundles.Add(ret.obj as AssetBundle);
                }
            }
            foreach (var ab3 in allBundles)
            {
                //ab3.LoadAll ();
            }

            yield return(StartCoroutine(LoadAb(ab, ret)));

            Debug.Log("LoadAb: " + ret.obj);
            var abLoad = ret.obj as AssetBundle;

            /*
             *          var res2 = abLoad.Load (resName);
             *          Debug.Log ("Resource: " + res2);
             *          var newGo = GameObject.Instantiate (res2) as GameObject;
             */
        }
    }
Example #2
0
    private IEnumerator LoadAb(string name, PackObj obj)
    {
        //var dp = Application.dataPath.Replace("/", "\\");
        var par = Path.Combine(Application.dataPath, "../abFiles");
        var f   = Path.Combine(par, name);

        Debug.Log("fileName: " + f);
        f = f.Replace("\\", "/");
        var www = new WWW("file://" + f);

        yield return(www);

        obj.obj = www.assetBundle;
    }