ManaData.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  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 || ManaTutorial.TutorialA)
  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. SaveSkillList();
  300. SaveAchieve();
  301. SavePlantList();
  302. SaveCommon();
  303. SaveFlowerList();
  304. }
  305. }
  306. public static void ResetPlayerConfig()
  307. {
  308. PlayerPrefs.SetString("id", "");
  309. PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "0";
  310. SavePlayerConfig();
  311. ManaCenter.SaveLock = true;
  312. }
  313. public static int GetPlayerInt(string node)
  314. {
  315. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  316. }
  317. public static bool GetPlayerBool(string node)
  318. {
  319. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  320. }
  321. public static float GetPlayerFloat(string node)
  322. {
  323. return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  324. }
  325. public static string GetPlayerString(string node)
  326. {
  327. return PlayerNode.SelectSingleNode(node).Attributes[0].Value;
  328. }
  329. public static double GetPlayerDouble(string node)
  330. {
  331. return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  332. }
  333. public static void SavePlayerInt(string node, int value)
  334. {
  335. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  336. }
  337. public static void SavePlayerBool(string node, bool value)
  338. {
  339. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  340. }
  341. public static void SavePlayerFloat(string node, float value)
  342. {
  343. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  344. }
  345. public static void SavePlayerString(string node, string value)
  346. {
  347. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
  348. }
  349. public static void SavePlayerDouble(string node, double value)
  350. {
  351. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  352. }
  353. public static List<int> GetFlowerList()
  354. {
  355. List<int> list = new List<int>();
  356. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  357. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  358. }
  359. public static List<int> GetAchieveList()
  360. {
  361. return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
  362. }
  363. public static List<string> GetOfflineConfig()
  364. {
  365. TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
  366. XmlDocument xmlDoc = new XmlDocument();
  367. xmlDoc.LoadXml(textAsset.text);
  368. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  369. List<string> strList = new List<string>()
  370. {
  371. xmlNode.Attributes[1].Value,
  372. xmlNode.Attributes[2].Value,
  373. xmlNode.Attributes[3].Value,
  374. };
  375. return strList;
  376. }
  377. public static List<double> GetAchieveData()
  378. {
  379. List<double> dataList = new List<double>();
  380. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value));
  381. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value));
  382. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value));
  383. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value));
  384. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value));
  385. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value));
  386. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value));
  387. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
  388. return dataList;
  389. }
  390. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  391. {
  392. List<KV<int, int>> list = new List<KV<int, int>>();
  393. XmlNode xmlNode;
  394. if (node == null)
  395. {
  396. xmlNode = PlayerNode.SelectSingleNode("PlantList");
  397. }
  398. else
  399. {
  400. xmlNode = node.SelectSingleNode("PlantList");
  401. }
  402. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  403. {
  404. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  405. for (int i = 0; i < strings.Length; i++)
  406. {
  407. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  408. }
  409. }
  410. return list;
  411. }
  412. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  413. {
  414. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  415. XmlNodeList xmlNodeList;
  416. if (node == null)
  417. {
  418. xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
  419. }
  420. else
  421. {
  422. xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
  423. }
  424. for (int i = 0; i < xmlNodeList.Count; i++)
  425. {
  426. attributeList.Add(xmlNodeList[i].Attributes);
  427. }
  428. return attributeList;
  429. }
  430. public static XmlAttributeCollection GetVisitConfig()
  431. {
  432. TextAsset textAsset = ManaReso.Load<TextAsset>("visit_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 XmlAttributeCollection GetAwardConfig()
  439. {
  440. TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
  441. XmlDocument xmlDoc = new XmlDocument();
  442. xmlDoc.LoadXml(textAsset.text);
  443. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  444. return xmlNode.Attributes;
  445. }
  446. public static List<XmlAttributeCollection> GetSkillConfig()
  447. {
  448. TextAsset textAsset;
  449. XmlDocument xmlDoc = new XmlDocument();
  450. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  451. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  452. textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
  453. xmlDoc.LoadXml(textAsset.text);
  454. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  455. textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
  456. xmlDoc.LoadXml(textAsset.text);
  457. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  458. textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
  459. xmlDoc.LoadXml(textAsset.text);
  460. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  461. for (int i = 0; i < xmlNodeList.Count; i++)
  462. {
  463. for (int j = 0; j < xmlNodeList[i].Count; j++)
  464. {
  465. attributeList.Add(xmlNodeList[i][j].Attributes);
  466. }
  467. }
  468. return attributeList;
  469. }
  470. public static List<XmlAttributeCollection> GetSignConfig()
  471. {
  472. TextAsset textAsset;
  473. XmlNodeList xmlNodeList;
  474. XmlDocument xmlDoc = new XmlDocument();
  475. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  476. textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.Config);
  477. xmlDoc.LoadXml(textAsset.text);
  478. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  479. for (int i = 0; i < xmlNodeList.Count; i++)
  480. {
  481. attributeList.Add(xmlNodeList[i].Attributes);
  482. }
  483. return attributeList;
  484. }
  485. public static List<XmlAttributeCollection> GetFlowerConfig()
  486. {
  487. TextAsset textAsset;
  488. XmlNodeList xmlNodeList;
  489. XmlDocument xmlDoc = new XmlDocument();
  490. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  491. textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.Config);
  492. xmlDoc.LoadXml(textAsset.text);
  493. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  494. for (int i = 0; i < xmlNodeList.Count; i++)
  495. {
  496. attributeList.Add(xmlNodeList[i].Attributes);
  497. }
  498. return attributeList;
  499. }
  500. public static List<XmlAttributeCollection> GetAchieveConfig()
  501. {
  502. TextAsset textAsset;
  503. XmlNodeList xmlNodeList;
  504. XmlDocument xmlDoc = new XmlDocument();
  505. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  506. textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.Config);
  507. xmlDoc.LoadXml(textAsset.text);
  508. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  509. for (int i = 0; i < xmlNodeList.Count; i++)
  510. {
  511. attributeList.Add(xmlNodeList[i].Attributes);
  512. }
  513. return attributeList;
  514. }
  515. }