Data.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. using UnityEngine;
  2. using System;
  3. using System.IO;
  4. using System.Xml;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. public class Data
  9. {
  10. #region
  11. public static XmlNode PlayerNode
  12. {
  13. get
  14. {
  15. if (_PlayerNode == null)
  16. {
  17. _PlayerNode = PlayerDoc.SelectSingleNode("PlayerConfig");
  18. }
  19. return _PlayerNode;
  20. }
  21. set { _PlayerNode = value; }
  22. }
  23. public static XmlDocument PlayerDoc
  24. {
  25. get
  26. {
  27. if (_PlayerDoc == null)
  28. {
  29. int version = 0;
  30. int nativeVersion = 0;
  31. XmlNode temoNode;
  32. XmlDocument tempDoc1;
  33. XmlDocument tempDoc2;
  34. FileInfo fileInfo = new FileInfo(Application.persistentDataPath + "/PlayerConfig.xml");
  35. if (fileInfo.Exists)
  36. {
  37. StreamReader sr = new StreamReader(Application.persistentDataPath + "/PlayerConfig.xml");
  38. tempDoc1 = new XmlDocument();
  39. tempDoc1.LoadXml(sr.ReadToEnd());
  40. sr.Close();
  41. TextAsset textAsset = Bundle.Config.LoadAsset<TextAsset>("PlayerConfig");
  42. tempDoc2 = new XmlDocument();
  43. tempDoc2.LoadXml(textAsset.text);
  44. version = int.Parse(tempDoc2.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
  45. temoNode = tempDoc1.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
  46. if (temoNode == null)
  47. {
  48. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  49. sw.Write(tempDoc2.OuterXml);
  50. sw.Close();
  51. _PlayerDoc = tempDoc2;
  52. }
  53. else
  54. {
  55. nativeVersion = int.Parse(temoNode.Attributes[0].Value);
  56. if (nativeVersion != version)
  57. {
  58. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  59. sw.Write(tempDoc2.OuterXml);
  60. sw.Close();
  61. _PlayerDoc = tempDoc2;
  62. }
  63. else
  64. {
  65. _PlayerDoc = tempDoc1;
  66. }
  67. }
  68. }
  69. else
  70. {
  71. TextAsset textAsset = Bundle.Config.LoadAsset<TextAsset>("PlayerConfig");
  72. tempDoc2 = new XmlDocument();
  73. tempDoc2.LoadXml(textAsset.text);
  74. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  75. sw.Write(tempDoc2.OuterXml);
  76. sw.Close();
  77. _PlayerDoc = tempDoc2;
  78. _PlayerDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
  79. }
  80. }
  81. return _PlayerDoc;
  82. }
  83. set { _PlayerDoc = value; }
  84. }
  85. private static XmlNode _PlayerNode;
  86. private static XmlDocument _PlayerDoc;
  87. #endregion
  88. private static void SaveSkillList()
  89. {
  90. XmlNode xmlNode;
  91. XmlAttribute xmlAttribute;
  92. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  93. xmlNode.RemoveAll();
  94. for (int i = 0; i < ManaData.SkillList.Count; i++)
  95. {
  96. if (ManaData.SkillList[i].SkillType == SkillType.Skill)
  97. {
  98. #region Skill
  99. Skill skill = (Skill)ManaData.SkillList[i];
  100. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, skill._Name, ""));
  101. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  102. xmlAttribute.Value = skill.SkillType.ToString();
  103. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  104. xmlAttribute.Value = skill.ItemStatus.ToString();
  105. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  106. xmlAttribute.Value = skill.Level.ToString();
  107. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
  108. xmlAttribute.Value = skill.CoolTimer.ToString();
  109. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
  110. xmlAttribute.Value = skill.UseTimer.ToString();
  111. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  112. #endregion
  113. }
  114. else if (ManaData.SkillList[i].SkillType == SkillType.Pack)
  115. {
  116. #region Pack
  117. Pack pack = (Pack)ManaData.SkillList[i];
  118. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "礼包", ""));
  119. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  120. xmlAttribute.Value = pack.SkillType.ToString();
  121. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Name"));
  122. xmlAttribute.Value = pack._Name;
  123. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  124. xmlAttribute.Value = pack.ItemStatus.ToString();
  125. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  126. xmlAttribute.Value = pack.Level.ToString();
  127. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  128. #endregion
  129. }
  130. else if (ManaData.SkillList[i].SkillType == SkillType.Ability)
  131. {
  132. #region Ability
  133. Ability ability = (Ability)ManaData.SkillList[i];
  134. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ability._Name, ""));
  135. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  136. xmlAttribute.Value = ability.SkillType.ToString();
  137. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  138. xmlAttribute.Value = ability.ItemStatus.ToString();
  139. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  140. xmlAttribute.Value = ability.Level.ToString();
  141. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  142. #endregion
  143. }
  144. else if (ManaData.SkillList[i].SkillType == SkillType.BigSkill)
  145. {
  146. #region BigSkill
  147. BigSkill bigSkill = (BigSkill)ManaData.SkillList[i];
  148. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, bigSkill._Name, ""));
  149. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  150. xmlAttribute.Value = bigSkill.SkillType.ToString();
  151. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  152. xmlAttribute.Value = bigSkill.ItemStatus.ToString();
  153. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
  154. xmlAttribute.Value = bigSkill.BarStatus.ToString();
  155. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  156. xmlAttribute.Value = bigSkill.Level.ToString();
  157. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
  158. xmlAttribute.Value = bigSkill.CoolTimer.ToString();
  159. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
  160. xmlAttribute.Value = bigSkill.UseTimer.ToString();
  161. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  162. #endregion
  163. }
  164. }
  165. }
  166. private static void SaveAchieve()
  167. {
  168. XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
  169. xmlNode.InnerText = "";
  170. foreach (var kv in ManaAchieve.AchieveDic)
  171. {
  172. if (kv.Value.Valid == false)
  173. {
  174. xmlNode.InnerText += kv.Value.ID + " ";
  175. }
  176. }
  177. xmlNode.InnerText = xmlNode.InnerText.TrimEnd(' ');
  178. PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaData.AD.ToString("0");
  179. PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaData.Skill.ToString("0");
  180. PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaData.Sign.ToString("0");
  181. PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaData.Share.ToString("0");
  182. PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaData.MiniGame.ToString("0");
  183. PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaData.FlowerCoin.ToString("0");
  184. }
  185. private static void SavePlantList()
  186. {
  187. XmlAttributeCollection attributes = PlayerNode.SelectSingleNode("PlantList").Attributes;
  188. attributes.RemoveAll();
  189. for (int i = 0; i < ManaGarden.PlantList.Count; i++)
  190. {
  191. attributes.Append(PlayerDoc.CreateAttribute(ManaGarden.PlantList[i].name));
  192. attributes[i].Value = (ManaGarden.PlantList[i].Flower.FlowerInfo.Id - 1).ToString();
  193. }
  194. }
  195. private static void SaveCommon()
  196. {
  197. PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaData.SignIndex.ToString();
  198. PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaData.Coin.ToString("0");
  199. PlayerNode.SelectSingleNode("Level").Attributes[0].Value = ManaData.Level.ToString();
  200. PlayerNode.SelectSingleNode("Person").Attributes[0].Value = ManaData.Person.ToString();
  201. PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaData.Diamond.ToString();
  202. PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
  203. PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = ManaData.CoinPerson.ToString();
  204. PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaData.MiniTimer.ToString();
  205. PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaData.CircleTimer.ToString();
  206. PlayerNode.SelectSingleNode("MiniGameAmt").Attributes[0].Value = ManaMiniGame.MiniGameAmt.ToString();
  207. PlayerNode.SelectSingleNode("Player").Attributes[0].Value = Tutorial.SelectPlayer;
  208. }
  209. private static void SaveFlowerList()
  210. {
  211. XmlAttributeCollection attributes = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  212. attributes[0].RemoveAll();
  213. XmlAttribute xmlAttribute = attributes.Append(PlayerDoc.CreateAttribute("ID"));
  214. for (int i = 0; i < ManaGarden.FlowerInfoList.Count; i++)
  215. {
  216. if (ManaGarden.FlowerInfoList[i].Unlock)
  217. {
  218. xmlAttribute.Value += ManaGarden.FlowerInfoList[i].Id - 1 + " ";
  219. }
  220. }
  221. xmlAttribute.Value = xmlAttribute.Value.Trim(' ');
  222. }
  223. public static void SavePlayerConfig()
  224. {
  225. SaveSkillList();
  226. SaveAchieve();
  227. SavePlantList();
  228. SaveCommon();
  229. SaveFlowerList();
  230. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  231. sw.Write(PlayerDoc.OuterXml);
  232. sw.Close();
  233. }
  234. private static void ResetSkillList()
  235. {
  236. XmlNode xmlNode;
  237. XmlAttribute xmlAttribute;
  238. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  239. xmlNode.RemoveAll();
  240. for (int i = 0; i < ManaData.SkillList.Count; i++)
  241. {
  242. if (ManaData.SkillList[i].SkillType == SkillType.Skill)
  243. {
  244. #region Skill
  245. Skill skill = (Skill)ManaData.SkillList[i];
  246. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, skill._Name, ""));
  247. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  248. xmlAttribute.Value = skill.SkillType.ToString();
  249. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  250. xmlAttribute.Value = SkillStatus.Lock.ToString();
  251. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  252. xmlAttribute.Value = 0.ToString();
  253. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
  254. xmlAttribute.Value = 0.ToString();
  255. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
  256. xmlAttribute.Value = 0.ToString();
  257. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  258. #endregion
  259. }
  260. else if (ManaData.SkillList[i].SkillType == SkillType.Pack)
  261. {
  262. #region Pack
  263. Pack pack = (Pack)ManaData.SkillList[i];
  264. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "礼包", ""));
  265. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  266. xmlAttribute.Value = pack.SkillType.ToString();
  267. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Name"));
  268. xmlAttribute.Value = pack._Name;
  269. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  270. xmlAttribute.Value = SkillStatus.Lock.ToString();
  271. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  272. xmlAttribute.Value = 0.ToString();
  273. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  274. #endregion
  275. }
  276. else if (ManaData.SkillList[i].SkillType == SkillType.Ability)
  277. {
  278. #region Ability
  279. Ability ability = (Ability)ManaData.SkillList[i];
  280. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ability._Name, ""));
  281. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  282. xmlAttribute.Value = ability.SkillType.ToString();
  283. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  284. xmlAttribute.Value = SkillStatus.Lock.ToString();
  285. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  286. xmlAttribute.Value = 0.ToString();
  287. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  288. #endregion
  289. }
  290. else if (ManaData.SkillList[i].SkillType == SkillType.BigSkill)
  291. {
  292. #region BigSkill
  293. BigSkill bigSkill = (BigSkill)ManaData.SkillList[i];
  294. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, bigSkill._Name, ""));
  295. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  296. xmlAttribute.Value = bigSkill.SkillType.ToString();
  297. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  298. xmlAttribute.Value = SkillStatus.Lock.ToString();
  299. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
  300. xmlAttribute.Value = SkillStatus.Buy.ToString();
  301. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  302. xmlAttribute.Value = 0.ToString();
  303. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
  304. xmlAttribute.Value = 0.ToString();
  305. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
  306. xmlAttribute.Value = 0.ToString();
  307. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  308. #endregion
  309. }
  310. }
  311. }
  312. private static void ResetAchieve()
  313. {
  314. XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
  315. xmlNode.InnerText = "";
  316. PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = "0";
  317. PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = "0";
  318. PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = "0";
  319. PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = "0";
  320. PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = "0";
  321. PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = "0";
  322. }
  323. private static void ResetPlantList()
  324. {
  325. XmlNode xmlNode = PlayerNode.SelectSingleNode("PlantList");
  326. xmlNode.RemoveAll();
  327. XmlAttribute xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA1"));
  328. xmlAttribute.Value = 0.ToString();
  329. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA2"));
  330. xmlAttribute.Value = 1.ToString();
  331. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA3"));
  332. xmlAttribute.Value = 2.ToString();
  333. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA4"));
  334. xmlAttribute.Value = 3.ToString();
  335. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA5"));
  336. xmlAttribute.Value = 4.ToString();
  337. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA6"));
  338. xmlAttribute.Value = 5.ToString();
  339. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SlotA7"));
  340. xmlAttribute.Value = 6.ToString();
  341. }
  342. private static void ResetCommon()
  343. {
  344. PlayerNode.SelectSingleNode("Slot").Attributes[0].Value = "7";
  345. PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = "0";
  346. PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = "0";
  347. PlayerNode.SelectSingleNode("Level").Attributes[0].Value = "0";
  348. PlayerNode.SelectSingleNode("Person").Attributes[0].Value = "0";
  349. PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = "0";
  350. PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
  351. PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = "0";
  352. PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = "0";
  353. PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = "10";
  354. PlayerNode.SelectSingleNode("MiniGameAmt").Attributes[0].Value = "0";
  355. PlayerNode.SelectSingleNode("Player").Attributes[0].Value = "PlayerBlond";
  356. }
  357. private static void ResetFlowerList()
  358. {
  359. XmlAttributeCollection attributes = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  360. attributes[0].RemoveAll();
  361. XmlAttribute xmlAttribute = attributes.Append(PlayerDoc.CreateAttribute("ID"));
  362. xmlAttribute.Value = "0 1 2 3 4 5 6 7 8 9";
  363. }
  364. public static void ResetPlayerConfig()
  365. {
  366. ResetSkillList();
  367. ResetAchieve();
  368. ResetPlantList();
  369. ResetCommon();
  370. ResetFlowerList();
  371. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  372. sw.Write(PlayerDoc.OuterXml);
  373. sw.Close();
  374. }
  375. public static XmlAttributeCollection GetAwardConfig()
  376. {
  377. TextAsset textAsset;
  378. XmlDocument xmlDoc = new XmlDocument();
  379. textAsset = Bundle.Config.LoadAsset<TextAsset>("award_config");
  380. xmlDoc.LoadXml(textAsset.text);
  381. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  382. return xmlNode.Attributes;
  383. }
  384. public static List<XmlAttributeCollection> GetSkillConfig()
  385. {
  386. TextAsset textAsset;
  387. XmlDocument xmlDoc = new XmlDocument();
  388. List<XmlNodeList> xmlNodeLists = new List<XmlNodeList>();
  389. List<XmlAttributeCollection> attributesList = new List<XmlAttributeCollection>();
  390. textAsset = Bundle.Config.LoadAsset<TextAsset>("pack_config");
  391. xmlDoc.LoadXml(textAsset.text);
  392. xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  393. textAsset = Bundle.Config.LoadAsset<TextAsset>("skill_config");
  394. xmlDoc.LoadXml(textAsset.text);
  395. xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  396. textAsset = Bundle.Config.LoadAsset<TextAsset>("ability_config");
  397. xmlDoc.LoadXml(textAsset.text);
  398. xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  399. for (int i = 0; i < xmlNodeLists.Count; i++)
  400. {
  401. for (int j = 0; j < xmlNodeLists[i].Count; j++)
  402. {
  403. attributesList.Add(xmlNodeLists[i][j].Attributes);
  404. }
  405. }
  406. return attributesList;
  407. }
  408. public static List<XmlAttributeCollection> GetSignConfig()
  409. {
  410. TextAsset textAsset;
  411. XmlNodeList xmlNodeList;
  412. XmlDocument xmlDoc = new XmlDocument();
  413. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  414. textAsset = Bundle.Config.LoadAsset<TextAsset>("signin_config");
  415. xmlDoc.LoadXml(textAsset.text);
  416. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  417. for (int i = 0; i < xmlNodeList.Count; i++)
  418. {
  419. attributeList.Add(xmlNodeList[i].Attributes);
  420. }
  421. return attributeList;
  422. }
  423. public static List<XmlAttributeCollection> GetFlowerConfig()
  424. {
  425. TextAsset textAsset;
  426. XmlNodeList xmlNodeList;
  427. XmlDocument xmlDoc = new XmlDocument();
  428. List<XmlAttributeCollection> attributesList = new List<XmlAttributeCollection>();
  429. textAsset = Bundle.Config.LoadAsset<TextAsset>("flower_config");
  430. xmlDoc.LoadXml(textAsset.text);
  431. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  432. for (int i = 0; i < xmlNodeList.Count; i++)
  433. {
  434. attributesList.Add(xmlNodeList[i].Attributes);
  435. }
  436. return attributesList;
  437. }
  438. public static List<XmlAttributeCollection> GetAchieveConfig()
  439. {
  440. TextAsset textAsset;
  441. XmlNodeList xmlNodeList;
  442. XmlDocument xmlDoc = new XmlDocument();
  443. List<XmlAttributeCollection> attributesList = new List<XmlAttributeCollection>();
  444. textAsset = Bundle.Config.LoadAsset<TextAsset>("achieve_config");
  445. xmlDoc.LoadXml(textAsset.text);
  446. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  447. for (int i = 0; i < xmlNodeList.Count; i++)
  448. {
  449. attributesList.Add(xmlNodeList[i].Attributes);
  450. }
  451. return attributesList;
  452. }
  453. }