123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715 |
- using LitJson;
- using UnityEngine;
- using System;
- using System.IO;
- using System.Xml;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using System.Security.Cryptography;
- public class ManaData
- {
- #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;
- int nativeVersion;
- XmlNode node;
- XmlDocument nativeDoc = new XmlDocument();
- string configPath = Application.persistentDataPath + "/PlayerConfig.xml";
- if (File.Exists(configPath))
- {
- StreamReader sr = new StreamReader(configPath);
-
- nativeDoc.LoadXml(sr.ReadToEnd());
- sr.Close();
-
- Auxiliary.DecryptXml(nativeDoc);
-
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- DefaultDoc.LoadXml(textAsset.text);
-
- version = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
-
- node = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
- if (node == null)
- {
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(DefaultDoc.OuterXml);
- sw.Close();
- PlayerDoc_ = DefaultDoc;
- }
- else
- {
- nativeVersion = int.Parse(node.Attributes[0].Value);
-
- if (nativeVersion < version)
- {
- PlayerDoc_ = DefaultDoc;
- }
- else
- {
- byte[] bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
- MD5 md5 = new MD5CryptoServiceProvider();
- if (PlayerPrefs.GetString("config") != Auxiliary.ToString(md5.ComputeHash(bytes)))
- {
- Debug.LogWarning("Damage");
- ManaDebug.Log("Damage");
- DamageLock = true;
- ManaServer.Download(PlayerPrefs.GetString("id"), RecoveXml);
- return null;
- }
-
- PlayerDoc_ = nativeDoc;
- }
- }
- }
- else
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- DefaultDoc.LoadXml(textAsset.text);
- if (!string.IsNullOrEmpty(PlayerPrefs.GetString("id")))
- {
- Debug.LogWarning("Damage");
- ManaDebug.Log("Damage");
- DamageLock = true;
- ManaServer.Download(PlayerPrefs.GetString("id"), RecoveXml);
- return null;
- }
- else
- {
- PlayerDoc_ = DefaultDoc;
- }
- }
- }
- return PlayerDoc_;
- }
- set { PlayerDoc_ = value; }
- }
- public static XmlNode PlayerNode_;
- public static XmlDocument PlayerDoc_;
- public static bool DamageLock;
- public static XmlDocument DefaultDoc = new XmlDocument();
- #endregion
- public static void SaveXml()
- {
- if (Initializer.Complete)
- {
- byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml);
- MD5 md5 = new MD5CryptoServiceProvider();
- PlayerPrefs.SetString("id", ManaServer.ID);
- PlayerPrefs.SetString("config", Auxiliary.ToString(md5.ComputeHash(bytes)));
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(PlayerDoc.OuterXml);
- Auxiliary.EncryptXml(doc);
-
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
-
- sw.Write(doc.OuterXml);
- sw.Close();
- }
- }
- public static void RecoveXml(JsonData jsonData)
- {
- DamageLock = false;
- if (jsonData.Inst_Object.Keys.Contains("l"))
- {
- PlayerDoc_ = new XmlDocument();
- PlayerDoc_.LoadXml(jsonData["l"].ToString());
-
- SavePlayerInt("Version", int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value));
- }
- else
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- PlayerDoc_ = new XmlDocument();
- PlayerDoc_.LoadXml(textAsset.text);
- }
- }
- public static void SaveSkillList()
- {
- if (ManaTutorial.TutorialA || !ManaCenter.Complete)
- {
- return;
- }
-
- XmlNode xmlNode;
- XmlAttribute xmlAttribute;
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- xmlNode.RemoveAll();
- for (int i = 0; i < ManaCenter.SkillList.Count; i++)
- {
- if (ManaCenter.SkillList[i].SkillType == SkillType.Skill)
- {
- #region Skill
- Skill skill = (Skill)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = skill.ID;
- 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("CoolTimer"));
- xmlAttribute.Value = skill.CoolTimer.ToString("0");
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
- xmlAttribute.Value = skill.UseTimer.ToString("0");
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaCenter.SkillList[i].SkillType == SkillType.Pack)
- {
- #region Pack
- Pack pack = (Pack)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = pack.ID;
- 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 (ManaCenter.SkillList[i].SkillType == SkillType.Ability)
- {
- #region Ability
- Ability ability = (Ability)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = ability.ID;
- 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 (ManaCenter.SkillList[i].SkillType == SkillType.BigSkill)
- {
- #region BigSkill
- BigSkill bigSkill = (BigSkill)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = bigSkill.ID;
- 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("CoolTimer"));
- xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
- xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- }
- }
- public static void SaveAchieve()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
- xmlNode.Attributes[0].Value = "";
- foreach (var kv in ManaAchieve.AchieveDic)
- {
- if (!kv.Value.Lock)
- {
- xmlNode.Attributes[0].Value += kv.Value.ID_ + " ";
- }
- }
- xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
- PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaCenter.AdAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaCenter.SkillAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaCenter.SignAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaCenter.ShareAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaCenter.ElfLevel.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaCenter.MiniGameAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaCenter.FlowerCoin.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value = ManaCenter.TotalPerson.ToString("0");
- }
- public static void SavePlantList()
- {
- if (ManaVisit.InVisit || ManaTutorial.TutorialA)
- {
- return;
- }
-
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes;
- attribute[0].Value = "";
- for (int i = 0; i < ManaGarden.PlantList.Count; i++)
- {
- Slot slot = ManaGarden.PlantList[i];
-
- attribute[0].Value += slot.ID + "," + slot.Index + " ";
- }
- attribute[0].Value = attribute[0].Value.TrimEnd(' ');
- }
- public static void SaveCommon()
- {
- PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaCenter.Coin.ToString("0");
- PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaCenter.Diamond.ToString("0");
-
- PlayerNode.SelectSingleNode("SignTime").Attributes[0].Value = ManaSign.SignTime.ToString();
- PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString();
- PlayerNode.SelectSingleNode("SignRound").Attributes[0].Value = ManaSign.SignRound.ToString();
-
- PlayerNode.SelectSingleNode("QuitFlag").Attributes[0].Value = ManaServer.Connect.ToInt().ToString();
- PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = ManaServer.Time.ToString();
- PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaCenter.MiniTimer.ToString("0");
- PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaCenter.CircleTimer.ToString("0");
- PlayerNode.SelectSingleNode("ID").Attributes[0].Value = ManaServer.ID;
- PlayerNode.SelectSingleNode("Player").Attributes[0].Value = ManaPlayer.SelePlayer;
- PlayerNode.SelectSingleNode("Language").Attributes[0].Value = ManaLan.CurrentLan.ToString();
- PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString();
- PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = ManaTutorial.TutorialA.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = ManaTutorial.TutorialB_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialC").Attributes[0].Value = ManaTutorial.TutorialC_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = ManaTutorial.TutorialIndexA.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = ManaTutorial.TutorialIndexB.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexC").Attributes[0].Value = ManaTutorial.TutorialIndexC.ToString();
- }
- public 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()
- {
- if (Initializer.Complete)
- {
- SaveSkillList();
- SaveAchieve();
- SavePlantList();
- SaveCommon();
- SaveFlowerList();
- }
- }
- public static void ResetPlayerConfig()
- {
- PlayerPrefs.SetString("id", "");
- PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "0";
- SavePlayerConfig();
- ManaCenter.SaveLock = true;
- }
- public static int GetPlayerInt(string node)
- {
- return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
- }
- public static bool GetPlayerBool(string node)
- {
- return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
- }
- 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();
- }
- public static void SavePlayerBool(string node, bool value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
- }
- public static void SavePlayerFloat(string node, float value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
- }
- public static void SavePlayerString(string node, string value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
- }
- public static void SavePlayerDouble(string node, double value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
- }
- public static List<int> GetFlowerList()
- {
- List<int> list = new List<int>();
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
- return Auxiliary.IntListParse(' ', attribute[0].Value, list);
- }
- public static List<int> GetAchieveList()
- {
- return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
- }
- public static List<string> GetOfflineConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- List<string> strList = new List<string>()
- {
- xmlNode.Attributes[1].Value,
- xmlNode.Attributes[2].Value,
- xmlNode.Attributes[3].Value,
- };
- return strList;
- }
- public static List<double> GetAchieveData()
- {
- List<double> dataList = new List<double>();
- 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));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
- return dataList;
- }
- public static List<KV<int, int>> GetPlantList(XmlNode node = null)
- {
- List<KV<int, int>> list = new List<KV<int, int>>();
- XmlNode xmlNode;
- if (node == null)
- {
- xmlNode = PlayerNode.SelectSingleNode("PlantList");
- }
- else
- {
- xmlNode = node.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, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
- }
- }
- return list;
- }
- public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
- {
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- XmlNodeList xmlNodeList;
- if (node == null)
- {
- xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
- }
- else
- {
- xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
- }
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static XmlAttributeCollection GetVisitConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("visit_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static XmlAttributeCollection GetAwardConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static List<XmlAttributeCollection> GetSkillConfig()
- {
- TextAsset textAsset;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- for (int j = 0; j < xmlNodeList[i].Count; j++)
- {
- attributeList.Add(xmlNodeList[i][j].Attributes);
- }
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetSignConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.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<XmlAttributeCollection> GetFlowerConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.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<XmlAttributeCollection> GetAchieveConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.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;
- }
- }
|