ManaData.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. using LitJson;
  2. using UnityEngine;
  3. using System;
  4. using System.IO;
  5. using System.Xml;
  6. using System.Text;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System.Security.Cryptography;
  10. public class ManaData
  11. {
  12. #region 变量
  13. public static XmlNode PlayerNode
  14. {
  15. get
  16. {
  17. if (PlayerNode_ == null)
  18. {
  19. PlayerNode_ = PlayerDoc.SelectSingleNode("PlayerConfig");
  20. }
  21. return PlayerNode_;
  22. }
  23. set { PlayerNode_ = value; }
  24. }
  25. public static XmlDocument PlayerDoc
  26. {
  27. get
  28. {
  29. if (PlayerDoc_ == null)
  30. {
  31. int version;
  32. int nativeVersion;
  33. XmlNode node;
  34. XmlDocument nativeDoc = new XmlDocument();
  35. XmlDocument bundleDoc = new XmlDocument();
  36. string configPath = Application.persistentDataPath + "/PlayerConfig.xml";
  37. if (File.Exists(configPath))
  38. {
  39. StreamReader sr = new StreamReader(configPath);
  40. nativeDoc.LoadXml(sr.ReadToEnd());
  41. sr.Close();
  42. Auxiliary.DecryptXml(nativeDoc);
  43. Debug.Log(nativeDoc.OuterXml);
  44. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  45. bundleDoc.LoadXml(textAsset.text);
  46. version = int.Parse(bundleDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
  47. node = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
  48. if (node == null)
  49. {
  50. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  51. sw.Write(bundleDoc.OuterXml);
  52. sw.Close();
  53. PlayerDoc_ = bundleDoc;
  54. }
  55. else
  56. {
  57. nativeVersion = int.Parse(node.Attributes[0].Value);
  58. if (nativeVersion < version)
  59. {
  60. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  61. sw.Write(bundleDoc.OuterXml);
  62. sw.Close();
  63. PlayerDoc_ = bundleDoc;
  64. }
  65. else
  66. {
  67. Debug.Log(nativeDoc.OuterXml);
  68. byte[] bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
  69. MD5 md5 = new MD5CryptoServiceProvider();
  70. if (PlayerPrefs.GetString("config") != Auxiliary.ToString(md5.ComputeHash(bytes)))
  71. {
  72. Debug.LogWarning("Damage");
  73. ManaDebug.Log("Damage");
  74. DamageLock = true;
  75. ManaServer.Download(PlayerPrefs.GetString("id"), RecoveXml);
  76. return null;
  77. }
  78. PlayerDoc_ = nativeDoc;
  79. }
  80. }
  81. }
  82. else
  83. {
  84. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  85. PlayerDoc_ = new XmlDocument();
  86. PlayerDoc_.LoadXml(textAsset.text);
  87. PlayerDoc_.SelectSingleNode("PlayerConfig").SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
  88. }
  89. }
  90. return PlayerDoc_;
  91. }
  92. set { PlayerDoc_ = value; }
  93. }
  94. public static XmlNode PlayerNode_;
  95. public static XmlDocument PlayerDoc_;
  96. public static bool DamageLock;
  97. #endregion
  98. public static void SaveXml()
  99. {
  100. if (Initializer.Complete)
  101. {
  102. byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml);
  103. MD5 md5 = new MD5CryptoServiceProvider();
  104. PlayerPrefs.SetString("id", ManaServer.ID);
  105. PlayerPrefs.SetString("config", Auxiliary.ToString(md5.ComputeHash(bytes)));
  106. Debug.Log(PlayerDoc.OuterXml);
  107. Auxiliary.EncryptXml(PlayerDoc);
  108. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  109. sw.Write(PlayerDoc.OuterXml);
  110. sw.Close();
  111. }
  112. }
  113. public static void RecoveXml(JsonData jsonData)
  114. {
  115. DamageLock = false;
  116. if (jsonData.Inst_Object.Keys.Contains("l"))
  117. {
  118. PlayerDoc_ = new XmlDocument();
  119. PlayerDoc_.LoadXml(jsonData["l"].ToString());
  120. }
  121. else
  122. {
  123. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  124. PlayerDoc_ = new XmlDocument();
  125. PlayerDoc_.LoadXml(textAsset.text);
  126. }
  127. }
  128. public static void SaveSkillList()
  129. {
  130. if (ManaTutorial.TutorialA || !ManaCenter.Complete)
  131. {
  132. return;
  133. }
  134. XmlNode xmlNode;
  135. XmlAttribute xmlAttribute;
  136. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  137. xmlNode.RemoveAll();
  138. for (int i = 0; i < ManaCenter.SkillList.Count; i++)
  139. {
  140. if (ManaCenter.SkillList[i].SkillType == SkillType.Skill)
  141. {
  142. #region Skill
  143. Skill skill = (Skill)ManaCenter.SkillList[i];
  144. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  145. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  146. xmlAttribute.Value = skill.ID;
  147. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  148. xmlAttribute.Value = skill.SkillType.ToString();
  149. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  150. xmlAttribute.Value = skill.ItemStatus.ToString();
  151. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  152. xmlAttribute.Value = skill.Level.ToString();
  153. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
  154. xmlAttribute.Value = skill.CoolTimer.ToString("0");
  155. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
  156. xmlAttribute.Value = skill.UseTimer.ToString("0");
  157. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  158. #endregion
  159. }
  160. else if (ManaCenter.SkillList[i].SkillType == SkillType.Pack)
  161. {
  162. #region Pack
  163. Pack pack = (Pack)ManaCenter.SkillList[i];
  164. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  165. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  166. xmlAttribute.Value = pack.ID;
  167. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  168. xmlAttribute.Value = pack.SkillType.ToString();
  169. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  170. xmlAttribute.Value = pack.ItemStatus.ToString();
  171. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  172. xmlAttribute.Value = pack.Level.ToString();
  173. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  174. #endregion
  175. }
  176. else if (ManaCenter.SkillList[i].SkillType == SkillType.Ability)
  177. {
  178. #region Ability
  179. Ability ability = (Ability)ManaCenter.SkillList[i];
  180. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  181. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  182. xmlAttribute.Value = ability.ID;
  183. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  184. xmlAttribute.Value = ability.SkillType.ToString();
  185. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  186. xmlAttribute.Value = ability.ItemStatus.ToString();
  187. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  188. xmlAttribute.Value = ability.Level.ToString();
  189. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  190. #endregion
  191. }
  192. else if (ManaCenter.SkillList[i].SkillType == SkillType.BigSkill)
  193. {
  194. #region BigSkill
  195. BigSkill bigSkill = (BigSkill)ManaCenter.SkillList[i];
  196. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  197. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  198. xmlAttribute.Value = bigSkill.ID;
  199. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  200. xmlAttribute.Value = bigSkill.SkillType.ToString();
  201. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  202. xmlAttribute.Value = bigSkill.ItemStatus.ToString();
  203. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
  204. xmlAttribute.Value = bigSkill.BarStatus.ToString();
  205. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  206. xmlAttribute.Value = bigSkill.Level.ToString();
  207. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
  208. xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
  209. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
  210. xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
  211. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  212. #endregion
  213. }
  214. }
  215. }
  216. public static void SaveAchieve()
  217. {
  218. XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
  219. xmlNode.Attributes[0].Value = "";
  220. foreach (var kv in ManaAchieve.AchieveDic)
  221. {
  222. if (!kv.Value.Lock)
  223. {
  224. xmlNode.Attributes[0].Value += kv.Value.ID_ + " ";
  225. }
  226. }
  227. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  228. PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaCenter.AdAmt.ToString("0");
  229. PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaCenter.SkillAmt.ToString("0");
  230. PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaCenter.SignAmt.ToString("0");
  231. PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaCenter.ShareAmt.ToString("0");
  232. PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaCenter.ElfLevel.ToString("0");
  233. PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaCenter.MiniGameAmt.ToString("0");
  234. PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaCenter.FlowerCoin.ToString("0");
  235. PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value = ManaCenter.TotalPerson.ToString("0");
  236. }
  237. public static void SavePlantList()
  238. {
  239. if (ManaVisit.InVisit)
  240. {
  241. return;
  242. }
  243. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes;
  244. attribute[0].Value = "";
  245. for (int i = 0; i < ManaGarden.PlantList.Count; i++)
  246. {
  247. Slot slot = ManaGarden.PlantList[i];
  248. attribute[0].Value = slot.ID + "," + slot.Index + " ";
  249. }
  250. attribute[0].Value = attribute[0].Value.TrimEnd(' ');
  251. }
  252. public static void SaveCommon()
  253. {
  254. PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaCenter.Coin.ToString("0");
  255. PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaCenter.Diamond.ToString("0");
  256. PlayerNode.SelectSingleNode("SignTime").Attributes[0].Value = ManaSign.SignTime.ToString();
  257. PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString();
  258. PlayerNode.SelectSingleNode("SignRound").Attributes[0].Value = ManaSign.SignRound.ToString();
  259. PlayerNode.SelectSingleNode("QuitFlag").Attributes[0].Value = ManaServer.Connect.ToInt().ToString();
  260. PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = ManaServer.Time.ToString();
  261. PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaCenter.MiniTimer.ToString("0");
  262. PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaCenter.CircleTimer.ToString("0");
  263. PlayerNode.SelectSingleNode("ID").Attributes[0].Value = ManaServer.ID;
  264. PlayerNode.SelectSingleNode("Player").Attributes[0].Value = ManaPlayer.SelePlayer;
  265. PlayerNode.SelectSingleNode("Language").Attributes[0].Value = ManaLan.CurrentLan.ToString();
  266. PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString();
  267. PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = ManaTutorial.TutorialA.ToInt().ToString();
  268. PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = ManaTutorial.TutorialB_.ToInt().ToString();
  269. PlayerNode.SelectSingleNode("TutorialC").Attributes[0].Value = ManaTutorial.TutorialC_.ToInt().ToString();
  270. PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = ManaTutorial.TutorialIndexA.ToString();
  271. PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = ManaTutorial.TutorialIndexB.ToString();
  272. PlayerNode.SelectSingleNode("TutorialIndexC").Attributes[0].Value = ManaTutorial.TutorialIndexC.ToString();
  273. }
  274. public static void SaveFlowerList()
  275. {
  276. XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
  277. attribute.Value = "";
  278. foreach (var kv in ManaGarden.FlowerInfoDic)
  279. {
  280. if (kv.Value.Unlock)
  281. {
  282. attribute.Value += kv.Value.ID_ + " ";
  283. }
  284. }
  285. attribute.Value = attribute.Value.Trim(' ');
  286. }
  287. public static void SavePlayerConfig()
  288. {
  289. if (Initializer.Complete)
  290. {
  291. ManaVisit.DataReverse();
  292. SaveSkillList();
  293. SaveAchieve();
  294. SavePlantList();
  295. SaveCommon();
  296. SaveFlowerList();
  297. }
  298. }
  299. public static void ResetPlayerConfig()
  300. {
  301. PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "0";
  302. SavePlayerConfig();
  303. ManaCenter.SaveLock = true;
  304. }
  305. public static int GetPlayerInt(string node)
  306. {
  307. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  308. }
  309. public static bool GetPlayerBool(string node)
  310. {
  311. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  312. }
  313. public static float GetPlayerFloat(string node)
  314. {
  315. return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  316. }
  317. public static string GetPlayerString(string node)
  318. {
  319. return PlayerNode.SelectSingleNode(node).Attributes[0].Value;
  320. }
  321. public static double GetPlayerDouble(string node)
  322. {
  323. return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  324. }
  325. public static void SavePlayerInt(string node, int value)
  326. {
  327. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  328. }
  329. public static void SavePlayerBool(string node, bool value)
  330. {
  331. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  332. }
  333. public static void SavePlayerFloat(string node, float value)
  334. {
  335. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  336. }
  337. public static void SavePlayerString(string node, string value)
  338. {
  339. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
  340. }
  341. public static void SavePlayerDouble(string node, double value)
  342. {
  343. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  344. }
  345. public static List<int> GetFlowerList()
  346. {
  347. List<int> list = new List<int>();
  348. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  349. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  350. }
  351. public static List<int> GetAchieveList()
  352. {
  353. return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
  354. }
  355. public static List<string> GetOfflineConfig()
  356. {
  357. TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
  358. XmlDocument xmlDoc = new XmlDocument();
  359. xmlDoc.LoadXml(textAsset.text);
  360. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  361. List<string> strList = new List<string>()
  362. {
  363. xmlNode.Attributes[1].Value,
  364. xmlNode.Attributes[2].Value,
  365. xmlNode.Attributes[3].Value,
  366. };
  367. return strList;
  368. }
  369. public static List<double> GetAchieveData()
  370. {
  371. List<double> dataList = new List<double>();
  372. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value));
  373. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value));
  374. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value));
  375. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value));
  376. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value));
  377. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value));
  378. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value));
  379. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
  380. return dataList;
  381. }
  382. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  383. {
  384. List<KV<int, int>> list = new List<KV<int, int>>();
  385. XmlNode xmlNode;
  386. if (node == null)
  387. {
  388. xmlNode = PlayerNode.SelectSingleNode("PlantList");
  389. }
  390. else
  391. {
  392. xmlNode = node.SelectSingleNode("PlantList");
  393. }
  394. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  395. {
  396. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  397. for (int i = 0; i < strings.Length; i++)
  398. {
  399. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  400. }
  401. }
  402. return list;
  403. }
  404. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  405. {
  406. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  407. XmlNodeList xmlNodeList;
  408. if (node == null)
  409. {
  410. xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
  411. }
  412. else
  413. {
  414. xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
  415. }
  416. for (int i = 0; i < xmlNodeList.Count; i++)
  417. {
  418. attributeList.Add(xmlNodeList[i].Attributes);
  419. }
  420. return attributeList;
  421. }
  422. public static XmlAttributeCollection GetVisitConfig()
  423. {
  424. TextAsset textAsset = ManaReso.Load<TextAsset>("visit_config", Folder.Config);
  425. XmlDocument xmlDoc = new XmlDocument();
  426. xmlDoc.LoadXml(textAsset.text);
  427. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  428. return xmlNode.Attributes;
  429. }
  430. public static XmlAttributeCollection GetAwardConfig()
  431. {
  432. TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
  433. XmlDocument xmlDoc = new XmlDocument();
  434. xmlDoc.LoadXml(textAsset.text);
  435. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  436. return xmlNode.Attributes;
  437. }
  438. public static List<XmlAttributeCollection> GetSkillConfig()
  439. {
  440. TextAsset textAsset;
  441. XmlDocument xmlDoc = new XmlDocument();
  442. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  443. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  444. textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
  445. xmlDoc.LoadXml(textAsset.text);
  446. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  447. textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
  448. xmlDoc.LoadXml(textAsset.text);
  449. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  450. textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
  451. xmlDoc.LoadXml(textAsset.text);
  452. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  453. for (int i = 0; i < xmlNodeList.Count; i++)
  454. {
  455. for (int j = 0; j < xmlNodeList[i].Count; j++)
  456. {
  457. attributeList.Add(xmlNodeList[i][j].Attributes);
  458. }
  459. }
  460. return attributeList;
  461. }
  462. public static List<XmlAttributeCollection> GetSignConfig()
  463. {
  464. TextAsset textAsset;
  465. XmlNodeList xmlNodeList;
  466. XmlDocument xmlDoc = new XmlDocument();
  467. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  468. textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.Config);
  469. xmlDoc.LoadXml(textAsset.text);
  470. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  471. for (int i = 0; i < xmlNodeList.Count; i++)
  472. {
  473. attributeList.Add(xmlNodeList[i].Attributes);
  474. }
  475. return attributeList;
  476. }
  477. public static List<XmlAttributeCollection> GetFlowerConfig()
  478. {
  479. TextAsset textAsset;
  480. XmlNodeList xmlNodeList;
  481. XmlDocument xmlDoc = new XmlDocument();
  482. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  483. textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.Config);
  484. xmlDoc.LoadXml(textAsset.text);
  485. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  486. for (int i = 0; i < xmlNodeList.Count; i++)
  487. {
  488. attributeList.Add(xmlNodeList[i].Attributes);
  489. }
  490. return attributeList;
  491. }
  492. public static List<XmlAttributeCollection> GetAchieveConfig()
  493. {
  494. TextAsset textAsset;
  495. XmlNodeList xmlNodeList;
  496. XmlDocument xmlDoc = new XmlDocument();
  497. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  498. textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.Config);
  499. xmlDoc.LoadXml(textAsset.text);
  500. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  501. for (int i = 0; i < xmlNodeList.Count; i++)
  502. {
  503. attributeList.Add(xmlNodeList[i].Attributes);
  504. }
  505. return attributeList;
  506. }
  507. }