/// <summary> /// 初始化加载器 /// </summary> /// <param name="fileList">文件列表</param> /// <param name="initOK">初始化完成回调</param> public void Initialize(string fileList, Action initOK) { // string path = FileUtils.getAbPath(Const.AssetBundleXMLName); if (!System.IO.File.Exists(path)) { return; } XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNodeList nodeList = doc.SelectSingleNode("files").ChildNodes; foreach (XmlElement xe in nodeList) { AssetBundleInfo info = new AssetBundleInfo(); string _fileName = xe.SelectSingleNode("fileName").InnerText; info.assetName = xe.SelectSingleNode("assetName").InnerText; info.bundleName = xe.SelectSingleNode("bundleName").InnerText; XmlNode deps = xe.SelectSingleNode("deps"); if (null != deps) { XmlNodeList depList = deps.ChildNodes; foreach (XmlElement _xe in depList) { info.AddDependence(_xe.InnerText); } } fileMap.Add(_fileName.Substring("Assets/RawRes/".Length), info); } }
void LoadAssetXml(string filePath) { XmlDocument doc = new XmlDocument(); #if UNITY_ANDROID && !UNITY_EDITOR Debug.Log("++++++++++++LoadAssetXml"); WWW www = new WWW(filePath); while (!www.isDone) { } doc.LoadXml(www.text); #else if (!System.IO.File.Exists(filePath)) { return; } doc.Load(filePath); #endif XmlNodeList nodeList = doc.SelectSingleNode("files").ChildNodes; foreach (XmlElement xe in nodeList) { AssetBundleInfo info = new AssetBundleInfo(); string _fileName = xe.SelectSingleNode("fileName").InnerText; info.assetName = xe.SelectSingleNode("assetName").InnerText; info.bundleName = xe.SelectSingleNode("bundleName").InnerText; XmlNode deps = xe.SelectSingleNode("deps"); if (null != deps) { XmlNodeList depList = deps.ChildNodes; foreach (XmlElement _xe in depList) { info.AddDependence(_xe.InnerText); } } fileMap.Add(_fileName.Substring("Assets/Resources/".Length), info); } }