ManaData.cs 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  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 SaveFlowerList()
  386. {
  387. XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
  388. attribute.Value = "";
  389. foreach (var kv in ManaGarden.FlowerInfoDic)
  390. {
  391. if (kv.Value.Unlock)
  392. {
  393. attribute.Value += kv.Value.ID_ + " ";
  394. }
  395. }
  396. attribute.Value = attribute.Value.Trim(' ');
  397. }
  398. public static void SavePlayerConfig()
  399. {
  400. if (Initializer.Complete)
  401. {
  402. SaveSkillList();
  403. SaveAchieve();
  404. SaveDress();
  405. SavePlantList();
  406. SaveCommon();
  407. SaveFlowerList();
  408. }
  409. }
  410. public static void ResetPlayerConfig()
  411. {
  412. PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "10000";
  413. SavePlayerConfig();
  414. ManaCenter.SaveLock = true;
  415. }
  416. public static int GetPlayerInt(string node)
  417. {
  418. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  419. }
  420. public static bool GetPlayerBool(string node)
  421. {
  422. return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  423. }
  424. public static float GetPlayerFloat(string node)
  425. {
  426. return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  427. }
  428. public static string GetPlayerString(string node)
  429. {
  430. return PlayerNode.SelectSingleNode(node).Attributes[0].Value;
  431. }
  432. public static double GetPlayerDouble(string node)
  433. {
  434. return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
  435. }
  436. public static void SavePlayerInt(string node, int value)
  437. {
  438. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  439. }
  440. public static void SavePlayerBool(string node, bool value)
  441. {
  442. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  443. }
  444. public static void SavePlayerFloat(string node, float value)
  445. {
  446. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  447. }
  448. public static void SavePlayerString(string node, string value)
  449. {
  450. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
  451. }
  452. public static void SavePlayerDouble(string node, double value)
  453. {
  454. PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  455. }
  456. public static List<int> GetIntList(char splitChar, string nodeName, List<int> defaultList)
  457. {
  458. return Auxiliary.IntListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  459. }
  460. public static List<string> GetStringList(char splitChar, string nodeName, List<string> defaultList)
  461. {
  462. return Auxiliary.StringListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  463. }
  464. public static List<int> GetDressList()
  465. {
  466. List<int> list = new List<int>();
  467. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("DressList").Attributes;
  468. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  469. }
  470. public static List<int> GetDressDataIDs(Player player)
  471. {
  472. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  473. //{
  474. // Debug.LogWarning(VARIABLE.Key);
  475. //}
  476. List<int> dressDataIDs = new List<int>();
  477. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Head]);
  478. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Dress]);
  479. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Shoe]);
  480. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.HeadWear]);
  481. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Top]);
  482. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Eye]);
  483. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Mouse]);
  484. dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Wing]);
  485. return dressDataIDs;
  486. }
  487. public static List<int> GetDressDataIDs(SFSObject parameter)
  488. {
  489. List<int> ids = parameter.GetIntArray(DataID.Close.GetHashString()).ToList();
  490. return ids;
  491. }
  492. public static List<string> GetDressData(SFSObject parameter)
  493. {
  494. List<int> ids = GetDressDataIDs(parameter);
  495. List<string> dressData = new List<string>();
  496. foreach (var id in ids)
  497. {
  498. dressData.Add(ManaPlayer.CloseUnitDic[id].ArmatureName);
  499. }
  500. return dressData;
  501. }
  502. public static List<string> GetDressData(XmlNode node = null)
  503. {
  504. XmlNode xmlNode;
  505. if (node == null)
  506. {
  507. xmlNode = PlayerNode.SelectSingleNode("DressData");
  508. }
  509. else
  510. {
  511. xmlNode = node.SelectSingleNode("DressData");
  512. }
  513. List<string> dataList = new List<string>();
  514. if (xmlNode != null && xmlNode.Attributes.Count == 12)
  515. {
  516. dataList.Add(xmlNode.Attributes[0].Value);
  517. dataList.Add(xmlNode.Attributes[1].Value);
  518. dataList.Add(xmlNode.Attributes[2].Value);
  519. dataList.Add(xmlNode.Attributes[3].Value);
  520. dataList.Add(xmlNode.Attributes[4].Value);
  521. dataList.Add(xmlNode.Attributes[5].Value);
  522. dataList.Add(xmlNode.Attributes[6].Value);
  523. dataList.Add(xmlNode.Attributes[7].Value);
  524. dataList.Add(xmlNode.Attributes[8].Value);
  525. dataList.Add(xmlNode.Attributes[9].Value);
  526. dataList.Add(xmlNode.Attributes[10].Value);
  527. dataList.Add(xmlNode.Attributes[11].Value);
  528. //dataList[8] = "长袖9左";
  529. //dataList[9] = "Empty";
  530. //dataList[10] = "长袖9右";
  531. //dataList[11] = "Empty";
  532. }
  533. else if(xmlNode != null && xmlNode.Attributes.Count == 8)
  534. {
  535. dataList.Add(xmlNode.Attributes[0].Value);
  536. dataList.Add(xmlNode.Attributes[1].Value);
  537. dataList.Add(xmlNode.Attributes[2].Value);
  538. dataList.Add(xmlNode.Attributes[3].Value);
  539. dataList.Add(xmlNode.Attributes[4].Value);
  540. dataList.Add(xmlNode.Attributes[5].Value);
  541. dataList.Add(xmlNode.Attributes[6].Value);
  542. dataList.Add(xmlNode.Attributes[7].Value);
  543. dataList.AddRange (GetSleeveListByTop(xmlNode.Attributes[4].Value));
  544. }
  545. else
  546. {
  547. float rate = Random.Range(0f, 1f);
  548. if (rate < 0.33f)
  549. {
  550. dataList.Add("脑壳1");
  551. dataList.Add("裙子1");
  552. dataList.Add("鞋子1");
  553. dataList.Add("头饰品1");
  554. dataList.Add("上衣1");
  555. dataList.Add("眼睛1");
  556. dataList.Add("嘴巴1");
  557. dataList.Add("Empty");
  558. dataList.Add("Empty");
  559. dataList.Add("短袖1左");
  560. dataList.Add("Empty");
  561. dataList.Add("短袖1右");
  562. }
  563. else if (rate < 0.66f)
  564. {
  565. dataList.Add("脑壳2");
  566. dataList.Add("裙子2");
  567. dataList.Add("鞋子2");
  568. dataList.Add("头饰品2");
  569. dataList.Add("上衣2");
  570. dataList.Add("眼睛2");
  571. dataList.Add("嘴巴2");
  572. dataList.Add("Empty");
  573. dataList.Add("Empty");
  574. dataList.Add("短袖2左");
  575. dataList.Add("Empty");
  576. dataList.Add("短袖2右");
  577. }
  578. else
  579. {
  580. dataList.Add("脑壳3");
  581. dataList.Add("裙子3");
  582. dataList.Add("鞋子3");
  583. dataList.Add("头饰品3");
  584. dataList.Add("上衣3");
  585. dataList.Add("眼睛3");
  586. dataList.Add("嘴巴3");
  587. dataList.Add("Empty");
  588. dataList.Add("Empty");
  589. dataList.Add("短袖2左");
  590. dataList.Add("Empty");
  591. dataList.Add("短袖2右");
  592. }
  593. }
  594. return dataList;
  595. }
  596. public static List<int> GetFlowerList()
  597. {
  598. List<int> list = new List<int>();
  599. XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
  600. return Auxiliary.IntListParse(' ', attribute[0].Value, list);
  601. }
  602. public static List<int> GetAchieveList()
  603. {
  604. return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
  605. }
  606. public static List<string> GetOfflineConfig()
  607. {
  608. TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
  609. XmlDocument xmlDoc = new XmlDocument();
  610. xmlDoc.LoadXml(textAsset.text);
  611. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  612. List<string> strList = new List<string>()
  613. {
  614. xmlNode.Attributes[1].Value,
  615. xmlNode.Attributes[2].Value,
  616. xmlNode.Attributes[3].Value,
  617. };
  618. return strList;
  619. }
  620. public static List<double> GetAchieveData()
  621. {
  622. List<double> dataList = new List<double>();
  623. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value));
  624. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value));
  625. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value));
  626. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value));
  627. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value));
  628. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value));
  629. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value));
  630. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
  631. dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[8].Value));
  632. return dataList;
  633. }
  634. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  635. {
  636. List<KV<int, int>> list = new List<KV<int, int>>();
  637. XmlNode xmlNode;
  638. if (node == null)
  639. {
  640. xmlNode = PlayerNode.SelectSingleNode("PlantList");
  641. }
  642. else
  643. {
  644. xmlNode = node.SelectSingleNode("PlantList");
  645. }
  646. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  647. {
  648. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  649. for (int i = 0; i < strings.Length; i++)
  650. {
  651. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  652. }
  653. }
  654. return list;
  655. }
  656. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  657. {
  658. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  659. XmlNodeList xmlNodeList;
  660. if (node == null)
  661. {
  662. xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
  663. }
  664. else
  665. {
  666. xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
  667. }
  668. for (int i = 0; i < xmlNodeList.Count; i++)
  669. {
  670. attributeList.Add(xmlNodeList[i].Attributes);
  671. }
  672. return attributeList;
  673. }
  674. public static XmlAttributeCollection GetVisitConfig()
  675. {
  676. TextAsset textAsset = ManaReso.Load<TextAsset>("visit_config", Folder.Config);
  677. XmlDocument xmlDoc = new XmlDocument();
  678. xmlDoc.LoadXml(textAsset.text);
  679. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  680. return xmlNode.Attributes;
  681. }
  682. public static XmlAttributeCollection GetAwardConfig()
  683. {
  684. TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
  685. XmlDocument xmlDoc = new XmlDocument();
  686. xmlDoc.LoadXml(textAsset.text);
  687. XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
  688. return xmlNode.Attributes;
  689. }
  690. public static List<XmlAttributeCollection> GetIAPConfig()
  691. {
  692. TextAsset textAsset;
  693. XmlNodeList xmlNodeList;
  694. XmlDocument xmlDoc = new XmlDocument();
  695. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  696. textAsset = ManaReso.Load<TextAsset>("iap_config", Folder.Config);
  697. xmlDoc.LoadXml(textAsset.text);
  698. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  699. for (int i = 0; i < xmlNodeList.Count; i++)
  700. {
  701. attributeList.Add(xmlNodeList[i].Attributes);
  702. }
  703. return attributeList;
  704. }
  705. public static List<XmlAttributeCollection> GetSkillConfig()
  706. {
  707. TextAsset textAsset;
  708. XmlDocument xmlDoc = new XmlDocument();
  709. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  710. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  711. textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
  712. xmlDoc.LoadXml(textAsset.text);
  713. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  714. textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
  715. xmlDoc.LoadXml(textAsset.text);
  716. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  717. textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
  718. xmlDoc.LoadXml(textAsset.text);
  719. xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
  720. for (int i = 0; i < xmlNodeList.Count; i++)
  721. {
  722. for (int j = 0; j < xmlNodeList[i].Count; j++)
  723. {
  724. attributeList.Add(xmlNodeList[i][j].Attributes);
  725. }
  726. }
  727. return attributeList;
  728. }
  729. public static List<XmlAttributeCollection> GetSignConfig()
  730. {
  731. TextAsset textAsset;
  732. XmlNodeList xmlNodeList;
  733. XmlDocument xmlDoc = new XmlDocument();
  734. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  735. textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.Config);
  736. xmlDoc.LoadXml(textAsset.text);
  737. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  738. for (int i = 0; i < xmlNodeList.Count; i++)
  739. {
  740. attributeList.Add(xmlNodeList[i].Attributes);
  741. }
  742. return attributeList;
  743. }
  744. public static List<XmlAttributeCollection> GetFlowerConfig()
  745. {
  746. TextAsset textAsset;
  747. XmlNodeList xmlNodeList;
  748. XmlDocument xmlDoc = new XmlDocument();
  749. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  750. textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.Config);
  751. xmlDoc.LoadXml(textAsset.text);
  752. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  753. for (int i = 0; i < xmlNodeList.Count; i++)
  754. {
  755. attributeList.Add(xmlNodeList[i].Attributes);
  756. }
  757. return attributeList;
  758. }
  759. public static List<XmlAttributeCollection> GetLotteryConfig()
  760. {
  761. TextAsset textAsset;
  762. XmlNodeList xmlNodeList;
  763. XmlDocument xmlDoc = new XmlDocument();
  764. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  765. textAsset = ManaReso.Load<TextAsset>("lottery_config", Folder.Config);
  766. xmlDoc.LoadXml(textAsset.text);
  767. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  768. for (int i = 0; i < xmlNodeList.Count; i++)
  769. {
  770. attributeList.Add(xmlNodeList[i].Attributes);
  771. }
  772. return attributeList;
  773. }
  774. public static List<XmlAttributeCollection> GetAchieveConfig()
  775. {
  776. TextAsset textAsset;
  777. XmlNodeList xmlNodeList;
  778. XmlDocument xmlDoc = new XmlDocument();
  779. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  780. textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.Config);
  781. xmlDoc.LoadXml(textAsset.text);
  782. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  783. for (int i = 0; i < xmlNodeList.Count; i++)
  784. {
  785. attributeList.Add(xmlNodeList[i].Attributes);
  786. }
  787. return attributeList;
  788. }
  789. public static List<XmlAttributeCollection> GetDressRoomConfig()
  790. {
  791. TextAsset textAsset;
  792. XmlNodeList xmlNodeList;
  793. XmlDocument xmlDoc = new XmlDocument();
  794. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  795. textAsset = ManaReso.Load<TextAsset>("dressRoom_config", Folder.Config);
  796. xmlDoc.LoadXml(textAsset.text);
  797. xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
  798. for (int i = 0; i < xmlNodeList.Count; i++)
  799. {
  800. attributeList.Add(xmlNodeList[i].Attributes);
  801. }
  802. return attributeList;
  803. }
  804. public static XmlDocument MergeXML(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc)
  805. {
  806. if (nativeVersion < 0)
  807. {
  808. Debug.LogWarning("UpdateArchive to 0");
  809. To0(nativeDoc, defaultDoc);
  810. }
  811. if (nativeVersion < 1)
  812. {
  813. Debug.LogWarning("UpdateArchive to 1");
  814. To1(nativeDoc, defaultDoc);
  815. }
  816. if (nativeVersion < 2)
  817. {
  818. Debug.LogWarning("UpdateArchive to 2");
  819. To2(nativeDoc, defaultDoc);
  820. }
  821. if (nativeVersion < 3)
  822. {
  823. Debug.LogWarning("UpdateArchive to 3");
  824. To3(nativeDoc, defaultDoc);
  825. }
  826. if (nativeVersion < 4)
  827. {
  828. Debug.LogWarning("UpdateArchive to 4");
  829. To4(nativeDoc, defaultDoc);
  830. }
  831. if (nativeVersion < 5)
  832. {
  833. Debug.LogWarning("UpdateArchive to 5");
  834. To5(nativeDoc, defaultDoc);
  835. }
  836. if (nativeVersion < 6)
  837. {
  838. Debug.LogWarning("UpdateArchive to 6");
  839. To6(nativeDoc, defaultDoc);
  840. }
  841. if (nativeVersion < 7)
  842. {
  843. Debug.LogWarning("UpdateArchive to 7");
  844. To7(nativeDoc, defaultDoc);
  845. }
  846. return nativeDoc;
  847. }
  848. public static XmlDocument To0(XmlDocument nativeDoc, XmlDocument defaultDoc)
  849. {
  850. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 0.ToString();
  851. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("ADPlayTime");
  852. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  853. return nativeDoc;
  854. }
  855. public static XmlDocument To1(XmlDocument nativeDoc, XmlDocument defaultDoc)
  856. {
  857. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 1.ToString();
  858. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("SerialNumber");
  859. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  860. return nativeDoc;
  861. }
  862. public static XmlDocument To2(XmlDocument nativeDoc, XmlDocument defaultDoc)
  863. {
  864. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 2.ToString();
  865. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NotificationIndex");
  866. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  867. return nativeDoc;
  868. }
  869. public static XmlDocument To3(XmlDocument nativeDoc, XmlDocument defaultDoc)
  870. {
  871. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 3.ToString();
  872. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NickName");
  873. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  874. return nativeDoc;
  875. }
  876. public static XmlDocument To4(XmlDocument nativeDoc, XmlDocument defaultDoc)
  877. {
  878. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 4.ToString();
  879. XmlNode xmlNode = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("DressData");
  880. XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftLongSleeveSlot"));
  881. attribute.Value="Empty";
  882. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftShortSleeveSlot"));
  883. attribute.Value="Empty";
  884. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightLongSleeveSlot"));
  885. attribute.Value="Empty";
  886. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightShortSleeveSlot"));
  887. attribute.Value="Empty";
  888. List<string> sleeveList = GetSleeveListByTop (xmlNode.Attributes [4].Value);
  889. xmlNode.Attributes [8].Value = sleeveList[0];
  890. xmlNode.Attributes [9].Value = sleeveList[1];
  891. xmlNode.Attributes [10].Value = sleeveList[2];
  892. xmlNode.Attributes [11].Value = sleeveList[3];
  893. return nativeDoc;
  894. }
  895. public static List<string> GetSleeveListByTop(string topName)
  896. {
  897. List<string> sleeveList = new List<string>() {"Empty", "Empty", "Empty", "Empty"};
  898. if (topName == "上衣1")
  899. {
  900. sleeveList[1] = "短袖1左";
  901. sleeveList[3] = "短袖1右";
  902. }
  903. else if (topName == "上衣2")
  904. {
  905. sleeveList[1] = "短袖2左";
  906. sleeveList[3] = "短袖2右";
  907. }
  908. else if (topName == "上衣3")
  909. {
  910. sleeveList[1] = "短袖2左";
  911. sleeveList[3] = "短袖2右";
  912. }
  913. else if (topName == "上衣5")
  914. {
  915. sleeveList[1] = "短袖2左";
  916. sleeveList[3] = "短袖2右";
  917. }
  918. else if (topName == "上衣6")
  919. {
  920. sleeveList[1] = "短袖6左";
  921. sleeveList[3] = "短袖6右";
  922. }
  923. else if (topName == "上衣7")
  924. {
  925. sleeveList[1] = "短袖7左";
  926. sleeveList[3] = "短袖7右";
  927. }
  928. else if (topName == "上衣7(粉)")
  929. {
  930. sleeveList[1] = "短袖7粉左";
  931. sleeveList[3] = "短袖7粉右";
  932. }
  933. else if (topName == "上衣12")
  934. {
  935. sleeveList[1] = "短袖12左";
  936. sleeveList[3] = "短袖12右";
  937. }
  938. else if (topName == "上衣13")
  939. {
  940. sleeveList[1] = "短袖13左";
  941. sleeveList[3] = "短袖13右";
  942. }
  943. else if (topName == "上衣13(紫)")
  944. {
  945. sleeveList[1] = "短袖13蓝左";
  946. sleeveList[3] = "短袖13蓝右";
  947. }
  948. else
  949. {
  950. sleeveList[0] = "长袖9左";
  951. sleeveList[2] = "长袖9右";
  952. }
  953. return sleeveList;
  954. }
  955. public static XmlDocument To5(XmlDocument nativeDoc, XmlDocument defaultDoc)
  956. {
  957. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 5.ToString();
  958. return nativeDoc;
  959. }
  960. public static XmlDocument To6(XmlDocument nativeDoc, XmlDocument defaultDoc)
  961. {
  962. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 6.ToString();
  963. XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NewFlowerFlag");
  964. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  965. return nativeDoc;
  966. }
  967. public static XmlDocument To7(XmlDocument nativeDoc, XmlDocument defaultDoc)
  968. {
  969. nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 7.ToString();
  970. XmlNode xmlNode1 = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("FlowerList");
  971. string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' ');
  972. xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("FlowerAmtList");
  973. xmlNode1.Attributes[0].Value = "";
  974. foreach (var flowerID in flowerIDs)
  975. {
  976. xmlNode1.Attributes[0].Value += " " + "1";
  977. }
  978. xmlNode1.Attributes[0].Value = xmlNode1.Attributes[0].Value.TrimStart();
  979. nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  980. return nativeDoc;
  981. }
  982. }