ConfigManager.cs 58 KB

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