using UnityEngine; using System; using System.IO; using System.Xml; using System.Text; using System.Collections; using System.Collections.Generic; public class Data { #region 变量 public static XmlNode PlayerNode { get { if (_PlayerNode == null) { _PlayerNode = PlayerDoc.SelectSingleNode("PlayerConfig"); } return _PlayerNode; } set { _PlayerNode = value; } } public static XmlDocument PlayerDoc { get { if (_PlayerDoc == null) { int version = 0; int nativeVersion = 0; XmlNode temoNode; XmlDocument tempDoc1; XmlDocument tempDoc2; FileInfo fileInfo = new FileInfo(Application.persistentDataPath + "/PlayerConfig.xml"); if (fileInfo.Exists) { StreamReader sr = new StreamReader(Application.persistentDataPath + "/PlayerConfig.xml"); tempDoc1 = new XmlDocument(); tempDoc1.LoadXml(sr.ReadToEnd()); sr.Close(); TextAsset textAsset = Bundle.Config.LoadAsset("PlayerConfig"); tempDoc2 = new XmlDocument(); tempDoc2.LoadXml(textAsset.text); version = int.Parse(tempDoc2.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value); temoNode = tempDoc1.SelectSingleNode("PlayerConfig").SelectSingleNode("Version"); if (temoNode == null) { StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml"); sw.Write(tempDoc2.OuterXml); sw.Close(); _PlayerDoc = tempDoc2; } else { nativeVersion = int.Parse(temoNode.Attributes[0].Value); if (nativeVersion != version) { StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml"); sw.Write(tempDoc2.OuterXml); sw.Close(); _PlayerDoc = tempDoc2; } else { _PlayerDoc = tempDoc1; } } } else { TextAsset textAsset = Bundle.Config.LoadAsset("PlayerConfig"); tempDoc2 = new XmlDocument(); tempDoc2.LoadXml(textAsset.text); StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml"); sw.Write(tempDoc2.OuterXml); sw.Close(); _PlayerDoc = tempDoc2; _PlayerDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString(); } } return _PlayerDoc; } set { _PlayerDoc = value; } } private static XmlNode _PlayerNode; private static XmlDocument _PlayerDoc; #endregion public static void SaveXml() { StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml"); sw.Write(PlayerDoc.OuterXml); sw.Close(); } private static void SaveSkillList() { XmlNode xmlNode; XmlAttribute xmlAttribute; xmlNode = PlayerNode.SelectSingleNode("SkillList"); xmlNode.RemoveAll(); for (int i = 0; i < ManaData.SkillList.Count; i++) { if (ManaData.SkillList[i].SkillType == SkillType.Skill) { #region Skill Skill skill = (Skill)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = skill.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = skill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = skill.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = skill.Level.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer")); xmlAttribute.Value = skill.CoolTimer.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer")); xmlAttribute.Value = skill.UseTimer.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.Pack) { #region Pack Pack pack = (Pack)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = pack.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = pack.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = pack.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = pack.Level.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.Ability) { #region Ability Ability ability = (Ability)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = ability.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = ability.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = ability.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = ability.Level.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.BigSkill) { #region BigSkill BigSkill bigSkill = (BigSkill)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = bigSkill.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = bigSkill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = bigSkill.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus")); xmlAttribute.Value = bigSkill.BarStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = bigSkill.Level.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer")); xmlAttribute.Value = bigSkill.CoolTimer.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer")); xmlAttribute.Value = bigSkill.UseTimer.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } } } private static void SaveAchieve() { XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList"); xmlNode.Attributes[0].Value = ""; foreach (var kv in ManaAchieve.AchieveDic) { if (!kv.Value.Available) { xmlNode.Attributes[0].Value += kv.Value.ID_ + " "; } } xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' '); PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaData.AD.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaData.Skill.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaData.SignAmt.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaData.Share.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaData.MiniGameAmt.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaData.FlowerCoin.ToString("0"); PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaData.TotalPerson.ToString("0"); } private static void SavePlantList() { XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes; for (int i = 0; i < ManaGarden.PlantList.Count; i++) { Slot slot = ManaGarden.PlantList[i]; attribute[0].Value = slot.ID + "," + slot.name; if (i < ManaGarden.PlantList.Count - 1) { attribute[0].Value += " "; } } } private static void SaveCommon() { PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString(); PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaData.Coin.ToString("0"); PlayerNode.SelectSingleNode("Level").Attributes[0].Value = ManaData.Level.ToString(); PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaData.Diamond.ToString(); PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString(); PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaData.MiniTimer.ToString(); PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaData.CircleTimer.ToString(); PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString(); PlayerNode.SelectSingleNode("Player").Attributes[0].Value = Tutorial.SelectPlayer; } private static void SaveFlowerList() { XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0]; attribute.Value = ""; foreach (var kv in ManaGarden.FlowerInfoDic) { if (kv.Value.Unlock) { attribute.Value += kv.Value.ID_ + " "; } } attribute.Value = attribute.Value.Trim(' '); } public static void SavePlayerConfig() { SaveSkillList(); SaveAchieve(); SavePlantList(); SaveCommon(); SaveFlowerList(); SaveXml(); } private static void ResetSkillList() { XmlNode xmlNode; XmlAttribute xmlAttribute; xmlNode = PlayerNode.SelectSingleNode("SkillList"); xmlNode.RemoveAll(); for (int i = 0; i < ManaData.SkillList.Count; i++) { if (ManaData.SkillList[i].SkillType == SkillType.Skill) { #region Skill Skill skill = (Skill)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = skill.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = skill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = SkillStatus.Lock.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = 0.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer")); xmlAttribute.Value = 0.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer")); xmlAttribute.Value = 0.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.Pack) { #region Pack Pack pack = (Pack)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = pack.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = pack.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = SkillStatus.Lock.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = 0.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.Ability) { #region Ability Ability ability = (Ability)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = ability.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = ability.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = SkillStatus.Lock.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = 0.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } else if (ManaData.SkillList[i].SkillType == SkillType.BigSkill) { #region BigSkill BigSkill bigSkill = (BigSkill)ManaData.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID")); xmlAttribute.Value = bigSkill.ID.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType")); xmlAttribute.Value = bigSkill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus")); xmlAttribute.Value = SkillStatus.Lock.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus")); xmlAttribute.Value = SkillStatus.Buy.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level")); xmlAttribute.Value = 0.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer")); xmlAttribute.Value = 0.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer")); xmlAttribute.Value = 0.ToString(); xmlNode = PlayerNode.SelectSingleNode("SkillList"); #endregion } } } private static void ResetAchieve() { XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList"); xmlNode.Attributes[0].Value = ""; PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = "0"; PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = "0"; } private static void ResetPlantList() { XmlNode xmlNode = PlayerNode.SelectSingleNode("PlantList"); xmlNode.Attributes[0].Value = ""; } private static void ResetCommon() { PlayerNode.SelectSingleNode("Slot").Attributes[0].Value = "1"; PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = "1"; PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("Level").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString(); PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = "10"; PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("Player").Attributes[0].Value = "PlayerBlond"; PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = "0"; PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = "1"; PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = "1"; } private static void ResetFlowerList() { XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0]; attribute.Value = "1"; } public static void ResetPlayerConfig() { ResetSkillList(); ResetAchieve(); ResetPlantList(); ResetCommon(); ResetFlowerList(); SaveXml(); } public static int GetPlayerInt(string node) { return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static bool GetPlayerBool(string node) { return Convert.ToBoolean(int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value)); } public static float GetPlayerFloat(string node) { return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static string GetPlayerString(string node) { return PlayerNode.SelectSingleNode(node).Attributes[0].Value; } public static double GetPlayerDouble(string node) { return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static void SavePlayerInt(string node, int value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); SaveXml(); } public static void SavePlayerBool(string node, bool value) { string str; if (value) { str = "1"; } else { str = "0"; } PlayerNode.SelectSingleNode(node).Attributes[0].Value = str; SaveXml(); } public static void SavePlayerFloat(string node, float value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); SaveXml(); } public static void SavePlayerString(string node, string value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value; SaveXml(); } public static void SavePlayerDouble(string node, double value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); SaveXml(); } public static List GetFlowerList() { List list = new List(); XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes; if (!string.IsNullOrEmpty(attribute[0].Value)) { string[] strings = attribute[0].Value.Split(' '); for (int i = 0; i < strings.Length; i++) { list.Add(int.Parse(strings[i])); } } return list; } public static List GetAchieveList() { return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List()); } public static List GetAchieveData() { List dataList = new List(); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value)); return dataList; } public static List> GetPlantList() { List> list = new List>(); XmlNode xmlNode = PlayerNode.SelectSingleNode("PlantList"); if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value)) { string[] strings = xmlNode.Attributes[0].Value.Split(' '); for (int i = 0; i < strings.Length; i++) { list.Add(new KV(int.Parse(strings[i].Split(',')[0]), strings[i].Split(',')[1])); } } return list; } public static List GetSkillList() { List attributeList = new List(); XmlNodeList xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes; for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static XmlAttributeCollection GetAwardConfig() { TextAsset textAsset; XmlDocument xmlDoc = new XmlDocument(); textAsset = Bundle.Config.LoadAsset("award_config"); xmlDoc.LoadXml(textAsset.text); XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item"); return xmlNode.Attributes; } public static List GetSkillConfig() { TextAsset textAsset; XmlDocument xmlDoc = new XmlDocument(); List xmlNodeLists = new List(); List attributeList = new List(); textAsset = Bundle.Config.LoadAsset("pack_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item")); textAsset = Bundle.Config.LoadAsset("skill_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item")); textAsset = Bundle.Config.LoadAsset("ability_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item")); for (int i = 0; i < xmlNodeLists.Count; i++) { for (int j = 0; j < xmlNodeLists[i].Count; j++) { attributeList.Add(xmlNodeLists[i][j].Attributes); } } return attributeList; } public static List GetSignConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = Bundle.Config.LoadAsset("signin_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item"); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetFlowerConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = Bundle.Config.LoadAsset("flower_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item"); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetAchieveConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = Bundle.Config.LoadAsset("achieve_config"); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item"); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } }