ManaData.cs 25 KB

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