ConfigManager.cs 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637
  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 UnityEngine.UI;
  14. using Random = UnityEngine.Random;
  15. public class ConfigManager : Regist
  16. {
  17. #region Config
  18. public static XmlNode ConfigRootNode
  19. {
  20. get
  21. {
  22. if (configRootNode == null)
  23. {
  24. configRootNode = ConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode);
  25. }
  26. return configRootNode;
  27. }
  28. set { configRootNode = value; }
  29. }
  30. public static XmlNode configRootNode;
  31. public static XmlDocument ConfigDocument
  32. {
  33. get
  34. {
  35. if (configDocument == null)
  36. {
  37. LoadConfigDocument();
  38. }
  39. return configDocument;
  40. }
  41. set { configDocument = value; }
  42. }
  43. public static XmlDocument configDocument;
  44. public static float UrlTimer;
  45. public static bool PlayerDocumentDamageFlag;
  46. public static bool IDRequestFlag;
  47. public static bool SerialNumberRequestFlag = true;
  48. public static XmlDocument DefaultConfigDocument = new XmlDocument();
  49. public static int ConfigReplayVersion = -1000;
  50. public static string ConfigPath
  51. {
  52. get
  53. {
  54. if (string.IsNullOrEmpty(configPath))
  55. {
  56. configPath = string.Format("{0}/{1}", Application.persistentDataPath, ResourceLabel.PlayerConfigXml);
  57. }
  58. return configPath;
  59. }
  60. }
  61. public static string configPath;
  62. #endregion
  63. private static string UnvalidConfigMD5 = "";
  64. private static void LoadConfigDocument()
  65. {
  66. //if (!PlayerPrefManager.GetBool(PlayerPrefManager.INTERACT_CONFIG, false))
  67. //{
  68. // Debug.LogWarning("Download Archive : did not interact");
  69. // PlayerDocumentDamageFlag = true;
  70. // SerialNumberRequestFlag = false;
  71. // return;
  72. //}
  73. int defaultVersion;
  74. int nativeVersion;
  75. XmlNode node;
  76. XmlDocument nativeDoc = new XmlDocument();
  77. if (File.Exists(ConfigPath))
  78. {
  79. try
  80. {
  81. StreamReader sr = new StreamReader(ConfigPath);
  82. nativeDoc.LoadXml(sr.ReadToEnd());
  83. sr.Close();
  84. Auxiliary.DecryptXml(nativeDoc);
  85. }
  86. catch (Exception)
  87. {
  88. Debug.LogWarning("Download Archive : MD5 doesn't match");
  89. //ManaDebug.Log("Download Archive");
  90. PlayerDocumentDamageFlag = true;
  91. SerialNumberRequestFlag = false;
  92. return;
  93. }
  94. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Config);
  95. DefaultConfigDocument.LoadXml(textAsset.text);
  96. defaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  97. node = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version);
  98. if (node == null)
  99. {
  100. StreamWriter sw = new StreamWriter(ConfigPath);
  101. sw.Write(DefaultConfigDocument.OuterXml);
  102. sw.Close();
  103. configDocument = DefaultConfigDocument;
  104. }
  105. else
  106. {
  107. nativeVersion = int.Parse(node.Attributes[0].Value);
  108. if (nativeVersion == ConfigReplayVersion)
  109. {
  110. configDocument = DefaultConfigDocument;
  111. int currentReplayVersion = int.Parse(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion).Attributes[0].Value);
  112. SaveIntToConfig(PlayerConfigLabel.ReplayVersion, currentReplayVersion + 1);
  113. //Debug.Log(currentReplayVersion);
  114. }
  115. else if (nativeVersion < defaultVersion)
  116. {
  117. byte[] bytes;
  118. MD5 md5 = new MD5CryptoServiceProvider();
  119. if (nativeVersion <= 4)
  120. {
  121. bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
  122. }
  123. else
  124. {
  125. bytes = File.ReadAllBytes(ConfigPath);
  126. }
  127. if (PlayerPrefs.GetString(Lib.ConfigPrefs) != UnvalidConfigMD5 && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes)))
  128. {
  129. Debug.LogWarning("Download Archive : MD5 doesn't match");
  130. //ManaDebug.Log("Download Archive");
  131. PlayerDocumentDamageFlag = true;
  132. SerialNumberRequestFlag = false;
  133. return;
  134. }
  135. else
  136. {
  137. configDocument = UpdateConfigDocument(nativeVersion, nativeDoc, DefaultConfigDocument);
  138. //HttpManager.UploadConfig();
  139. }
  140. }
  141. else if (nativeVersion > defaultVersion)
  142. {
  143. configDocument = DefaultConfigDocument;
  144. }
  145. else
  146. {
  147. byte[] bytes = File.ReadAllBytes(ConfigPath);
  148. MD5 md5 = new MD5CryptoServiceProvider();
  149. if (PlayerPrefs.GetString(Lib.ConfigPrefs) != UnvalidConfigMD5 && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes)))
  150. {
  151. Debug.LogWarning("Download Archive : MD5 doesn't match");
  152. //ManaDebug.Log("Download Archive");
  153. PlayerDocumentDamageFlag = true;
  154. SerialNumberRequestFlag = false;
  155. return;
  156. }
  157. configDocument = nativeDoc;
  158. }
  159. }
  160. }
  161. else
  162. {
  163. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Config);
  164. DefaultConfigDocument.LoadXml(textAsset.text);
  165. Debug.LogWarning("Download Archive");
  166. //ManaDebug.Log("Download Archive");
  167. PlayerDocumentDamageFlag = true;
  168. SerialNumberRequestFlag = false;
  169. return;
  170. }
  171. }
  172. private float MaxUrlWaitTime = 10;
  173. public void Update()
  174. {
  175. if (PlayerDocumentDamageFlag)
  176. {
  177. UrlTimer += Time.deltaTime;
  178. if (UrlTimer >= MaxUrlWaitTime)
  179. {
  180. PlayerDocumentDamageFlag = false;
  181. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Config);
  182. configDocument = new XmlDocument();
  183. configDocument.LoadXml(textAsset.text);
  184. return;
  185. }
  186. }
  187. if (!SerialNumberRequestFlag)
  188. {
  189. if (HttpManager.SerialNumber != PlayerConfigLabel.DefaultSerialNumber)
  190. {
  191. SerialNumberRequestFlag = true;
  192. HttpManager.GetConfigBySerialNumber(HttpManager.SerialNumber, RecoveConfigDocument);
  193. }
  194. }
  195. }
  196. public override bool InitAtOnce()
  197. {
  198. if (base.InitAtOnce())
  199. {
  200. return true;
  201. }
  202. enabled = true;
  203. return false;
  204. }
  205. public static void RecoveConfigDocument(JsonData jsonData)
  206. {
  207. if (!PlayerDocumentDamageFlag)
  208. {
  209. return;
  210. }
  211. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Config);
  212. DefaultConfigDocument.LoadXml(textAsset.text);
  213. //Debug.Log(jsonData.ToJson());
  214. if (jsonData.Inst_Object.Keys.Contains("l"))
  215. {
  216. XmlDocument recoverdDocument = new XmlDocument();
  217. recoverdDocument.LoadXml(jsonData["l"].ToString());
  218. int RecoverdVersion = int.Parse(recoverdDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  219. int DefaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  220. PlayerDocumentDamageFlag = false;
  221. if (RecoverdVersion <= DefaultVersion)
  222. {
  223. UpdateConfigDocument(RecoverdVersion, recoverdDocument, DefaultConfigDocument);
  224. configDocument = recoverdDocument;
  225. PlayerPrefManager.SaveBool(PlayerPrefManager.INTERACT_CONFIG, true);
  226. }
  227. else if (RecoverdVersion > DefaultVersion)
  228. {
  229. configDocument = DefaultConfigDocument;
  230. }
  231. }
  232. else
  233. {
  234. if (!IDRequestFlag)
  235. {
  236. if (HttpManager.ID != PlayerConfigLabel.DefaultID)
  237. {
  238. IDRequestFlag = true;
  239. Debug.LogWarning("DownloadByID");
  240. HttpManager.GetConfigByID(HttpManager.ID, RecoveConfigDocument);
  241. }
  242. else
  243. {
  244. Debug.LogWarning("Use Default");
  245. configDocument = DefaultConfigDocument;
  246. PlayerDocumentDamageFlag = false;
  247. }
  248. }
  249. else
  250. {
  251. Debug.LogWarning("Use Default");
  252. configDocument = DefaultConfigDocument;
  253. PlayerDocumentDamageFlag = false;
  254. }
  255. }
  256. }
  257. public static void SaveSkillList()
  258. {
  259. if (TutorialManager.NewplayerTutorial || !Manager.Inited)
  260. {
  261. return;
  262. }
  263. XmlNode xmlNode;
  264. XmlAttribute xmlAttribute;
  265. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  266. xmlNode.RemoveAll();
  267. for (int i = 0; i < Manager.SkillList.Count; i++)
  268. {
  269. if (Manager.SkillList[i].SkillType == SkillType.Skill)
  270. {
  271. #region Skill
  272. Skill skill = (Skill)Manager.SkillList[i];
  273. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  274. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  275. xmlAttribute.Value = skill.FullID;
  276. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  277. xmlAttribute.Value = skill.SkillType.ToString();
  278. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  279. xmlAttribute.Value = skill.ItemStatus.ToString();
  280. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  281. xmlAttribute.Value = skill.Level.ToString();
  282. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.CoolTimer));
  283. xmlAttribute.Value = skill.CoolTimer.ToString("0");
  284. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.UseTimer));
  285. xmlAttribute.Value = skill.UseTimer.ToString("0");
  286. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  287. #endregion
  288. }
  289. else if (Manager.SkillList[i].SkillType == SkillType.Pack)
  290. {
  291. #region Pack
  292. Pack pack = (Pack)Manager.SkillList[i];
  293. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  294. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  295. xmlAttribute.Value = pack.FullID;
  296. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  297. xmlAttribute.Value = pack.SkillType.ToString();
  298. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  299. xmlAttribute.Value = pack.ItemStatus.ToString();
  300. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  301. xmlAttribute.Value = pack.Level.ToString();
  302. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  303. #endregion
  304. }
  305. else if (Manager.SkillList[i].SkillType == SkillType.Ability)
  306. {
  307. #region Ability
  308. Ability ability = (Ability)Manager.SkillList[i];
  309. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  310. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  311. xmlAttribute.Value = ability.FullID;
  312. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  313. xmlAttribute.Value = ability.SkillType.ToString();
  314. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  315. xmlAttribute.Value = ability.ItemStatus.ToString();
  316. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  317. xmlAttribute.Value = ability.Level.ToString();
  318. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  319. #endregion
  320. }
  321. else if (Manager.SkillList[i].SkillType == SkillType.BigSkill)
  322. {
  323. #region BigSkill
  324. BigSkill bigSkill = (BigSkill)Manager.SkillList[i];
  325. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  326. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  327. xmlAttribute.Value = bigSkill.FullID;
  328. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  329. xmlAttribute.Value = bigSkill.SkillType.ToString();
  330. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  331. xmlAttribute.Value = bigSkill.ItemStatus.ToString();
  332. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.BarStatus));
  333. xmlAttribute.Value = bigSkill.BarStatus.ToString();
  334. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  335. xmlAttribute.Value = bigSkill.Level.ToString();
  336. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.CoolTimer));
  337. xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
  338. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.UseTimer));
  339. xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
  340. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  341. #endregion
  342. }
  343. }
  344. }
  345. public static void SaveDress()
  346. {
  347. XmlNode xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressList);
  348. xmlNode.Attributes[0].Value = "";
  349. for (int i = 0; i < PlayerManager.BoughtCloseIDs.Count; i++)
  350. {
  351. xmlNode.Attributes[0].Value += PlayerManager.BoughtCloseIDs[i] + " ";
  352. }
  353. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  354. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressData);
  355. for (int i = 0; i < PlayerManager.DressDatas.Count; i++)
  356. {
  357. xmlNode.Attributes[i].Value = PlayerManager.DressDatas[i];
  358. }
  359. }
  360. public static void SaveAchieve()
  361. {
  362. XmlNode xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveList);
  363. xmlNode.Attributes[0].Value = "";
  364. foreach (var kv in AchieveManager.AchieveItemDictionary)
  365. {
  366. if (!kv.Value.Lock)
  367. {
  368. xmlNode.Attributes[0].Value += kv.Value.ID + " ";
  369. }
  370. }
  371. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  372. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value = Manager.PlayADsAmt.ToString("0");
  373. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value = Manager.UseSkillAmt.ToString("0");
  374. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value = Manager.SignAmt.ToString("0");
  375. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value = Manager.ShareAmt.ToString("0");
  376. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value = Manager.AllElfLevel.ToString("0");
  377. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value = Manager.PlayMinigameAmt.ToString("0");
  378. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value = Manager.TotalFlowerAwardCoin.ToString("0");
  379. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value = Manager.TotalVisitPerson.ToString("0");
  380. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value = Manager.TotalSpendDiamond.ToString("0");
  381. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value = Manager.CreateRoomAmt.ToString("0");
  382. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value = Manager.CreateChestAmt.ToString("0");
  383. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value = Manager.CreateLuckyChestAmt.ToString("0");
  384. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value = Manager.CreateGuessColorChestAmt.ToString("0");
  385. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value = Manager.CreateGuessNumberChestAmt.ToString("0");
  386. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value = Manager.GetChestAwardAmt.ToString("0");
  387. }
  388. public static void SavePlantList()
  389. {
  390. if (VisitManager.InVisit || TutorialManager.NewplayerTutorial)
  391. {
  392. return;
  393. }
  394. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.PlantList).Attributes;
  395. attribute[0].Value = "";
  396. for (int i = 0; i < GardenManager.PlantSlotList.Count; i++)
  397. {
  398. Slot slot = GardenManager.PlantSlotList[i];
  399. attribute[0].Value += slot.ID + "," + slot.Index + " ";
  400. }
  401. attribute[0].Value = attribute[0].Value.TrimEnd(' ');
  402. }
  403. public static void SaveDatas()
  404. {
  405. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Coin).Attributes[0].Value = Manager.Coin.ToString("0");
  406. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Diamond).Attributes[0].Value = Manager.Diamond.ToString("0");
  407. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignTime).Attributes[0].Value = SignManager.LastSignTime.ToString();
  408. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignIndex).Attributes[0].Value = SignManager.SignIndex.ToString();
  409. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignRound).Attributes[0].Value = SignManager.SignRound.ToString();
  410. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.QuitFlag).Attributes[0].Value = HttpManager.IsConnect.ToInt().ToString();
  411. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.QuitTime).Attributes[0].Value = HttpManager.CurrentDateTime.ToString();
  412. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MiniTimer).Attributes[0].Value = Manager.MinigameCDTimer.ToString("0");
  413. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.CircleTimer).Attributes[0].Value = Manager.IncomeCircleTimer.ToString("0");
  414. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.ID).Attributes[0].Value = HttpManager.ID;
  415. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SerialNumber).Attributes[0].Value = HttpManager.SerialNumber;
  416. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Language).Attributes[0].Value = LanguageManager.CurrentLanguage.ToString();
  417. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MiniGameIndex).Attributes[0].Value = MiniGameManager.MiniGameIndex.ToString();
  418. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.NewplayerTutorial).Attributes[0].Value = TutorialManager.NewplayerTutorial.ToInt().ToString();
  419. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MemoryMinigameTutorial).Attributes[0].Value = TutorialManager.memoryMinigameTutorial.ToInt().ToString();
  420. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.VisitTutorial).Attributes[0].Value = TutorialManager.visitTutorial.ToInt().ToString();
  421. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressroomTutorial).Attributes[0].Value = TutorialManager.dressroomTutorial.ToInt().ToString();
  422. if (TutorialManager.findSoloMinigameTutorial || TutorialManager.FindSoloMinigameTutorial)
  423. {
  424. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorial).Attributes[0].Value = "1";
  425. }
  426. else
  427. {
  428. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorial).Attributes[0].Value = "0";
  429. }
  430. if (TutorialManager.findMissingMinigameTutorial || TutorialManager.FindMissingMinigameTutorial)
  431. {
  432. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial).Attributes[0].Value = "1";
  433. }
  434. else
  435. {
  436. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial).Attributes[0].Value = "0";
  437. }
  438. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom).Attributes[0].Value = TutorialManager.plazaRoomTutorial.ToInt().ToString();
  439. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.NewplayerTutorialIndex).Attributes[0].Value = TutorialManager.NewplayerTutorialIndex.ToString();
  440. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MemoryMinigameTutorialIndex).Attributes[0].Value = TutorialManager.MemoryMinigameTutorialIndex.ToString();
  441. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.VisitTutorialIndex).Attributes[0].Value = TutorialManager.VisitTutorialIndex.ToString();
  442. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressroomIndex).Attributes[0].Value = TutorialManager.DressroomTutorialIndex.ToString();
  443. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorialIndex).Attributes[0].Value = TutorialManager.FindSoloMinigameTutorialIndex.ToString();
  444. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorialIndex).Attributes[0].Value = TutorialManager.FindMissingMinigameTutorialIndex.ToString();
  445. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom).Attributes[0].Value = TutorialManager.PlazaRoomTutorialIndex.ToString();
  446. }
  447. public static void SaveFlowers()
  448. {
  449. XmlAttribute attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes[0];
  450. XmlAttribute attribute1 = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerAmtList).Attributes[0];
  451. attribute.Value = "";
  452. attribute1.Value = "";
  453. foreach (var kv in GardenManager.FlowerInfoDictionary)
  454. {
  455. if (kv.Value.Unlock)
  456. {
  457. attribute.Value += kv.Value.ID + " ";
  458. attribute1.Value += kv.Value.Amount + " ";
  459. }
  460. }
  461. attribute.Value = attribute.Value.Trim(' ');
  462. attribute1.Value = attribute1.Value.Trim(' ');
  463. }
  464. public static void SaveConfigDocument()
  465. {
  466. if (Initializer.Inited)
  467. {
  468. SaveSkillList();
  469. SaveAchieve();
  470. SaveDress();
  471. SavePlantList();
  472. SaveDatas();
  473. SaveFlowers();
  474. ChestManager.SaveToConfig();
  475. }
  476. }
  477. public static void SaveConfigDocumentToDisk()
  478. {
  479. if (Initializer.Inited)
  480. {
  481. XmlDocument doc = new XmlDocument();
  482. doc.LoadXml(ConfigDocument.OuterXml);
  483. Auxiliary.EncryptXml(doc);
  484. StreamWriter sw = new StreamWriter(ConfigPath);
  485. sw.Write(doc.OuterXml);
  486. sw.Close();
  487. byte[] bytes = File.ReadAllBytes(ConfigPath);
  488. //byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml);
  489. MD5 md5 = new MD5CryptoServiceProvider();
  490. PlayerPrefs.SetString(Lib.ConfigPrefs, Auxiliary.ToString(md5.ComputeHash(bytes)));
  491. }
  492. }
  493. public static void ResetConfigDocument()
  494. {
  495. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = ConfigReplayVersion.ToString();
  496. SaveConfigDocument();
  497. Manager.UploadConfigFlag = true;
  498. SaveConfigDocumentToDisk();
  499. Application.Quit();
  500. }
  501. public static int GetIntFormConfig(string node)
  502. {
  503. return int.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  504. }
  505. public static bool GetBoolFormConfig(string node)
  506. {
  507. return int.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  508. }
  509. public static float GetFloatFormConfig(string node)
  510. {
  511. return float.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  512. }
  513. public static string GetStringFormConfig(string node)
  514. {
  515. return ConfigRootNode.SelectSingleNode(node).Attributes[0].Value;
  516. }
  517. public static double GetDoubleFormConfig(string node)
  518. {
  519. return double.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  520. }
  521. public static void SaveIntToConfig(string node, int value)
  522. {
  523. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  524. }
  525. public static void SaveBoolToConfig(string node, bool value)
  526. {
  527. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  528. }
  529. public static void SaveFloatToConfig(string node, float value)
  530. {
  531. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  532. }
  533. public static void SaveStringToConfig(string node, string value)
  534. {
  535. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value;
  536. }
  537. public static void SaveDoubleToConfig(string node, double value)
  538. {
  539. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  540. }
  541. public static List<int> GetIntList(char splitChar, string nodeName, List<int> defaultList)
  542. {
  543. return Auxiliary.StringToInts(splitChar, ConfigRootNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  544. }
  545. public static List<string> GetStringList(char splitChar, string nodeName, List<string> defaultList)
  546. {
  547. return Auxiliary.StringToStrings(splitChar, ConfigRootNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  548. }
  549. public static List<int> GetDressList()
  550. {
  551. List<int> list = new List<int>();
  552. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressList).Attributes;
  553. return Auxiliary.StringToInts(' ', attribute[0].Value, list);
  554. }
  555. public static List<int> GetDressDataIDs(Player player)
  556. {
  557. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  558. //{
  559. // Debug.LogWarning(VARIABLE.Key);
  560. //}
  561. List<int> dressDataIDs = new List<int>();
  562. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Head]);
  563. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Dress]);
  564. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Shoe]);
  565. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.HeadWear]);
  566. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Top]);
  567. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Eye]);
  568. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Mouse]);
  569. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Wing]);
  570. return dressDataIDs;
  571. }
  572. public static List<int> GetDressDataIDs(List<string> dressdataNames)
  573. {
  574. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  575. //{
  576. // Debug.LogWarning(VARIABLE.Key);
  577. //}
  578. List<int> dressDataIDs = new List<int>();
  579. int index = 0;
  580. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  581. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  582. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  583. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  584. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  585. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  586. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  587. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  588. return dressDataIDs;
  589. }
  590. public static List<int> GetDressDataIDs(ISFSObject parameter)
  591. {
  592. List<int> ids = parameter.GetIntArray(InfoLabel.Close.GetHashString()).ToList();
  593. return ids;
  594. }
  595. public static List<string> GetDressData(SFSObject parameter)
  596. {
  597. List<int> ids = GetDressDataIDs(parameter);
  598. List<string> dressData = new List<string>();
  599. foreach (var id in ids)
  600. {
  601. dressData.Add(PlayerManager.CloseItemDictionary[id].ArmatureName);
  602. }
  603. return dressData;
  604. }
  605. public static List<string> GetDressData(XmlNode node = null)
  606. {
  607. XmlNode xmlNode;
  608. if (node == null)
  609. {
  610. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressData);
  611. }
  612. else
  613. {
  614. xmlNode = node.SelectSingleNode(PlayerConfigLabel.DressData);
  615. }
  616. List<string> dataList = new List<string>();
  617. if (xmlNode != null && xmlNode.Attributes.Count == 12)
  618. {
  619. dataList.Add(xmlNode.Attributes[0].Value);
  620. dataList.Add(xmlNode.Attributes[1].Value);
  621. dataList.Add(xmlNode.Attributes[2].Value);
  622. dataList.Add(xmlNode.Attributes[3].Value);
  623. dataList.Add(xmlNode.Attributes[4].Value);
  624. dataList.Add(xmlNode.Attributes[5].Value);
  625. dataList.Add(xmlNode.Attributes[6].Value);
  626. dataList.Add(xmlNode.Attributes[7].Value);
  627. dataList.Add(xmlNode.Attributes[8].Value);
  628. dataList.Add(xmlNode.Attributes[9].Value);
  629. dataList.Add(xmlNode.Attributes[10].Value);
  630. dataList.Add(xmlNode.Attributes[11].Value);
  631. //dataList[8] = "长袖9左";
  632. //dataList[9] = "Empty";
  633. //dataList[10] = "长袖9右";
  634. //dataList[11] = "Empty";
  635. }
  636. else if(xmlNode != null && xmlNode.Attributes.Count == 8)
  637. {
  638. dataList.Add(xmlNode.Attributes[0].Value);
  639. dataList.Add(xmlNode.Attributes[1].Value);
  640. dataList.Add(xmlNode.Attributes[2].Value);
  641. dataList.Add(xmlNode.Attributes[3].Value);
  642. dataList.Add(xmlNode.Attributes[4].Value);
  643. dataList.Add(xmlNode.Attributes[5].Value);
  644. dataList.Add(xmlNode.Attributes[6].Value);
  645. dataList.Add(xmlNode.Attributes[7].Value);
  646. dataList.AddRange (GetSleeveListByTop(xmlNode.Attributes[4].Value));
  647. }
  648. else
  649. {
  650. float rate = Random.Range(0f, 1f);
  651. if (rate < 0.33f)
  652. {
  653. dataList.Add("脑壳1");
  654. dataList.Add("裙子1");
  655. dataList.Add("鞋子1");
  656. dataList.Add("头饰品1");
  657. dataList.Add("上衣1");
  658. dataList.Add("眼睛1");
  659. dataList.Add("嘴巴1");
  660. dataList.Add("Empty");
  661. dataList.Add("Empty");
  662. dataList.Add("短袖1左");
  663. dataList.Add("Empty");
  664. dataList.Add("短袖1右");
  665. }
  666. else if (rate < 0.66f)
  667. {
  668. dataList.Add("脑壳2");
  669. dataList.Add("裙子2");
  670. dataList.Add("鞋子2");
  671. dataList.Add("头饰品2");
  672. dataList.Add("上衣2");
  673. dataList.Add("眼睛2");
  674. dataList.Add("嘴巴2");
  675. dataList.Add("Empty");
  676. dataList.Add("Empty");
  677. dataList.Add("短袖2左");
  678. dataList.Add("Empty");
  679. dataList.Add("短袖2右");
  680. }
  681. else
  682. {
  683. dataList.Add("脑壳3");
  684. dataList.Add("裙子3");
  685. dataList.Add("鞋子3");
  686. dataList.Add("头饰品3");
  687. dataList.Add("上衣3");
  688. dataList.Add("眼睛3");
  689. dataList.Add("嘴巴3");
  690. dataList.Add("Empty");
  691. dataList.Add("Empty");
  692. dataList.Add("短袖2左");
  693. dataList.Add("Empty");
  694. dataList.Add("短袖2右");
  695. }
  696. }
  697. return dataList;
  698. }
  699. public static List<int> GetFlowerList()
  700. {
  701. List<int> list = new List<int>();
  702. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes;
  703. return Auxiliary.StringToInts(' ', attribute[0].Value, list);
  704. }
  705. public static List<int> GetLockAchieveIDs()
  706. {
  707. return Auxiliary.StringToInts(' ', GetStringFormConfig(PlayerConfigLabel.AchieveList), new List<int>());
  708. }
  709. public static List<double> GetAchieveValues()
  710. {
  711. List<double> dataList = new List<double>();
  712. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value));
  713. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value));
  714. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value));
  715. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value));
  716. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value));
  717. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value));
  718. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value));
  719. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value));
  720. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value));
  721. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value));
  722. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value));
  723. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value));
  724. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value));
  725. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value));
  726. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value));
  727. return dataList;
  728. }
  729. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  730. {
  731. List<KV<int, int>> list = new List<KV<int, int>>();
  732. XmlNode xmlNode;
  733. if (node == null)
  734. {
  735. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.PlantList);
  736. }
  737. else
  738. {
  739. xmlNode = node.SelectSingleNode(PlayerConfigLabel.PlantList);
  740. }
  741. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  742. {
  743. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  744. for (int i = 0; i < strings.Length; i++)
  745. {
  746. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  747. }
  748. }
  749. return list;
  750. }
  751. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  752. {
  753. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  754. XmlNodeList xmlNodeList;
  755. if (node == null)
  756. {
  757. xmlNodeList = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes;
  758. }
  759. else
  760. {
  761. xmlNodeList = node.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes;
  762. }
  763. for (int i = 0; i < xmlNodeList.Count; i++)
  764. {
  765. attributeList.Add(xmlNodeList[i].Attributes);
  766. }
  767. return attributeList;
  768. }
  769. public static List<string> GetOfflineConfig()
  770. {
  771. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.OfflineConfig, Folder.Config);
  772. XmlDocument xmlDoc = new XmlDocument();
  773. xmlDoc.LoadXml(textAsset.text);
  774. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  775. List<string> strList = new List<string>()
  776. {
  777. xmlNode.Attributes[1].Value,
  778. xmlNode.Attributes[2].Value,
  779. xmlNode.Attributes[3].Value,
  780. };
  781. return strList;
  782. }
  783. public static XmlAttributeCollection GetVisitConfig()
  784. {
  785. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.VisitConfig, Folder.Config);
  786. XmlDocument xmlDoc = new XmlDocument();
  787. xmlDoc.LoadXml(textAsset.text);
  788. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  789. return xmlNode.Attributes;
  790. }
  791. public static XmlAttributeCollection GetPlazaRoomConfig()
  792. {
  793. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlazaroomConfig, Folder.Config);
  794. XmlDocument xmlDoc = new XmlDocument();
  795. xmlDoc.LoadXml(textAsset.text);
  796. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  797. return xmlNode.Attributes;
  798. }
  799. public static XmlAttributeCollection GetAwardConfig()
  800. {
  801. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AwardConfig, Folder.Config);
  802. XmlDocument xmlDoc = new XmlDocument();
  803. xmlDoc.LoadXml(textAsset.text);
  804. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  805. return xmlNode.Attributes;
  806. }
  807. public static List<XmlAttributeCollection> GetIAPConfig()
  808. {
  809. TextAsset textAsset;
  810. XmlNodeList xmlNodeList;
  811. XmlDocument xmlDoc = new XmlDocument();
  812. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  813. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.IAPConfig, Folder.Config);
  814. xmlDoc.LoadXml(textAsset.text);
  815. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  816. for (int i = 0; i < xmlNodeList.Count; i++)
  817. {
  818. attributeList.Add(xmlNodeList[i].Attributes);
  819. }
  820. return attributeList;
  821. }
  822. public static List<XmlAttributeCollection> GetSkillConfig()
  823. {
  824. TextAsset textAsset;
  825. XmlDocument xmlDoc = new XmlDocument();
  826. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  827. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  828. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PackConfig, Folder.Config);
  829. xmlDoc.LoadXml(textAsset.text);
  830. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  831. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.SkillConfig, Folder.Config);
  832. xmlDoc.LoadXml(textAsset.text);
  833. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  834. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AbilityConfig, Folder.Config);
  835. xmlDoc.LoadXml(textAsset.text);
  836. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  837. for (int i = 0; i < xmlNodeList.Count; i++)
  838. {
  839. for (int j = 0; j < xmlNodeList[i].Count; j++)
  840. {
  841. attributeList.Add(xmlNodeList[i][j].Attributes);
  842. }
  843. }
  844. return attributeList;
  845. }
  846. public static List<XmlAttributeCollection> GetSignConfig()
  847. {
  848. TextAsset textAsset;
  849. XmlNodeList xmlNodeList;
  850. XmlDocument xmlDoc = new XmlDocument();
  851. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  852. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.SigninConfig, Folder.Config);
  853. xmlDoc.LoadXml(textAsset.text);
  854. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  855. for (int i = 0; i < xmlNodeList.Count; i++)
  856. {
  857. attributeList.Add(xmlNodeList[i].Attributes);
  858. }
  859. return attributeList;
  860. }
  861. public static List<XmlAttributeCollection> GetFlowerConfig()
  862. {
  863. TextAsset textAsset;
  864. XmlNodeList xmlNodeList;
  865. XmlDocument xmlDoc = new XmlDocument();
  866. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  867. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.FlowerConfig, Folder.Config);
  868. xmlDoc.LoadXml(textAsset.text);
  869. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  870. for (int i = 0; i < xmlNodeList.Count; i++)
  871. {
  872. attributeList.Add(xmlNodeList[i].Attributes);
  873. }
  874. return attributeList;
  875. }
  876. public static List<XmlAttributeCollection> GetLotteryConfig()
  877. {
  878. TextAsset textAsset;
  879. XmlNodeList xmlNodeList;
  880. XmlDocument xmlDoc = new XmlDocument();
  881. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  882. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.LotteryConfig, Folder.Config);
  883. xmlDoc.LoadXml(textAsset.text);
  884. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  885. for (int i = 0; i < xmlNodeList.Count; i++)
  886. {
  887. attributeList.Add(xmlNodeList[i].Attributes);
  888. }
  889. return attributeList;
  890. }
  891. public static List<XmlAttributeCollection> GetAchieveConfig()
  892. {
  893. TextAsset textAsset;
  894. XmlNodeList xmlNodeList;
  895. XmlDocument xmlDoc = new XmlDocument();
  896. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  897. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AchieveConfig, Folder.Config);
  898. xmlDoc.LoadXml(textAsset.text);
  899. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  900. for (int i = 0; i < xmlNodeList.Count; i++)
  901. {
  902. attributeList.Add(xmlNodeList[i].Attributes);
  903. }
  904. return attributeList;
  905. }
  906. public static List<XmlAttributeCollection> GetDressRoomConfig()
  907. {
  908. TextAsset textAsset;
  909. XmlNodeList xmlNodeList;
  910. XmlDocument xmlDoc = new XmlDocument();
  911. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  912. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.DressroomConfig, Folder.Config);
  913. xmlDoc.LoadXml(textAsset.text);
  914. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  915. for (int i = 0; i < xmlNodeList.Count; i++)
  916. {
  917. attributeList.Add(xmlNodeList[i].Attributes);
  918. }
  919. return attributeList;
  920. }
  921. public static int GetGardenLevel(XmlDocument xmlDocument)
  922. {
  923. XmlNodeList nodeList = xmlDocument.SelectNodes(PlayerConfigLabel.RootNode + "/" + PlayerConfigLabel.SkillList + "/" + PlayerConfigLabel.Skill);
  924. for (int i = 0; i < nodeList.Count; i++)
  925. {
  926. if (nodeList[i].Attributes[0].Value == "Ability1")
  927. {
  928. return int.Parse(nodeList[i].Attributes[3].Value);
  929. }
  930. }
  931. return -1;
  932. }
  933. public static XmlDocument GetXmlDocument(string ConfigName)
  934. {
  935. TextAsset textAsset = ResourceManager.Load<TextAsset>(ConfigName, Folder.Config);
  936. XmlDocument xmlDocument = new XmlDocument();
  937. xmlDocument.LoadXml(textAsset.text);
  938. return xmlDocument;
  939. }
  940. //玩家存档版本大于默认存档版本时需要清空
  941. //玩家存档版本小于默认存档版本时需要更新
  942. //玩家存档版本等于ReplayVersion时需要标记为重玩
  943. public static XmlDocument UpdateConfigDocument(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc)
  944. {
  945. if (nativeVersion < 0)
  946. {
  947. Debug.LogWarning("UpdateArchive to 0");
  948. ToVersion0(nativeDoc, defaultDoc);
  949. }
  950. if (nativeVersion < 1)
  951. {
  952. Debug.LogWarning("UpdateArchive to 1");
  953. ToVersion1(nativeDoc, defaultDoc);
  954. }
  955. if (nativeVersion < 2)
  956. {
  957. Debug.LogWarning("UpdateArchive to 2");
  958. ToVersion2(nativeDoc, defaultDoc);
  959. }
  960. if (nativeVersion < 3)
  961. {
  962. Debug.LogWarning("UpdateArchive to 3");
  963. ToVersion3(nativeDoc, defaultDoc);
  964. }
  965. if (nativeVersion < 4)
  966. {
  967. Debug.LogWarning("UpdateArchive to 4");
  968. ToVersion4(nativeDoc, defaultDoc);
  969. }
  970. if (nativeVersion < 5)
  971. {
  972. Debug.LogWarning("UpdateArchive to 5");
  973. ToVersion5(nativeDoc, defaultDoc);
  974. }
  975. if (nativeVersion < 6)
  976. {
  977. Debug.LogWarning("UpdateArchive to 6");
  978. ToVersion6(nativeDoc, defaultDoc);
  979. }
  980. if (nativeVersion < 7)
  981. {
  982. Debug.LogWarning("UpdateArchive to 7");
  983. ToVersion7(nativeDoc, defaultDoc);
  984. }
  985. if (nativeVersion < 8)
  986. {
  987. Debug.LogWarning("UpdateArchive to 8");
  988. ToVersion8(nativeDoc, defaultDoc);
  989. }
  990. if (nativeVersion < 9)
  991. {
  992. Debug.LogWarning("UpdateArchive to 9");
  993. ToVersion9(nativeDoc, defaultDoc);
  994. }
  995. if (nativeVersion < 10)
  996. {
  997. Debug.LogWarning("UpdateArchive to 10");
  998. ToVersion10(nativeDoc, defaultDoc);
  999. }
  1000. if (nativeVersion < 11)
  1001. {
  1002. Debug.LogWarning("UpdateArchive to 11");
  1003. ToVersion11(nativeDoc, defaultDoc);
  1004. }
  1005. if (nativeVersion < 12)
  1006. {
  1007. Debug.LogWarning("UpdateArchive to 12");
  1008. ToVersion12(nativeDoc, defaultDoc);
  1009. }
  1010. if (nativeVersion < 13)
  1011. {
  1012. Debug.LogWarning("UpdateArchive to 13");
  1013. ToVersion13(nativeDoc, defaultDoc);
  1014. }
  1015. if (nativeVersion < 14)
  1016. {
  1017. Debug.LogWarning("UpdateArchive to 14");
  1018. ToVersion14(nativeDoc, defaultDoc);
  1019. }
  1020. if (nativeVersion < 15)
  1021. {
  1022. Debug.LogWarning("UpdateArchive to 15");
  1023. ToVersion15(nativeDoc, defaultDoc);
  1024. }
  1025. if (nativeVersion < 16)
  1026. {
  1027. Debug.LogWarning("UpdateArchive to 16");
  1028. ToVersion16(nativeDoc, defaultDoc);
  1029. }
  1030. return nativeDoc;
  1031. }
  1032. public static XmlDocument ToVersion0(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1033. {
  1034. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 0.ToString();
  1035. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ADPlayTime);
  1036. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1037. return nativeDoc;
  1038. }
  1039. public static XmlDocument ToVersion1(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1040. {
  1041. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 1.ToString();
  1042. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.SerialNumber);
  1043. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1044. return nativeDoc;
  1045. }
  1046. public static XmlDocument ToVersion2(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1047. {
  1048. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 2.ToString();
  1049. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NotificationIndex);
  1050. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1051. return nativeDoc;
  1052. }
  1053. public static XmlDocument ToVersion3(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1054. {
  1055. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 3.ToString();
  1056. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NickName);
  1057. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1058. return nativeDoc;
  1059. }
  1060. public static XmlDocument ToVersion4(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1061. {
  1062. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 4.ToString();
  1063. XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.DressData);
  1064. XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftLongSleeveSlot));
  1065. attribute.Value="Empty";
  1066. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftShortSleeveSlot));
  1067. attribute.Value="Empty";
  1068. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightLongSleeveSlot));
  1069. attribute.Value="Empty";
  1070. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightShortSleeveSlot));
  1071. attribute.Value="Empty";
  1072. List<string> sleeveList = GetSleeveListByTop (xmlNode.Attributes [4].Value);
  1073. xmlNode.Attributes [8].Value = sleeveList[0];
  1074. xmlNode.Attributes [9].Value = sleeveList[1];
  1075. xmlNode.Attributes [10].Value = sleeveList[2];
  1076. xmlNode.Attributes [11].Value = sleeveList[3];
  1077. return nativeDoc;
  1078. }
  1079. public static List<string> GetSleeveListByTop(string topName)
  1080. {
  1081. List<string> sleeveList = new List<string>() {"Empty", "Empty", "Empty", "Empty"};
  1082. if (topName == "上衣1")
  1083. {
  1084. sleeveList[1] = "短袖1左";
  1085. sleeveList[3] = "短袖1右";
  1086. }
  1087. else if (topName == "上衣2")
  1088. {
  1089. sleeveList[1] = "短袖2左";
  1090. sleeveList[3] = "短袖2右";
  1091. }
  1092. else if (topName == "上衣3")
  1093. {
  1094. sleeveList[1] = "短袖2左";
  1095. sleeveList[3] = "短袖2右";
  1096. }
  1097. else if (topName == "上衣5")
  1098. {
  1099. sleeveList[1] = "短袖2左";
  1100. sleeveList[3] = "短袖2右";
  1101. }
  1102. else if (topName == "上衣6")
  1103. {
  1104. sleeveList[1] = "短袖6左";
  1105. sleeveList[3] = "短袖6右";
  1106. }
  1107. else if (topName == "上衣7")
  1108. {
  1109. sleeveList[1] = "短袖7左";
  1110. sleeveList[3] = "短袖7右";
  1111. }
  1112. else if (topName == "上衣7(粉)")
  1113. {
  1114. sleeveList[1] = "短袖7粉左";
  1115. sleeveList[3] = "短袖7粉右";
  1116. }
  1117. else if (topName == "上衣12")
  1118. {
  1119. sleeveList[1] = "短袖12左";
  1120. sleeveList[3] = "短袖12右";
  1121. }
  1122. else if (topName == "上衣13")
  1123. {
  1124. sleeveList[1] = "短袖13左";
  1125. sleeveList[3] = "短袖13右";
  1126. }
  1127. else if (topName == "上衣13(紫)")
  1128. {
  1129. sleeveList[1] = "短袖13蓝左";
  1130. sleeveList[3] = "短袖13蓝右";
  1131. }
  1132. else
  1133. {
  1134. sleeveList[0] = "长袖9左";
  1135. sleeveList[2] = "长袖9右";
  1136. }
  1137. return sleeveList;
  1138. }
  1139. public static XmlDocument ToVersion5(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1140. {
  1141. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 5.ToString();
  1142. return nativeDoc;
  1143. }
  1144. public static XmlDocument ToVersion6(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1145. {
  1146. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 6.ToString();
  1147. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NewFlowerFlag);
  1148. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1149. return nativeDoc;
  1150. }
  1151. private static int DefaultFlowerAmt = 1;
  1152. public static XmlDocument ToVersion7(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1153. {
  1154. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 7.ToString();
  1155. XmlNode xmlNode1 = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerList);
  1156. string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' ');
  1157. xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerAmtList);
  1158. xmlNode1.Attributes[0].Value = "";
  1159. foreach (var flowerID in flowerIDs)
  1160. {
  1161. xmlNode1.Attributes[0].Value += " " + DefaultFlowerAmt;
  1162. }
  1163. xmlNode1.Attributes[0].Value = xmlNode1.Attributes[0].Value.TrimStart();
  1164. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1165. return nativeDoc;
  1166. }
  1167. public static XmlDocument ToVersion8(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1168. {
  1169. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 8.ToString();
  1170. XmlNode xmlNode0 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom);
  1171. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom);
  1172. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode0, true));
  1173. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1174. return nativeDoc;
  1175. }
  1176. private static int DefaultAchieveValue = 0;
  1177. public static XmlDocument ToVersion9(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1178. {
  1179. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 9.ToString();
  1180. XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.AchieveData);
  1181. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateRoomAmt));
  1182. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateChestAmt));
  1183. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateLuckyChestAmt));
  1184. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessColorChestAmt));
  1185. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessNumberChestAmt));
  1186. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.GetChestAwardAmt));
  1187. xmlNode.Attributes[9].Value = DefaultAchieveValue.ToString();
  1188. xmlNode.Attributes[10].Value = DefaultAchieveValue.ToString();
  1189. xmlNode.Attributes[11].Value = DefaultAchieveValue.ToString();
  1190. xmlNode.Attributes[12].Value = DefaultAchieveValue.ToString();
  1191. xmlNode.Attributes[13].Value = DefaultAchieveValue.ToString();
  1192. xmlNode.Attributes[14].Value = DefaultAchieveValue.ToString();
  1193. return nativeDoc;
  1194. }
  1195. public static XmlDocument ToVersion10(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1196. {
  1197. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 10.ToString();
  1198. ChestManager.ClearRefundAndOperateData(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode));
  1199. return nativeDoc;
  1200. }
  1201. public static XmlDocument ToVersion11(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1202. {
  1203. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 11.ToString();
  1204. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion);
  1205. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1206. return nativeDoc;
  1207. }
  1208. public static XmlDocument ToVersion12(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1209. {
  1210. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 12.ToString();
  1211. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ExtraSlot);
  1212. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1213. return nativeDoc;
  1214. }
  1215. public static XmlDocument ToVersion13(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1216. {
  1217. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 13.ToString();
  1218. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.CurrentMinigameType);
  1219. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1220. return nativeDoc;
  1221. }
  1222. public static XmlDocument ToVersion14(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1223. {
  1224. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 14.ToString();
  1225. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.LastPrivateMessageDate);
  1226. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1227. return nativeDoc;
  1228. }
  1229. public static XmlDocument ToVersion15(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1230. {
  1231. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 15.ToString();
  1232. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.LastApplicantSerialNumber);
  1233. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1234. return nativeDoc;
  1235. }
  1236. public static XmlDocument ToVersion16(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1237. {
  1238. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 16.ToString();
  1239. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial);
  1240. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1241. xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorialIndex);
  1242. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1243. return nativeDoc;
  1244. }
  1245. }