Esempio n. 1
0
 static void ParseObject(loadNode node, object obj)
 {
     if (node.isSave)
     {
         string saveName = node.path.Substring(node.path.LastIndexOf('/') + 1);
         dict.Add(saveName, obj);
     }
     if (node.action != null)
     {
         //AssetBundle ab =  ((DownloadHandlerAssetBundle)(request.downloadHandler)).assetBundle;
         node.action(obj);
     }
 }
Esempio n. 2
0
        static IEnumerator DownLoad(loadNode node)
        {
            LoadFactory.loadText = node.path;
            LoadFactory.www      = new WWW(node.path);
            yield return(LoadFactory.www);

            if (string.IsNullOrEmpty(LoadFactory.www.error))
            {
                loadType type = node.type;
                switch (type)
                {
                case loadType.Wwwbytes:
                    LoadFactory.ParseObject(node, LoadFactory.www.bytes);
                    break;

                case loadType.AssetBundle:
                    LoadFactory.ParseObject(node, LoadFactory.www.assetBundle);
                    break;

                case loadType.Texture:
                    LoadFactory.ParseObject(node, LoadFactory.www.texture);
                    break;

                case loadType.Text:
                    LoadFactory.ParseObject(node, LoadFactory.www.text);
                    break;

                case loadType.Xml:
                    LoadFactory.ParseXML(node, LoadFactory.www.text);
                    break;

                case loadType.AudioClip:
                    LoadFactory.ParseObject(node, LoadFactory.www.GetAudioClip());
                    break;
                }
                //LoadFactory.www = null;
                //Debug.Log("loadFactory.www>>>>>>>>>>>>>>>  ");
                LoadFactory.loadText = "加载完成";
                LoadFactory.NextLoad();
            }
            else
            {
                // LoadFactory.www = null;
                LoadFactory.loadText += " - 加载出错:" + www.error;
                Debug.Log("加载出错: " + www.error);
                LoadFactory.NextLoad();
            }
        }
Esempio n. 3
0
        static void ParseXML(loadNode node, string xmlstr)
        {
            XmlDocument xmldoc = new XmlDocument();

            xmldoc.LoadXml(xmlstr);
            if (node.isSave)
            {
                string saveName = node.path.Substring(node.path.LastIndexOf('/') + 1);
                dict.Add(saveName, xmldoc);
            }
            if (node.action != null)
            {
                //AssetBundle ab =  ((DownloadHandlerAssetBundle)(request.downloadHandler)).assetBundle;
                node.action(xmldoc, LoadFactory.www.bytes);
            }
        }
Esempio n. 4
0
 private static void NextLoad()
 {
     if (paths.Count > 0)
     {
         loadNode node = paths.Dequeue();
         node.parent.StartCoroutine(DownLoad(node));
     }
     else
     {
         if (loadAllComplate != null)
         {
             loadAllComplate();
             loadAllComplate = null;
         }
     }
 }
Esempio n. 5
0
 static void ParseObject(loadNode node, object obj)
 {
     if (node.isSave)
     {
         string saveName = node.path.Substring(node.path.LastIndexOf('/') + 1);
         dict.Add(saveName, obj);
     }
     if (node.action != null)
     {
         //AssetBundle ab =  ((DownloadHandlerAssetBundle)(request.downloadHandler)).assetBundle;
         if (node.type == loadType.AssetBundle)
         {
             LoadFactory.www.assetBundle.Unload(false);
         }
         node.action(obj, LoadFactory.www.bytes);
     }
 }