ManaData.cs 24 KB

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