ManaData.cs 24 KB

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