ManaData.cs 25 KB

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