ManaData.cs 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317
  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.Linq;
  10. using System.Security.Cryptography;
  11. using Sfs2X.Entities;
  12. using Sfs2X.Entities.Data;
  13. using Random = UnityEngine.Random;
  14. public class ManaData : Regist
  15. {
  16. #region 变量
  17. public static XmlNode PlayerNode
  18. {
  19. get
  20. {
  21. if (PlayerNode_ == null)
  22. {
  23. PlayerNode_ = PlayerDoc.SelectSingleNode("PlayerConfig");
  24. }
  25. return PlayerNode_;
  26. }
  27. set { PlayerNode_ = value; }
  28. }
  29. public static XmlDocument PlayerDoc
  30. {
  31. get
  32. {
  33. if (PlayerDoc_ == null)
  34. {
  35. int defaultVersion;
  36. int nativeVersion;
  37. XmlNode node;
  38. XmlDocument nativeDoc = new XmlDocument();
  39. string configPath = Application.persistentDataPath + "/PlayerConfig.xml";
  40. if (File.Exists(configPath))
  41. {
  42. try
  43. {
  44. StreamReader sr = new StreamReader(configPath);
  45. nativeDoc.LoadXml(sr.ReadToEnd());
  46. sr.Close();
  47. Auxiliary.DecryptXml(nativeDoc);
  48. }
  49. catch (Exception)
  50. {
  51. Debug.LogWarning("Download Archive : MD5 doesn't match");
  52. ManaDebug.Log("Download Archive");
  53. DamageLock = true;
  54. DownloadLock = false;
  55. return null;
  56. }
  57. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  58. DefaultDoc.LoadXml(textAsset.text);
  59. defaultVersion = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
  60. node = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
  61. if (node == null)
  62. {
  63. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  64. sw.Write(DefaultDoc.OuterXml);
  65. sw.Close();
  66. PlayerDoc_ = DefaultDoc;
  67. }
  68. else
  69. {
  70. nativeVersion = int.Parse(node.Attributes[0].Value);
  71. if (nativeVersion < defaultVersion)
  72. {
  73. byte[] bytes;
  74. MD5 md5 = new MD5CryptoServiceProvider();
  75. if (nativeVersion <= 4)
  76. {
  77. bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
  78. }
  79. else
  80. {
  81. bytes = File.ReadAllBytes(configPath);
  82. }
  83. if (PlayerPrefs.GetString("config") != Auxiliary.ToString(md5.ComputeHash(bytes)))
  84. {
  85. Debug.LogWarning("Download Archive : MD5 doesn't match");
  86. ManaDebug.Log("Download Archive");
  87. DamageLock = true;
  88. DownloadLock = false;
  89. return null;
  90. }
  91. else
  92. {
  93. PlayerDoc_ = MergeXML(nativeVersion, nativeDoc, DefaultDoc);
  94. ManaServer.Save();
  95. }
  96. }
  97. else if (nativeVersion > defaultVersion)
  98. {
  99. PlayerDoc_ = DefaultDoc;
  100. }
  101. else
  102. {
  103. byte[] bytes = File.ReadAllBytes(configPath);
  104. MD5 md5 = new MD5CryptoServiceProvider();
  105. if (PlayerPrefs.GetString("config") != Auxiliary.ToString(md5.ComputeHash(bytes)))
  106. {
  107. Debug.LogWarning("Download Archive : MD5 doesn't match");
  108. ManaDebug.Log("Download Archive");
  109. DamageLock = true;
  110. DownloadLock = false;
  111. return null;
  112. }
  113. PlayerDoc_ = nativeDoc;
  114. }
  115. }
  116. }
  117. else
  118. {
  119. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  120. DefaultDoc.LoadXml(textAsset.text);
  121. Debug.LogWarning("Download Archive");
  122. ManaDebug.Log("Download Archive");
  123. DamageLock = true;
  124. DownloadLock = false;
  125. return null;
  126. }
  127. }
  128. return PlayerDoc_;
  129. }
  130. set { PlayerDoc_ = value; }
  131. }
  132. public static XmlNode PlayerNode_;
  133. public static XmlDocument PlayerDoc_;
  134. public static float Timer;
  135. public static bool DamageLock;
  136. public static bool DownloadLock;
  137. public static XmlDocument DefaultDoc = new XmlDocument();
  138. #endregion
  139. public void Update()
  140. {
  141. if (DamageLock)
  142. {
  143. Timer += Time.deltaTime;
  144. if (Timer >= 10)
  145. {
  146. DamageLock = false;
  147. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  148. PlayerDoc_ = new XmlDocument();
  149. PlayerDoc_.LoadXml(textAsset.text);
  150. return;
  151. }
  152. }
  153. if (!DownloadLock)
  154. {
  155. if (ManaServer.ID != "Default")
  156. {
  157. DownloadLock = true;
  158. ManaServer.DownloadBySerialNumber(ManaServer.SerialNumber, RecoveXml);
  159. }
  160. }
  161. }
  162. public override bool RegistImmed()
  163. {
  164. if (base.RegistImmed())
  165. {
  166. return true;
  167. }
  168. enabled = true;
  169. return false;
  170. }
  171. public static void SaveXml()
  172. {
  173. if (Initializer.Complete)
  174. {
  175. XmlDocument doc = new XmlDocument();
  176. doc.LoadXml(PlayerDoc.OuterXml);
  177. Auxiliary.EncryptXml(doc);
  178. StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
  179. sw.Write(doc.OuterXml);
  180. sw.Close();
  181. byte[] bytes = File.ReadAllBytes(Application.persistentDataPath + "/PlayerConfig.xml");
  182. //byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml);
  183. MD5 md5 = new MD5CryptoServiceProvider();
  184. PlayerPrefs.SetString("config", Auxiliary.ToString(md5.ComputeHash(bytes)));
  185. }
  186. }
  187. public static void RecoveXml(JsonData jsonData)
  188. {
  189. if (!DamageLock)
  190. {
  191. return;
  192. }
  193. DamageLock = false;
  194. TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
  195. DefaultDoc.LoadXml(textAsset.text);
  196. if (jsonData.Inst_Object.Keys.Contains("l"))
  197. {
  198. PlayerDoc_ = new XmlDocument();
  199. PlayerDoc_.LoadXml(jsonData["l"].ToString());
  200. int nativeVersion = int.Parse(PlayerDoc_.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
  201. int defaultVersion = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
  202. //Debug.Log(nativeVersion + " " + defaultVersion);
  203. //ManaDebug.Log(nativeVersion + " " + defaultVersion);
  204. if (nativeVersion < defaultVersion)
  205. {
  206. MergeXML(nativeVersion, PlayerDoc_, DefaultDoc);
  207. ManaServer.Save();
  208. }
  209. else if (nativeVersion > defaultVersion)
  210. {
  211. PlayerDoc_ = DefaultDoc;
  212. }
  213. }
  214. else
  215. {
  216. PlayerDoc_ = DefaultDoc;
  217. }
  218. }
  219. public static void SaveSkillList()
  220. {
  221. if (ManaTutorial.TutorialA || !ManaCenter.Complete)
  222. {
  223. return;
  224. }
  225. XmlNode xmlNode;
  226. XmlAttribute xmlAttribute;
  227. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  228. xmlNode.RemoveAll();
  229. for (int i = 0; i < ManaCenter.SkillList.Count; i++)
  230. {
  231. if (ManaCenter.SkillList[i].SkillType == SkillType.Skill)
  232. {
  233. #region Skill
  234. Skill skill = (Skill)ManaCenter.SkillList[i];
  235. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  236. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  237. xmlAttribute.Value = skill.ID;
  238. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  239. xmlAttribute.Value = skill.SkillType.ToString();
  240. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  241. xmlAttribute.Value = skill.ItemStatus.ToString();
  242. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  243. xmlAttribute.Value = skill.Level.ToString();
  244. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
  245. xmlAttribute.Value = skill.CoolTimer.ToString("0");
  246. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
  247. xmlAttribute.Value = skill.UseTimer.ToString("0");
  248. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  249. #endregion
  250. }
  251. else if (ManaCenter.SkillList[i].SkillType == SkillType.Pack)
  252. {
  253. #region Pack
  254. Pack pack = (Pack)ManaCenter.SkillList[i];
  255. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  256. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  257. xmlAttribute.Value = pack.ID;
  258. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  259. xmlAttribute.Value = pack.SkillType.ToString();
  260. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  261. xmlAttribute.Value = pack.ItemStatus.ToString();
  262. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  263. xmlAttribute.Value = pack.Level.ToString();
  264. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  265. #endregion
  266. }
  267. else if (ManaCenter.SkillList[i].SkillType == SkillType.Ability)
  268. {
  269. #region Ability
  270. Ability ability = (Ability)ManaCenter.SkillList[i];
  271. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  272. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  273. xmlAttribute.Value = ability.ID;
  274. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  275. xmlAttribute.Value = ability.SkillType.ToString();
  276. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  277. xmlAttribute.Value = ability.ItemStatus.ToString();
  278. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  279. xmlAttribute.Value = ability.Level.ToString();
  280. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  281. #endregion
  282. }
  283. else if (ManaCenter.SkillList[i].SkillType == SkillType.BigSkill)
  284. {
  285. #region BigSkill
  286. BigSkill bigSkill = (BigSkill)ManaCenter.SkillList[i];
  287. xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
  288. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
  289. xmlAttribute.Value = bigSkill.ID;
  290. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
  291. xmlAttribute.Value = bigSkill.SkillType.ToString();
  292. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
  293. xmlAttribute.Value = bigSkill.ItemStatus.ToString();
  294. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
  295. xmlAttribute.Value = bigSkill.BarStatus.ToString();
  296. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
  297. xmlAttribute.Value = bigSkill.Level.ToString();
  298. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
  299. xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
  300. xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
  301. xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
  302. xmlNode = PlayerNode.SelectSingleNode("SkillList");
  303. #endregion
  304. }
  305. }
  306. }
  307. public static void SaveDress()
  308. {
  309. XmlNode xmlNode = PlayerNode.SelectSingleNode("DressList");
  310. xmlNode.Attributes[0].Value = "";
  311. for (int i = 0; i < ManaPlayer.BoughtCloseList.Count; i++)
  312. {
  313. xmlNode.Attributes[0].Value += ManaPlayer.BoughtCloseList[i] + " ";
  314. }
  315. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  316. xmlNode = PlayerNode.SelectSingleNode("DressData");
  317. for (int i = 0; i < ManaPlayer.DressData.Count; i++)
  318. {
  319. xmlNode.Attributes[i].Value = ManaPlayer.DressData[i];
  320. }
  321. }
  322. public static void SaveAchieve()
  323. {
  324. XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
  325. xmlNode.Attributes[0].Value = "";
  326. foreach (var kv in ManaAchieve.AchieveDic)
  327. {
  328. if (!kv.Value.Lock)
  329. {
  330. xmlNode.Attributes[0].Value += kv.Value.ID_ + " ";
  331. }
  332. }
  333. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  334. PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaCenter.AdAmt.ToString("0");
  335. PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaCenter.SkillAmt.ToString("0");
  336. PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaCenter.SignAmt.ToString("0");
  337. PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaCenter.ShareAmt.ToString("0");
  338. PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaCenter.ElfLevel.ToString("0");
  339. PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaCenter.MiniGameAmt.ToString("0");
  340. PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaCenter.FlowerCoin.ToString("0");
  341. PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value = ManaCenter.TotalPerson.ToString("0");
  342. PlayerNode.SelectSingleNode("AchieveData").Attributes[8].Value = ManaCenter.CostDiamond.ToString("0");
  343. }
  344. public static void SavePlantList()
  345. {
  346. if (ManaVisit.InVisit || ManaTutorial.TutorialA)
  347. {
  348. return;
  349. }
  350. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes;
  351. attribute[0].Value = "";
  352. for (int i = 0; i < ManaGarden.PlantList.Count; i++)
  353. {
  354. Slot slot = ManaGarden.PlantList[i];
  355. attribute[0].Value += slot.ID + "," + slot.Index + " ";
  356. }
  357. attribute[0].Value = attribute[0].Value.TrimEnd(' ');
  358. }
  359. public static void SaveCommon()
  360. {
  361. PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaCenter.Coin.ToString("0");
  362. PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaCenter.Diamond.ToString("0");
  363. PlayerNode.SelectSingleNode("SignTime").Attributes[0].Value = ManaSign.SignTime.ToString();
  364. PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString();
  365. PlayerNode.SelectSingleNode("SignRound").Attributes[0].Value = ManaSign.SignRound.ToString();
  366. PlayerNode.SelectSingleNode("QuitFlag").Attributes[0].Value = ManaServer.Connect.ToInt().ToString();
  367. PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = ManaServer.Time.ToString();
  368. PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaCenter.MiniTimer.ToString("0");
  369. PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaCenter.CircleTimer.ToString("0");
  370. PlayerNode.SelectSingleNode("ID").Attributes[0].Value = ManaServer.ID;
  371. PlayerNode.SelectSingleNode("SerialNumber").Attributes[0].Value = ManaServer.SerialNumber;
  372. PlayerNode.SelectSingleNode("Language").Attributes[0].Value = ManaLan.CurrentLan.ToString();
  373. PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString();
  374. PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = ManaTutorial.TutorialA.ToInt().ToString();
  375. PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = ManaTutorial.TutorialB_.ToInt().ToString();
  376. PlayerNode.SelectSingleNode("TutorialC").Attributes[0].Value = ManaTutorial.TutorialC_.ToInt().ToString();
  377. PlayerNode.SelectSingleNode("TutorialD").Attributes[0].Value = ManaTutorial.TutorialD_.ToInt().ToString();
  378. PlayerNode.SelectSingleNode("TutorialE").Attributes[0].Value = ManaTutorial.TutorialE_.ToInt().ToString();
  379. PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = ManaTutorial.TutorialIndexA.ToString();
  380. PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = ManaTutorial.TutorialIndexB.ToString();
  381. PlayerNode.SelectSingleNode("TutorialIndexC").Attributes[0].Value = ManaTutorial.TutorialIndexC.ToString();
  382. PlayerNode.SelectSingleNode("TutorialIndexD").Attributes[0].Value = ManaTutorial.TutorialIndexD.ToString();
  383. PlayerNode.SelectSingleNode("TutorialIndexE").Attributes[0].Value = ManaTutorial.TutorialIndexE.ToString();
  384. }
  385. public static void SaveFlowers()
  386. {
  387. XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
  388. XmlAttribute attribute1 = PlayerNode.SelectSingleNode("FlowerAmtList").Attributes[0];
  389. attribute.Value = "";
  390. attribute1.Value = "";
  391. foreach (var kv in ManaGarden.FlowerInfoDic)
  392. {
  393. if (kv.Value.Unlock)
  394. {
  395. attribute.Value += kv.Value.ID_ + " ";
  396. attribute1.Value += kv.Value.Amount + " ";
  397. }
  398. }
  399. attribute.Value = attribute.Value.Trim(' ');
  400. attribute1.Value = attribute1.Value.Trim(' ');
  401. }
  402. public static void SavePlayerConfig()
  403. {
  404. if (Initializer.Complete)
  405. {
  406. SaveSkillList();
  407. SaveAchieve();
  408. SaveDress();
  409. SavePlantList();
  410. SaveCommon();
  411. SaveFlowers();
  412. }
  413. }
  414. public static void ResetPlayerConfig()
  415. {
  416. PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "10000";
  417. SavePlayerConfig();
  418. ManaCenter.SaveLock = true;
  419. }
  420. public static int GetPlayerInt(string node)
  421. {
  422. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  423. }
  424. public static bool GetPlayerBool(string node)
  425. {
  426. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  427. }
  428. public static float GetPlayerFloat(string node)
  429. {
  430. return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  431. }
  432. public static string GetPlayerString(string node)
  433. {
  434. return PlayerNode.SelectSingleNode(node).Attributes[0].Value;
  435. }
  436. public static double GetPlayerDouble(string node)
  437. {
  438. return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  439. }
  440. public static void SavePlayerInt(string node, int value)
  441. {
  442. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  443. }
  444. public static void SavePlayerBool(string node, bool value)
  445. {
  446. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  447. }
  448. public static void SavePlayerFloat(string node, float value)
  449. {
  450. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  451. }
  452. public static void SavePlayerString(string node, string value)
  453. {
  454. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
  455. }
  456. public static void SavePlayerDouble(string node, double value)
  457. {
  458. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  459. }
  460. public static List<int> GetIntList(char splitChar, string nodeName, List<int> defaultList)
  461. {
  462. return Auxiliary.IntListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  463. }
  464. public static List<string> GetStringList(char splitChar, string nodeName, List<string> defaultList)
  465. {
  466. return Auxiliary.StringListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  467. }
  468. public static List<int> GetDressList()
  469. {
  470. List<int> list = new List<int>();
  471. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("DressList").Attributes;
  472. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  473. }
  474. public static List<int> GetDressDataIDs(Player player)
  475. {
  476. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  477. //{
  478. // Debug.LogWarning(VARIABLE.Key);
  479. //}
  480. List<int> dressDataIDs = new List<int>();
  481. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Head]);
  482. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Dress]);
  483. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Shoe]);
  484. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.HeadWear]);
  485. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Top]);
  486. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Eye]);
  487. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Mouse]);
  488. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Wing]);
  489. return dressDataIDs;
  490. }
  491. public static List<int> GetDressDataIDs(SFSObject parameter)
  492. {
  493. List<int> ids = parameter.GetIntArray(DataID.Close.GetHashString()).ToList();
  494. return ids;
  495. }
  496. public static List<string> GetDressData(SFSObject parameter)
  497. {
  498. List<int> ids = GetDressDataIDs(parameter);
  499. List<string> dressData = new List<string>();
  500. foreach (var id in ids)
  501. {
  502. dressData.Add(ManaPlayer.CloseUnitDic[id].ArmatureName);
  503. }
  504. return dressData;
  505. }
  506. public static List<string> GetDressData(XmlNode node = null)
  507. {
  508. XmlNode xmlNode;
  509. if (node == null)
  510. {
  511. xmlNode = PlayerNode.SelectSingleNode("DressData");
  512. }
  513. else
  514. {
  515. xmlNode = node.SelectSingleNode("DressData");
  516. }
  517. List<string> dataList = new List<string>();
  518. if (xmlNode != null && xmlNode.Attributes.Count == 12)
  519. {
  520. dataList.Add(xmlNode.Attributes[0].Value);
  521. dataList.Add(xmlNode.Attributes[1].Value);
  522. dataList.Add(xmlNode.Attributes[2].Value);
  523. dataList.Add(xmlNode.Attributes[3].Value);
  524. dataList.Add(xmlNode.Attributes[4].Value);
  525. dataList.Add(xmlNode.Attributes[5].Value);
  526. dataList.Add(xmlNode.Attributes[6].Value);
  527. dataList.Add(xmlNode.Attributes[7].Value);
  528. dataList.Add(xmlNode.Attributes[8].Value);
  529. dataList.Add(xmlNode.Attributes[9].Value);
  530. dataList.Add(xmlNode.Attributes[10].Value);
  531. dataList.Add(xmlNode.Attributes[11].Value);
  532. //dataList[8] = "长袖9左";
  533. //dataList[9] = "Empty";
  534. //dataList[10] = "长袖9右";
  535. //dataList[11] = "Empty";
  536. }
  537. else if(xmlNode != null && xmlNode.Attributes.Count == 8)
  538. {
  539. dataList.Add(xmlNode.Attributes[0].Value);
  540. dataList.Add(xmlNode.Attributes[1].Value);
  541. dataList.Add(xmlNode.Attributes[2].Value);
  542. dataList.Add(xmlNode.Attributes[3].Value);
  543. dataList.Add(xmlNode.Attributes[4].Value);
  544. dataList.Add(xmlNode.Attributes[5].Value);
  545. dataList.Add(xmlNode.Attributes[6].Value);
  546. dataList.Add(xmlNode.Attributes[7].Value);
  547. dataList.AddRange (GetSleeveListByTop(xmlNode.Attributes[4].Value));
  548. }
  549. else
  550. {
  551. float rate = Random.Range(0f, 1f);
  552. if (rate < 0.33f)
  553. {
  554. dataList.Add("脑壳1");
  555. dataList.Add("裙子1");
  556. dataList.Add("鞋子1");
  557. dataList.Add("头饰品1");
  558. dataList.Add("上衣1");
  559. dataList.Add("眼睛1");
  560. dataList.Add("嘴巴1");
  561. dataList.Add("Empty");
  562. dataList.Add("Empty");
  563. dataList.Add("短袖1左");
  564. dataList.Add("Empty");
  565. dataList.Add("短袖1右");
  566. }
  567. else if (rate < 0.66f)
  568. {
  569. dataList.Add("脑壳2");
  570. dataList.Add("裙子2");
  571. dataList.Add("鞋子2");
  572. dataList.Add("头饰品2");
  573. dataList.Add("上衣2");
  574. dataList.Add("眼睛2");
  575. dataList.Add("嘴巴2");
  576. dataList.Add("Empty");
  577. dataList.Add("Empty");
  578. dataList.Add("短袖2左");
  579. dataList.Add("Empty");
  580. dataList.Add("短袖2右");
  581. }
  582. else
  583. {
  584. dataList.Add("脑壳3");
  585. dataList.Add("裙子3");
  586. dataList.Add("鞋子3");
  587. dataList.Add("头饰品3");
  588. dataList.Add("上衣3");
  589. dataList.Add("眼睛3");
  590. dataList.Add("嘴巴3");
  591. dataList.Add("Empty");
  592. dataList.Add("Empty");
  593. dataList.Add("短袖2左");
  594. dataList.Add("Empty");
  595. dataList.Add("短袖2右");
  596. }
  597. }
  598. return dataList;
  599. }
  600. public static List<int> GetFlowerList()
  601. {
  602. List<int> list = new List<int>();
  603. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  604. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  605. }
  606. public static List<int> GetAchieveList()
  607. {
  608. return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
  609. }
  610. public static List<string> GetOfflineConfig()
  611. {
  612. TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
  613. XmlDocument xmlDoc = new XmlDocument();
  614. xmlDoc.LoadXml(textAsset.text);
  615. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  616. List<string> strList = new List<string>()
  617. {
  618. xmlNode.Attributes[1].Value,
  619. xmlNode.Attributes[2].Value,
  620. xmlNode.Attributes[3].Value,
  621. };
  622. return strList;
  623. }
  624. public static List<double> GetAchieveData()
  625. {
  626. List<double> dataList = new List<double>();
  627. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value));
  628. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value));
  629. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value));
  630. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value));
  631. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value));
  632. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value));
  633. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value));
  634. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
  635. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[8].Value));
  636. return dataList;
  637. }
  638. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  639. {
  640. List<KV<int, int>> list = new List<KV<int, int>>();
  641. XmlNode xmlNode;
  642. if (node == null)
  643. {
  644. xmlNode = PlayerNode.SelectSingleNode("PlantList");
  645. }
  646. else
  647. {
  648. xmlNode = node.SelectSingleNode("PlantList");
  649. }
  650. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  651. {
  652. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  653. for (int i = 0; i < strings.Length; i++)
  654. {
  655. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  656. }
  657. }
  658. return list;
  659. }
  660. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  661. {
  662. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  663. XmlNodeList xmlNodeList;
  664. if (node == null)
  665. {
  666. xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
  667. }
  668. else
  669. {
  670. xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
  671. }
  672. for (int i = 0; i < xmlNodeList.Count; i++)
  673. {
  674. attributeList.Add(xmlNodeList[i].Attributes);
  675. }
  676. return attributeList;
  677. }
  678. public static XmlAttributeCollection GetVisitConfig()
  679. {
  680. TextAsset textAsset = ManaReso.Load<TextAsset>("visit_config", Folder.Config);
  681. XmlDocument xmlDoc = new XmlDocument();
  682. xmlDoc.LoadXml(textAsset.text);
  683. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  684. return xmlNode.Attributes;
  685. }
  686. public static XmlAttributeCollection GetAwardConfig()
  687. {
  688. TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
  689. XmlDocument xmlDoc = new XmlDocument();
  690. xmlDoc.LoadXml(textAsset.text);
  691. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  692. return xmlNode.Attributes;
  693. }
  694. public static List<XmlAttributeCollection> GetIAPConfig()
  695. {
  696. TextAsset textAsset;
  697. XmlNodeList xmlNodeList;
  698. XmlDocument xmlDoc = new XmlDocument();
  699. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  700. textAsset = ManaReso.Load<TextAsset>("iap_config", Folder.Config);
  701. xmlDoc.LoadXml(textAsset.text);
  702. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  703. for (int i = 0; i < xmlNodeList.Count; i++)
  704. {
  705. attributeList.Add(xmlNodeList[i].Attributes);
  706. }
  707. return attributeList;
  708. }
  709. public static List<XmlAttributeCollection> GetSkillConfig()
  710. {
  711. TextAsset textAsset;
  712. XmlDocument xmlDoc = new XmlDocument();
  713. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  714. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  715. textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
  716. xmlDoc.LoadXml(textAsset.text);
  717. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  718. textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
  719. xmlDoc.LoadXml(textAsset.text);
  720. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  721. textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
  722. xmlDoc.LoadXml(textAsset.text);
  723. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  724. for (int i = 0; i < xmlNodeList.Count; i++)
  725. {
  726. for (int j = 0; j < xmlNodeList[i].Count; j++)
  727. {
  728. attributeList.Add(xmlNodeList[i][j].Attributes);
  729. }
  730. }
  731. return attributeList;
  732. }
  733. public static List<XmlAttributeCollection> GetSignConfig()
  734. {
  735. TextAsset textAsset;
  736. XmlNodeList xmlNodeList;
  737. XmlDocument xmlDoc = new XmlDocument();
  738. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  739. textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.Config);
  740. xmlDoc.LoadXml(textAsset.text);
  741. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  742. for (int i = 0; i < xmlNodeList.Count; i++)
  743. {
  744. attributeList.Add(xmlNodeList[i].Attributes);
  745. }
  746. return attributeList;
  747. }
  748. public static List<XmlAttributeCollection> GetFlowerConfig()
  749. {
  750. TextAsset textAsset;
  751. XmlNodeList xmlNodeList;
  752. XmlDocument xmlDoc = new XmlDocument();
  753. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  754. textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.Config);
  755. xmlDoc.LoadXml(textAsset.text);
  756. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  757. for (int i = 0; i < xmlNodeList.Count; i++)
  758. {
  759. attributeList.Add(xmlNodeList[i].Attributes);
  760. }
  761. return attributeList;
  762. }
  763. public static List<XmlAttributeCollection> GetLotteryConfig()
  764. {
  765. TextAsset textAsset;
  766. XmlNodeList xmlNodeList;
  767. XmlDocument xmlDoc = new XmlDocument();
  768. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  769. textAsset = ManaReso.Load<TextAsset>("lottery_config", Folder.Config);
  770. xmlDoc.LoadXml(textAsset.text);
  771. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  772. for (int i = 0; i < xmlNodeList.Count; i++)
  773. {
  774. attributeList.Add(xmlNodeList[i].Attributes);
  775. }
  776. return attributeList;
  777. }
  778. public static List<XmlAttributeCollection> GetAchieveConfig()
  779. {
  780. TextAsset textAsset;
  781. XmlNodeList xmlNodeList;
  782. XmlDocument xmlDoc = new XmlDocument();
  783. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  784. textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.Config);
  785. xmlDoc.LoadXml(textAsset.text);
  786. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  787. for (int i = 0; i < xmlNodeList.Count; i++)
  788. {
  789. attributeList.Add(xmlNodeList[i].Attributes);
  790. }
  791. return attributeList;
  792. }
  793. public static List<XmlAttributeCollection> GetDressRoomConfig()
  794. {
  795. TextAsset textAsset;
  796. XmlNodeList xmlNodeList;
  797. XmlDocument xmlDoc = new XmlDocument();
  798. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  799. textAsset = ManaReso.Load<TextAsset>("dressRoom_config", Folder.Config);
  800. xmlDoc.LoadXml(textAsset.text);
  801. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  802. for (int i = 0; i < xmlNodeList.Count; i++)
  803. {
  804. attributeList.Add(xmlNodeList[i].Attributes);
  805. }
  806. return attributeList;
  807. }
  808. public static XmlDocument MergeXML(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc)
  809. {
  810. if (nativeVersion < 0)
  811. {
  812. Debug.LogWarning("UpdateArchive to 0");
  813. To0(nativeDoc, defaultDoc);
  814. }
  815. if (nativeVersion < 1)
  816. {
  817. Debug.LogWarning("UpdateArchive to 1");
  818. To1(nativeDoc, defaultDoc);
  819. }
  820. if (nativeVersion < 2)
  821. {
  822. Debug.LogWarning("UpdateArchive to 2");
  823. To2(nativeDoc, defaultDoc);
  824. }
  825. if (nativeVersion < 3)
  826. {
  827. Debug.LogWarning("UpdateArchive to 3");
  828. To3(nativeDoc, defaultDoc);
  829. }
  830. if (nativeVersion < 4)
  831. {
  832. Debug.LogWarning("UpdateArchive to 4");
  833. To4(nativeDoc, defaultDoc);
  834. }
  835. if (nativeVersion < 5)
  836. {
  837. Debug.LogWarning("UpdateArchive to 5");
  838. To5(nativeDoc, defaultDoc);
  839. }
  840. if (nativeVersion < 6)
  841. {
  842. Debug.LogWarning("UpdateArchive to 6");
  843. To6(nativeDoc, defaultDoc);
  844. }
  845. if (nativeVersion < 7)
  846. {
  847. Debug.LogWarning("UpdateArchive to 7");
  848. To7(nativeDoc, defaultDoc);
  849. }
  850. return nativeDoc;
  851. }
  852. public static XmlDocument To0(XmlDocument nativeDoc, XmlDocument defaultDoc)
  853. {
  854. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 0.ToString();
  855. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("ADPlayTime");
  856. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  857. return nativeDoc;
  858. }
  859. public static XmlDocument To1(XmlDocument nativeDoc, XmlDocument defaultDoc)
  860. {
  861. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 1.ToString();
  862. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("SerialNumber");
  863. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  864. return nativeDoc;
  865. }
  866. public static XmlDocument To2(XmlDocument nativeDoc, XmlDocument defaultDoc)
  867. {
  868. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 2.ToString();
  869. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NotificationIndex");
  870. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  871. return nativeDoc;
  872. }
  873. public static XmlDocument To3(XmlDocument nativeDoc, XmlDocument defaultDoc)
  874. {
  875. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 3.ToString();
  876. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NickName");
  877. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  878. return nativeDoc;
  879. }
  880. public static XmlDocument To4(XmlDocument nativeDoc, XmlDocument defaultDoc)
  881. {
  882. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 4.ToString();
  883. XmlNode xmlNode = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("DressData");
  884. XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftLongSleeveSlot"));
  885. attribute.Value="Empty";
  886. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftShortSleeveSlot"));
  887. attribute.Value="Empty";
  888. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightLongSleeveSlot"));
  889. attribute.Value="Empty";
  890. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightShortSleeveSlot"));
  891. attribute.Value="Empty";
  892. List<string> sleeveList = GetSleeveListByTop (xmlNode.Attributes [4].Value);
  893. xmlNode.Attributes [8].Value = sleeveList[0];
  894. xmlNode.Attributes [9].Value = sleeveList[1];
  895. xmlNode.Attributes [10].Value = sleeveList[2];
  896. xmlNode.Attributes [11].Value = sleeveList[3];
  897. return nativeDoc;
  898. }
  899. public static List<string> GetSleeveListByTop(string topName)
  900. {
  901. List<string> sleeveList = new List<string>() {"Empty", "Empty", "Empty", "Empty"};
  902. if (topName == "上衣1")
  903. {
  904. sleeveList[1] = "短袖1左";
  905. sleeveList[3] = "短袖1右";
  906. }
  907. else if (topName == "上衣2")
  908. {
  909. sleeveList[1] = "短袖2左";
  910. sleeveList[3] = "短袖2右";
  911. }
  912. else if (topName == "上衣3")
  913. {
  914. sleeveList[1] = "短袖2左";
  915. sleeveList[3] = "短袖2右";
  916. }
  917. else if (topName == "上衣5")
  918. {
  919. sleeveList[1] = "短袖2左";
  920. sleeveList[3] = "短袖2右";
  921. }
  922. else if (topName == "上衣6")
  923. {
  924. sleeveList[1] = "短袖6左";
  925. sleeveList[3] = "短袖6右";
  926. }
  927. else if (topName == "上衣7")
  928. {
  929. sleeveList[1] = "短袖7左";
  930. sleeveList[3] = "短袖7右";
  931. }
  932. else if (topName == "上衣7(粉)")
  933. {
  934. sleeveList[1] = "短袖7粉左";
  935. sleeveList[3] = "短袖7粉右";
  936. }
  937. else if (topName == "上衣12")
  938. {
  939. sleeveList[1] = "短袖12左";
  940. sleeveList[3] = "短袖12右";
  941. }
  942. else if (topName == "上衣13")
  943. {
  944. sleeveList[1] = "短袖13左";
  945. sleeveList[3] = "短袖13右";
  946. }
  947. else if (topName == "上衣13(紫)")
  948. {
  949. sleeveList[1] = "短袖13蓝左";
  950. sleeveList[3] = "短袖13蓝右";
  951. }
  952. else
  953. {
  954. sleeveList[0] = "长袖9左";
  955. sleeveList[2] = "长袖9右";
  956. }
  957. return sleeveList;
  958. }
  959. public static XmlDocument To5(XmlDocument nativeDoc, XmlDocument defaultDoc)
  960. {
  961. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 5.ToString();
  962. return nativeDoc;
  963. }
  964. public static XmlDocument To6(XmlDocument nativeDoc, XmlDocument defaultDoc)
  965. {
  966. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 6.ToString();
  967. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NewFlowerFlag");
  968. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  969. return nativeDoc;
  970. }
  971. public static XmlDocument To7(XmlDocument nativeDoc, XmlDocument defaultDoc)
  972. {
  973. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 7.ToString();
  974. XmlNode xmlNode1 = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("FlowerList");
  975. string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' ');
  976. xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("FlowerAmtList");
  977. xmlNode1.Attributes[0].Value = "";
  978. foreach (var flowerID in flowerIDs)
  979. {
  980. xmlNode1.Attributes[0].Value += " " + "1";
  981. }
  982. xmlNode1.Attributes[0].Value = xmlNode1.Attributes[0].Value.TrimStart();
  983. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  984. return nativeDoc;
  985. }
  986. }