ConfigManager.cs 86 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310
  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. string cacheStr = PlayerPrefManager.GetStr(PlayerPrefManager.PLAYER_CONFIG, null);
  89. if (cacheStr == null)
  90. {
  91. Debug.LogWarning("Download Archive : MD5 doesn't match");
  92. //ManaDebug.Log("Download Archive");
  93. PlayerDocumentDamageFlag = true;
  94. SerialNumberRequestFlag = false;
  95. return;
  96. }
  97. else
  98. {
  99. Debug.LogWarning("Recover Archive From PlayerPref : MD5 doesn't match");
  100. nativeDoc.LoadXml(cacheStr);
  101. }
  102. }
  103. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Default);
  104. DefaultConfigDocument.LoadXml(textAsset.text);
  105. defaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  106. node = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version);
  107. if (node == null)
  108. {
  109. StreamWriter sw = new StreamWriter(ConfigPath);
  110. sw.Write(DefaultConfigDocument.OuterXml);
  111. sw.Close();
  112. configDocument = DefaultConfigDocument;
  113. }
  114. else
  115. {
  116. nativeVersion = int.Parse(node.Attributes[0].Value);
  117. if (nativeVersion == ConfigReplayVersion)
  118. {
  119. configDocument = DefaultConfigDocument;
  120. int currentReplayVersion = int.Parse(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion).Attributes[0].Value);
  121. SaveIntToConfig(PlayerConfigLabel.ReplayVersion, currentReplayVersion + 1);
  122. //Debug.Log(currentReplayVersion);
  123. }
  124. else if (nativeVersion < defaultVersion)
  125. {
  126. byte[] bytes;
  127. MD5 md5 = new MD5CryptoServiceProvider();
  128. if (nativeVersion <= 4)
  129. {
  130. bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
  131. }
  132. else
  133. {
  134. bytes = File.ReadAllBytes(ConfigPath);
  135. }
  136. if (PlayerPrefs.GetString(Lib.ConfigPrefs) != UnvalidConfigMD5 && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes)))
  137. {
  138. string cacheStr = PlayerPrefManager.GetStr(PlayerPrefManager.PLAYER_CONFIG, null);
  139. if (cacheStr == null)
  140. {
  141. Debug.LogWarning("Download Archive : MD5 doesn't match");
  142. //ManaDebug.Log("Download Archive");
  143. PlayerDocumentDamageFlag = true;
  144. SerialNumberRequestFlag = false;
  145. return;
  146. }
  147. else
  148. {
  149. Debug.LogWarning("Recover Archive From PlayerPref : MD5 doesn't match");
  150. nativeDoc.LoadXml(cacheStr);
  151. configDocument = UpdateConfigDocument(nativeVersion, nativeDoc, DefaultConfigDocument);
  152. }
  153. }
  154. else
  155. {
  156. configDocument = UpdateConfigDocument(nativeVersion, nativeDoc, DefaultConfigDocument);
  157. //HttpManager.UploadConfig();
  158. }
  159. }
  160. else if (nativeVersion > defaultVersion)
  161. {
  162. configDocument = nativeDoc;
  163. }
  164. else
  165. {
  166. byte[] bytes = File.ReadAllBytes(ConfigPath);
  167. MD5 md5 = new MD5CryptoServiceProvider();
  168. if (PlayerPrefs.GetString(Lib.ConfigPrefs) != UnvalidConfigMD5 && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes)))
  169. {
  170. string cacheStr = PlayerPrefManager.GetStr(PlayerPrefManager.PLAYER_CONFIG, null);
  171. if (cacheStr == null)
  172. {
  173. Debug.LogWarning("Download Archive : MD5 doesn't match");
  174. //ManaDebug.Log("Download Archive");
  175. PlayerDocumentDamageFlag = true;
  176. SerialNumberRequestFlag = false;
  177. return;
  178. }
  179. else
  180. {
  181. Debug.LogWarning("Recover Archive From PlayerPref : MD5 doesn't match");
  182. nativeDoc.LoadXml(cacheStr);
  183. }
  184. }
  185. configDocument = nativeDoc;
  186. }
  187. }
  188. }
  189. else
  190. {
  191. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Default);
  192. DefaultConfigDocument.LoadXml(textAsset.text);
  193. string cacheStr = PlayerPrefManager.GetStr(PlayerPrefManager.PLAYER_CONFIG, null);
  194. if (cacheStr == null)
  195. {
  196. Debug.LogWarning("Download Archive");
  197. //ManaDebug.Log("Download Archive");
  198. PlayerDocumentDamageFlag = true;
  199. SerialNumberRequestFlag = false;
  200. return;
  201. }
  202. else
  203. {
  204. Debug.LogWarning("Recover Archive From PlayerPref : file doesn't exist");
  205. nativeDoc.LoadXml(cacheStr);
  206. node = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version);
  207. nativeVersion = int.Parse(node.Attributes[0].Value);
  208. configDocument = UpdateConfigDocument(nativeVersion, nativeDoc, DefaultConfigDocument);
  209. }
  210. }
  211. }
  212. private float MaxUrlWaitTime = 10;
  213. public void Update()
  214. {
  215. if (PlayerDocumentDamageFlag)
  216. {
  217. UrlTimer += Time.deltaTime;
  218. if (UrlTimer >= MaxUrlWaitTime)
  219. {
  220. PlayerDocumentDamageFlag = false;
  221. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Default);
  222. configDocument = new XmlDocument();
  223. configDocument.LoadXml(textAsset.text);
  224. return;
  225. }
  226. }
  227. if (!SerialNumberRequestFlag)
  228. {
  229. if (HttpManager.SerialNumber != PlayerConfigLabel.DefaultSerialNumber)
  230. {
  231. SerialNumberRequestFlag = true;
  232. HttpManager.GetConfigBySerialNumber(HttpManager.SerialNumber, RecoveConfigDocument);
  233. }
  234. }
  235. }
  236. public override bool InitAtOnce()
  237. {
  238. if (base.InitAtOnce())
  239. {
  240. return true;
  241. }
  242. enabled = true;
  243. return false;
  244. }
  245. public static void RecoveConfigDocument(JsonData jsonData)
  246. {
  247. if (!PlayerDocumentDamageFlag)
  248. {
  249. return;
  250. }
  251. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlayerConfig, Folder.Default);
  252. DefaultConfigDocument.LoadXml(textAsset.text);
  253. //Debug.Log(jsonData.ToJson());
  254. if (jsonData.Inst_Object.Keys.Contains("l"))
  255. {
  256. XmlDocument recoverdDocument = new XmlDocument();
  257. recoverdDocument.LoadXml(jsonData["l"].ToString());
  258. int RecoverdVersion = int.Parse(recoverdDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  259. int DefaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
  260. PlayerDocumentDamageFlag = false;
  261. if (RecoverdVersion <= DefaultVersion)
  262. {
  263. UpdateConfigDocument(RecoverdVersion, recoverdDocument, DefaultConfigDocument);
  264. configDocument = recoverdDocument;
  265. PlayerPrefManager.SaveBool(PlayerPrefManager.INTERACT_CONFIG, true);
  266. }
  267. else if (RecoverdVersion > DefaultVersion)
  268. {
  269. //configDocument = DefaultConfigDocument;
  270. }
  271. }
  272. else
  273. {
  274. if (!IDRequestFlag)
  275. {
  276. if (HttpManager.ID != PlayerConfigLabel.DefaultID)
  277. {
  278. IDRequestFlag = true;
  279. Debug.LogWarning("DownloadByID");
  280. HttpManager.GetConfigByID(HttpManager.ID, RecoveConfigDocument);
  281. }
  282. else
  283. {
  284. Debug.LogWarning("Use Default");
  285. configDocument = DefaultConfigDocument;
  286. PlayerDocumentDamageFlag = false;
  287. }
  288. }
  289. else
  290. {
  291. Debug.LogWarning("Use Default");
  292. configDocument = DefaultConfigDocument;
  293. PlayerDocumentDamageFlag = false;
  294. }
  295. }
  296. }
  297. public static void SaveSkillList()
  298. {
  299. if (TutorialManager.NewplayerTutorial || !Manager.Inited)
  300. {
  301. return;
  302. }
  303. XmlNode xmlNode;
  304. XmlAttribute xmlAttribute;
  305. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  306. xmlNode.RemoveAll();
  307. for (int i = 0; i < Manager.SkillList.Count; i++)
  308. {
  309. if (Manager.SkillList[i].SkillType == SkillType.Skill)
  310. {
  311. #region Skill
  312. Skill skill = (Skill)Manager.SkillList[i];
  313. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  314. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  315. xmlAttribute.Value = skill.FullID;
  316. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  317. xmlAttribute.Value = skill.SkillType.ToString();
  318. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  319. xmlAttribute.Value = skill.ItemStatus.ToString();
  320. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  321. xmlAttribute.Value = skill.Level.ToString();
  322. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.CoolTimer));
  323. xmlAttribute.Value = skill.CoolTimer.ToString("0");
  324. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.UseTimer));
  325. xmlAttribute.Value = skill.UseTimer.ToString("0");
  326. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  327. #endregion
  328. }
  329. else if (Manager.SkillList[i].SkillType == SkillType.Pack)
  330. {
  331. #region Pack
  332. Pack pack = (Pack)Manager.SkillList[i];
  333. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  334. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  335. xmlAttribute.Value = pack.FullID;
  336. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  337. xmlAttribute.Value = pack.SkillType.ToString();
  338. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  339. xmlAttribute.Value = pack.ItemStatus.ToString();
  340. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  341. xmlAttribute.Value = pack.Level.ToString();
  342. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  343. #endregion
  344. }
  345. else if (Manager.SkillList[i].SkillType == SkillType.Ability)
  346. {
  347. #region Ability
  348. Ability ability = (Ability)Manager.SkillList[i];
  349. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  350. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  351. xmlAttribute.Value = ability.FullID;
  352. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  353. xmlAttribute.Value = ability.SkillType.ToString();
  354. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  355. xmlAttribute.Value = ability.ItemStatus.ToString();
  356. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  357. xmlAttribute.Value = ability.Level.ToString();
  358. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  359. #endregion
  360. }
  361. else if (Manager.SkillList[i].SkillType == SkillType.BigSkill)
  362. {
  363. #region BigSkill
  364. BigSkill bigSkill = (BigSkill)Manager.SkillList[i];
  365. xmlNode = xmlNode.AppendChild(ConfigDocument.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, ""));
  366. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ID));
  367. xmlAttribute.Value = bigSkill.FullID;
  368. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.SkillType));
  369. xmlAttribute.Value = bigSkill.SkillType.ToString();
  370. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.ItemStatus));
  371. xmlAttribute.Value = bigSkill.ItemStatus.ToString();
  372. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.BarStatus));
  373. xmlAttribute.Value = bigSkill.BarStatus.ToString();
  374. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.Level));
  375. xmlAttribute.Value = bigSkill.Level.ToString();
  376. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.CoolTimer));
  377. xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
  378. xmlAttribute = xmlNode.Attributes.Append(ConfigDocument.CreateAttribute(PlayerConfigLabel.UseTimer));
  379. xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
  380. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList);
  381. #endregion
  382. }
  383. }
  384. }
  385. public static void SaveDress()
  386. {
  387. XmlNode xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressList);
  388. xmlNode.Attributes[0].Value = "";
  389. for (int i = 0; i < PlayerManager.BoughtCloseIDs.Count; i++)
  390. {
  391. xmlNode.Attributes[0].Value += PlayerManager.BoughtCloseIDs[i] + " ";
  392. }
  393. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  394. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressData);
  395. for (int i = 0; i < PlayerManager.DressDatas.Count; i++)
  396. {
  397. xmlNode.Attributes[i].Value = PlayerManager.DressDatas[i];
  398. }
  399. }
  400. public static void SaveAchieve()
  401. {
  402. XmlNode xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveList);
  403. xmlNode.Attributes[0].Value = "";
  404. foreach (var kv in AchieveManager.AchieveItemDictionary)
  405. {
  406. if (!kv.Value.Lock)
  407. {
  408. xmlNode.Attributes[0].Value += kv.Value.ID + " ";
  409. }
  410. }
  411. xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
  412. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value = Manager.PlayADsAmt.ToString("0");
  413. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value = Manager.UseSkillAmt.ToString("0");
  414. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value = Manager.SignAmt.ToString("0");
  415. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value = Manager.ShareAmt.ToString("0");
  416. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value = Manager.AllElfLevel.ToString("0");
  417. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value = Manager.PlayMinigameAmt.ToString("0");
  418. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value = Manager.TotalFlowerAwardCoin.ToString("0");
  419. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value = Manager.TotalVisitPerson.ToString("0");
  420. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value = Manager.TotalSpendDiamond.ToString("0");
  421. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value = Manager.CreateRoomAmt.ToString("0");
  422. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value = Manager.CreateChestAmt.ToString("0");
  423. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value = Manager.CreateLuckyChestAmt.ToString("0");
  424. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value = Manager.CreateGuessColorChestAmt.ToString("0");
  425. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value = Manager.CreateGuessNumberChestAmt.ToString("0");
  426. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value = Manager.GetChestAwardAmt.ToString("0");
  427. }
  428. public static void SavePlantList()
  429. {
  430. if (VisitManager.InVisit || TutorialManager.NewplayerTutorial)
  431. {
  432. return;
  433. }
  434. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.PlantList).Attributes;
  435. attribute[0].Value = "";
  436. for (int i = 0; i < GardenManager.PlantSlotList.Count; i++)
  437. {
  438. Slot slot = GardenManager.PlantSlotList[i];
  439. attribute[0].Value += slot.ID + "," + slot.Index + " ";
  440. }
  441. attribute[0].Value = attribute[0].Value.TrimEnd(' ');
  442. }
  443. public static void SaveDatas()
  444. {
  445. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Coin).Attributes[0].Value = Manager.Coin.ToString("0");
  446. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Diamond).Attributes[0].Value = Manager.Diamond.ToString("0");
  447. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignTime).Attributes[0].Value = SignManager.LastSignTime.ToString();
  448. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignIndex).Attributes[0].Value = SignManager.SignIndex.ToString();
  449. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SignRound).Attributes[0].Value = SignManager.SignRound.ToString();
  450. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.QuitFlag).Attributes[0].Value = HttpManager.IsConnect.ToInt().ToString();
  451. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.QuitTime).Attributes[0].Value = HttpManager.CurrentDateTime.ToString();
  452. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MiniTimer).Attributes[0].Value = Manager.MinigameCDTimer.ToString("0");
  453. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.CircleTimer).Attributes[0].Value = Manager.IncomeCircleTimer.ToString("0");
  454. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.ID).Attributes[0].Value = HttpManager.ID;
  455. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SerialNumber).Attributes[0].Value = HttpManager.SerialNumber;
  456. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Language).Attributes[0].Value = LanguageManager.CurrentLanguage.ToString();
  457. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MiniGameIndex).Attributes[0].Value = MiniGameManager.MiniGameIndex.ToString();
  458. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.NewplayerTutorial).Attributes[0].Value = TutorialManager.NewplayerTutorial.ToInt().ToString();
  459. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MemoryMinigameTutorial).Attributes[0].Value = TutorialManager.memoryMinigameTutorial.ToInt().ToString();
  460. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.VisitTutorial).Attributes[0].Value = TutorialManager.visitTutorial.ToInt().ToString();
  461. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressroomTutorial).Attributes[0].Value = TutorialManager.dressroomTutorial.ToInt().ToString();
  462. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FashionShowTutorial).Attributes[0].Value = TutorialManager.fashionShowTutorial.ToInt().ToString();
  463. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.ChangeMouseTutorial).Attributes[0].Value = TutorialManager.changeMouseTutorial.ToInt().ToString();
  464. if (TutorialManager.findSoloMinigameTutorial || TutorialManager.FindSoloMinigameTutorial)
  465. {
  466. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorial).Attributes[0].Value = "1";
  467. }
  468. else
  469. {
  470. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorial).Attributes[0].Value = "0";
  471. }
  472. if (TutorialManager.findMissingMinigameTutorial || TutorialManager.FindMissingMinigameTutorial)
  473. {
  474. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial).Attributes[0].Value = "1";
  475. }
  476. else
  477. {
  478. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial).Attributes[0].Value = "0";
  479. }
  480. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom).Attributes[0].Value = TutorialManager.plazaRoomTutorial.ToInt().ToString();
  481. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.NewplayerTutorialIndex).Attributes[0].Value = TutorialManager.NewplayerTutorialIndex.ToString();
  482. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.MemoryMinigameTutorialIndex).Attributes[0].Value = TutorialManager.MemoryMinigameTutorialIndex.ToString();
  483. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.VisitTutorialIndex).Attributes[0].Value = TutorialManager.VisitTutorialIndex.ToString();
  484. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressroomIndex).Attributes[0].Value = TutorialManager.DressroomTutorialIndex.ToString();
  485. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindSoloMinigameTutorialIndex).Attributes[0].Value = TutorialManager.FindSoloMinigameTutorialIndex.ToString();
  486. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorialIndex).Attributes[0].Value = TutorialManager.FindMissingMinigameTutorialIndex.ToString();
  487. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom).Attributes[0].Value = TutorialManager.PlazaRoomTutorialIndex.ToString();
  488. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FashionShowTutorialIndex).Attributes[0].Value = TutorialManager.FashionShowTutorialIndex.ToString();
  489. }
  490. public static void SaveFlowers()
  491. {
  492. XmlAttribute attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes[0];
  493. XmlAttribute attribute1 = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerAmtList).Attributes[0];
  494. attribute.Value = "";
  495. attribute1.Value = "";
  496. foreach (var kv in GardenManager.GetFlowerInfoDict())
  497. {
  498. if (kv.Value.Unlock)
  499. {
  500. attribute.Value += kv.Value.ID + " ";
  501. attribute1.Value += kv.Value.Amount + " ";
  502. }
  503. }
  504. attribute.Value = attribute.Value.Trim(' ');
  505. attribute1.Value = attribute1.Value.Trim(' ');
  506. }
  507. public static void SaveConfigDocument()
  508. {
  509. if (Initializer.Inited)
  510. {
  511. SaveSkillList();
  512. SaveAchieve();
  513. SaveDress();
  514. SavePlantList();
  515. SaveDatas();
  516. SaveFlowers();
  517. ChestManager.SaveToConfig();
  518. }
  519. }
  520. public static void SaveConfigDocumentToDisk()
  521. {
  522. if (Initializer.Inited)
  523. {
  524. PlayerPrefManager.SaveStr(PlayerPrefManager.PLAYER_CONFIG, ConfigDocument.OuterXml);
  525. XmlDocument doc = new XmlDocument();
  526. doc.LoadXml(ConfigDocument.OuterXml);
  527. Auxiliary.EncryptXml(doc);
  528. StreamWriter sw = new StreamWriter(ConfigPath);
  529. sw.Write(doc.OuterXml);
  530. sw.Close();
  531. byte[] bytes = File.ReadAllBytes(ConfigPath);
  532. //byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml);
  533. MD5 md5 = new MD5CryptoServiceProvider();
  534. PlayerPrefs.SetString(Lib.ConfigPrefs, Auxiliary.ToString(md5.ComputeHash(bytes)));
  535. }
  536. }
  537. public static void ResetConfigDocument()
  538. {
  539. ConfigRootNode.SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = ConfigReplayVersion.ToString();
  540. SaveConfigDocument();
  541. Manager.UploadConfigFlag = true;
  542. Manager.DownloadConfigFlag = true;
  543. SaveConfigDocumentToDisk();
  544. DelayCall.Call
  545. (
  546. 1,
  547. () =>
  548. {
  549. Bubble.Show(null, Language.GetStr(LanguageLabel.UI__La_Lab0), null, null, () => { Application.Quit(); }, null, false);
  550. }
  551. );
  552. }
  553. public static int GetIntFormConfig(string node)
  554. {
  555. return int.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  556. }
  557. public static bool GetBoolFormConfig(string node)
  558. {
  559. return int.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value).ToBool();
  560. }
  561. public static float GetFloatFormConfig(string node)
  562. {
  563. return float.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  564. }
  565. public static string GetStringFormConfig(string node)
  566. {
  567. return ConfigRootNode.SelectSingleNode(node).Attributes[0].Value;
  568. }
  569. public static double GetDoubleFormConfig(string node)
  570. {
  571. return double.Parse(ConfigRootNode.SelectSingleNode(node).Attributes[0].Value);
  572. }
  573. public static void SaveIntToConfig(string node, int value)
  574. {
  575. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  576. }
  577. public static void SaveBoolToConfig(string node, bool value)
  578. {
  579. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString();
  580. }
  581. public static void SaveFloatToConfig(string node, float value)
  582. {
  583. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  584. }
  585. public static void SaveStringToConfig(string node, string value)
  586. {
  587. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value;
  588. }
  589. public static void SaveDoubleToConfig(string node, double value)
  590. {
  591. ConfigRootNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
  592. }
  593. public static List<int> GetIntList(char splitChar, string nodeName, List<int> defaultList)
  594. {
  595. return Auxiliary.StringToInts(splitChar, ConfigRootNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  596. }
  597. public static List<string> GetStringList(char splitChar, string nodeName, List<string> defaultList)
  598. {
  599. return Auxiliary.StringToStrings(splitChar, ConfigRootNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
  600. }
  601. public static List<int> GetDressList()
  602. {
  603. List<int> list = new List<int>();
  604. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressList).Attributes;
  605. return Auxiliary.StringToInts(' ', attribute[0].Value, list);
  606. }
  607. public static List<int> GetDressDataIDs(Player player)
  608. {
  609. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  610. //{
  611. // Debug.LogWarning(VARIABLE.Key);
  612. //}
  613. List<int> dressDataIDs = new List<int>();
  614. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Head]);
  615. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Dress]);
  616. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Shoe]);
  617. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.HeadWear]);
  618. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Top]);
  619. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Eye]);
  620. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Mouse]);
  621. dressDataIDs.Add(PlayerManager.CloseIDDictionary[player.Wing]);
  622. return dressDataIDs;
  623. }
  624. public static List<int> GetDressDataIDs(List<string> dressdataNames)
  625. {
  626. //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
  627. //{
  628. // Debug.LogWarning(VARIABLE.Key);
  629. //}
  630. List<int> dressDataIDs = new List<int>();
  631. int index = 0;
  632. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  633. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  634. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  635. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  636. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  637. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  638. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  639. dressDataIDs.Add(PlayerManager.CloseIDDictionary[dressdataNames[index++]]);
  640. return dressDataIDs;
  641. }
  642. public static List<int> GetDressDataIDs(ISFSObject parameter)
  643. {
  644. List<int> ids = parameter.GetIntArray(InfoLabel.Close.GetHashString()).ToList();
  645. return ids;
  646. }
  647. public static List<string> GetDressData(SFSObject parameter)
  648. {
  649. List<int> ids = GetDressDataIDs(parameter);
  650. List<string> dressData = new List<string>();
  651. foreach (var id in ids)
  652. {
  653. dressData.Add(PlayerManager.CloseItemDictionary[id].ArmatureName);
  654. }
  655. return dressData;
  656. }
  657. public static List<string> GetDressData(XmlNode node = null)
  658. {
  659. XmlNode xmlNode;
  660. if (node == null)
  661. {
  662. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.DressData);
  663. }
  664. else
  665. {
  666. xmlNode = node.SelectSingleNode(PlayerConfigLabel.DressData);
  667. }
  668. List<string> dataList = new List<string>();
  669. if (xmlNode != null && xmlNode.Attributes.Count == 12)
  670. {
  671. dataList.Add(xmlNode.Attributes[0].Value);
  672. dataList.Add(xmlNode.Attributes[1].Value);
  673. dataList.Add(xmlNode.Attributes[2].Value);
  674. dataList.Add(xmlNode.Attributes[3].Value);
  675. dataList.Add(xmlNode.Attributes[4].Value);
  676. dataList.Add(xmlNode.Attributes[5].Value);
  677. dataList.Add(xmlNode.Attributes[6].Value);
  678. dataList.Add(xmlNode.Attributes[7].Value);
  679. dataList.Add(xmlNode.Attributes[8].Value);
  680. dataList.Add(xmlNode.Attributes[9].Value);
  681. dataList.Add(xmlNode.Attributes[10].Value);
  682. dataList.Add(xmlNode.Attributes[11].Value);
  683. //dataList[8] = "长袖9左";
  684. //dataList[9] = "Empty";
  685. //dataList[10] = "长袖9右";
  686. //dataList[11] = "Empty";
  687. }
  688. else if(xmlNode != null && xmlNode.Attributes.Count == 8)
  689. {
  690. dataList.Add(xmlNode.Attributes[0].Value);
  691. dataList.Add(xmlNode.Attributes[1].Value);
  692. dataList.Add(xmlNode.Attributes[2].Value);
  693. dataList.Add(xmlNode.Attributes[3].Value);
  694. dataList.Add(xmlNode.Attributes[4].Value);
  695. dataList.Add(xmlNode.Attributes[5].Value);
  696. dataList.Add(xmlNode.Attributes[6].Value);
  697. dataList.Add(xmlNode.Attributes[7].Value);
  698. dataList.AddRange (GetSleeveListByTop(xmlNode.Attributes[4].Value));
  699. }
  700. else
  701. {
  702. float rate = Random.Range(0f, 1f);
  703. if (rate < 0.33f)
  704. {
  705. dataList.Add("脑壳1");
  706. dataList.Add("裙子1");
  707. dataList.Add("鞋子1");
  708. dataList.Add("头饰品1");
  709. dataList.Add("上衣1");
  710. dataList.Add("眼睛1");
  711. dataList.Add("嘴巴1");
  712. dataList.Add("Empty");
  713. dataList.Add("Empty");
  714. dataList.Add("短袖1左");
  715. dataList.Add("Empty");
  716. dataList.Add("短袖1右");
  717. }
  718. else if (rate < 0.66f)
  719. {
  720. dataList.Add("脑壳2");
  721. dataList.Add("裙子2");
  722. dataList.Add("鞋子2");
  723. dataList.Add("头饰品2");
  724. dataList.Add("上衣2");
  725. dataList.Add("眼睛2");
  726. dataList.Add("嘴巴2");
  727. dataList.Add("Empty");
  728. dataList.Add("Empty");
  729. dataList.Add("短袖2左");
  730. dataList.Add("Empty");
  731. dataList.Add("短袖2右");
  732. }
  733. else
  734. {
  735. dataList.Add("脑壳3");
  736. dataList.Add("裙子3");
  737. dataList.Add("鞋子3");
  738. dataList.Add("头饰品3");
  739. dataList.Add("上衣3");
  740. dataList.Add("眼睛3");
  741. dataList.Add("嘴巴3");
  742. dataList.Add("Empty");
  743. dataList.Add("Empty");
  744. dataList.Add("短袖2左");
  745. dataList.Add("Empty");
  746. dataList.Add("短袖2右");
  747. }
  748. }
  749. return dataList;
  750. }
  751. public static List<int> GetFlowerList()
  752. {
  753. List<int> list = new List<int>();
  754. XmlAttributeCollection attribute = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes;
  755. return Auxiliary.StringToInts(' ', attribute[0].Value, list);
  756. }
  757. public static List<int> GetLockAchieveIDs()
  758. {
  759. return Auxiliary.StringToInts(' ', GetStringFormConfig(PlayerConfigLabel.AchieveList), new List<int>());
  760. }
  761. public static List<double> GetAchieveValues()
  762. {
  763. List<double> dataList = new List<double>();
  764. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value));
  765. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value));
  766. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value));
  767. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value));
  768. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value));
  769. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value));
  770. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value));
  771. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value));
  772. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value));
  773. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value));
  774. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value));
  775. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value));
  776. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value));
  777. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value));
  778. dataList.Add(double.Parse(ConfigRootNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value));
  779. return dataList;
  780. }
  781. public static List<KV<int, int>> GetPlantList(XmlNode node = null)
  782. {
  783. List<KV<int, int>> list = new List<KV<int, int>>();
  784. XmlNode xmlNode;
  785. if (node == null)
  786. {
  787. xmlNode = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.PlantList);
  788. }
  789. else
  790. {
  791. xmlNode = node.SelectSingleNode(PlayerConfigLabel.PlantList);
  792. }
  793. if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value))
  794. {
  795. string[] strings = xmlNode.Attributes[0].Value.Split(' ');
  796. for (int i = 0; i < strings.Length; i++)
  797. {
  798. list.Add(new KV<int, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
  799. }
  800. }
  801. return list;
  802. }
  803. public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
  804. {
  805. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  806. XmlNodeList xmlNodeList;
  807. if (node == null)
  808. {
  809. xmlNodeList = ConfigRootNode.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes;
  810. }
  811. else
  812. {
  813. xmlNodeList = node.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes;
  814. }
  815. for (int i = 0; i < xmlNodeList.Count; i++)
  816. {
  817. attributeList.Add(xmlNodeList[i].Attributes);
  818. }
  819. return attributeList;
  820. }
  821. public static List<string> GetOfflineConfig()
  822. {
  823. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.OfflineConfig, Folder.Config);
  824. XmlDocument xmlDoc = new XmlDocument();
  825. xmlDoc.LoadXml(textAsset.text);
  826. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  827. List<string> strList = new List<string>()
  828. {
  829. xmlNode.Attributes[1].Value,
  830. xmlNode.Attributes[2].Value,
  831. xmlNode.Attributes[3].Value,
  832. };
  833. return strList;
  834. }
  835. public static XmlAttributeCollection GetVisitConfig()
  836. {
  837. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.VisitConfig, Folder.Config);
  838. XmlDocument xmlDoc = new XmlDocument();
  839. xmlDoc.LoadXml(textAsset.text);
  840. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  841. return xmlNode.Attributes;
  842. }
  843. public static XmlAttributeCollection GetPlazaRoomConfig()
  844. {
  845. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PlazaroomConfig, Folder.Config);
  846. XmlDocument xmlDoc = new XmlDocument();
  847. xmlDoc.LoadXml(textAsset.text);
  848. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  849. return xmlNode.Attributes;
  850. }
  851. public static XmlAttributeCollection GetAwardConfig()
  852. {
  853. TextAsset textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AwardConfig, Folder.Config);
  854. XmlDocument xmlDoc = new XmlDocument();
  855. xmlDoc.LoadXml(textAsset.text);
  856. XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode);
  857. return xmlNode.Attributes;
  858. }
  859. public static List<XmlAttributeCollection> GetIAPConfig()
  860. {
  861. TextAsset textAsset;
  862. XmlNodeList xmlNodeList;
  863. XmlDocument xmlDoc = new XmlDocument();
  864. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  865. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.IAPConfig, Folder.Config);
  866. xmlDoc.LoadXml(textAsset.text);
  867. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  868. for (int i = 0; i < xmlNodeList.Count; i++)
  869. {
  870. attributeList.Add(xmlNodeList[i].Attributes);
  871. }
  872. return attributeList;
  873. }
  874. public static List<XmlAttributeCollection> GetSkillConfig()
  875. {
  876. TextAsset textAsset;
  877. XmlDocument xmlDoc = new XmlDocument();
  878. List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
  879. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  880. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.PackConfig, Folder.Config);
  881. xmlDoc.LoadXml(textAsset.text);
  882. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  883. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.SkillConfig, Folder.Config);
  884. xmlDoc.LoadXml(textAsset.text);
  885. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  886. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AbilityConfig, Folder.Config);
  887. xmlDoc.LoadXml(textAsset.text);
  888. xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode));
  889. for (int i = 0; i < xmlNodeList.Count; i++)
  890. {
  891. for (int j = 0; j < xmlNodeList[i].Count; j++)
  892. {
  893. attributeList.Add(xmlNodeList[i][j].Attributes);
  894. }
  895. }
  896. return attributeList;
  897. }
  898. public static List<XmlAttributeCollection> GetSignConfig()
  899. {
  900. TextAsset textAsset;
  901. XmlNodeList xmlNodeList;
  902. XmlDocument xmlDoc = new XmlDocument();
  903. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  904. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.SigninConfig, Folder.Config);
  905. xmlDoc.LoadXml(textAsset.text);
  906. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  907. for (int i = 0; i < xmlNodeList.Count; i++)
  908. {
  909. attributeList.Add(xmlNodeList[i].Attributes);
  910. }
  911. return attributeList;
  912. }
  913. public static List<XmlAttributeCollection> GetFlowerConfig(TextAsset textAsset = null)
  914. {
  915. XmlNodeList xmlNodeList;
  916. XmlDocument xmlDoc = new XmlDocument();
  917. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  918. if (textAsset == null)
  919. {
  920. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.FlowerConfig, Folder.Config);
  921. }
  922. xmlDoc.LoadXml(textAsset.text);
  923. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  924. for (int i = 0; i < xmlNodeList.Count; i++)
  925. {
  926. attributeList.Add(xmlNodeList[i].Attributes);
  927. }
  928. return attributeList;
  929. }
  930. public static List<XmlAttributeCollection> GetLotteryConfig()
  931. {
  932. TextAsset textAsset;
  933. XmlNodeList xmlNodeList;
  934. XmlDocument xmlDoc = new XmlDocument();
  935. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  936. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.LotteryConfig, Folder.Config);
  937. xmlDoc.LoadXml(textAsset.text);
  938. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  939. for (int i = 0; i < xmlNodeList.Count; i++)
  940. {
  941. attributeList.Add(xmlNodeList[i].Attributes);
  942. }
  943. return attributeList;
  944. }
  945. public static List<XmlAttributeCollection> GetAchieveConfig()
  946. {
  947. TextAsset textAsset;
  948. XmlNodeList xmlNodeList;
  949. XmlDocument xmlDoc = new XmlDocument();
  950. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  951. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.AchieveConfig, Folder.Config);
  952. xmlDoc.LoadXml(textAsset.text);
  953. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  954. for (int i = 0; i < xmlNodeList.Count; i++)
  955. {
  956. attributeList.Add(xmlNodeList[i].Attributes);
  957. }
  958. return attributeList;
  959. }
  960. public static List<XmlAttributeCollection> GetDressRoomConfig(TextAsset textAsset = null)
  961. {
  962. XmlNodeList xmlNodeList;
  963. XmlDocument xmlDoc = new XmlDocument();
  964. List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
  965. if (textAsset == null)
  966. {
  967. textAsset = ResourceManager.Load<TextAsset>(ResourceLabel.DressroomConfig, Folder.Config);
  968. }
  969. xmlDoc.LoadXml(textAsset.text);
  970. xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode);
  971. for (int i = 0; i < xmlNodeList.Count; i++)
  972. {
  973. attributeList.Add(xmlNodeList[i].Attributes);
  974. }
  975. return attributeList;
  976. }
  977. public static int GetGardenLevel(XmlDocument xmlDocument)
  978. {
  979. XmlNodeList nodeList = xmlDocument.SelectNodes(PlayerConfigLabel.RootNode + "/" + PlayerConfigLabel.SkillList + "/" + PlayerConfigLabel.Skill);
  980. for (int i = 0; i < nodeList.Count; i++)
  981. {
  982. if (nodeList[i].Attributes[0].Value == "Ability1")
  983. {
  984. return int.Parse(nodeList[i].Attributes[3].Value);
  985. }
  986. }
  987. return -1;
  988. }
  989. public static int GetConfigVersion(XmlDocument xmlDocument)
  990. {
  991. return int.Parse(xmlDocument.SelectSingleNode(PlayerConfigLabel.RootNode + "/" + PlayerConfigLabel.Version).Attributes[0].Value);
  992. }
  993. public static List<string> GetDefaultDressDatas()
  994. {
  995. List<string> defaultDressDatas = new List<string>();
  996. defaultDressDatas.Add("脑壳-缺失");
  997. defaultDressDatas.Add("裙子-缺失");
  998. defaultDressDatas.Add("鞋子-缺失");
  999. defaultDressDatas.Add("头饰-缺失");
  1000. defaultDressDatas.Add("上衣-缺失");
  1001. defaultDressDatas.Add("眼睛1");
  1002. defaultDressDatas.Add("嘴巴1");
  1003. defaultDressDatas.Add("翅膀-缺失");
  1004. defaultDressDatas.Add("Empty");
  1005. defaultDressDatas.Add("Empty");
  1006. defaultDressDatas.Add("Empty");
  1007. defaultDressDatas.Add("Empty");
  1008. //defaultDressDatas.Add("脑壳1");
  1009. //defaultDressDatas.Add("裙子1");
  1010. //defaultDressDatas.Add("鞋子1");
  1011. //defaultDressDatas.Add("头饰品1");
  1012. //defaultDressDatas.Add("上衣1");
  1013. //defaultDressDatas.Add("眼睛1");
  1014. //defaultDressDatas.Add("嘴巴1");
  1015. //defaultDressDatas.Add("Empty");
  1016. //defaultDressDatas.Add("Empty");
  1017. //defaultDressDatas.Add("短袖2左");
  1018. //defaultDressDatas.Add("Empty");
  1019. //defaultDressDatas.Add("短袖2右");
  1020. return defaultDressDatas;
  1021. }
  1022. public static XmlDocument GetXmlDocument(string ConfigName)
  1023. {
  1024. TextAsset textAsset = ResourceManager.Load<TextAsset>(ConfigName, Folder.Config);
  1025. XmlDocument xmlDocument = new XmlDocument();
  1026. xmlDocument.LoadXml(textAsset.text);
  1027. return xmlDocument;
  1028. }
  1029. //玩家存档版本大于默认存档版本时需要清空
  1030. //玩家存档版本小于默认存档版本时需要更新
  1031. //玩家存档版本等于ReplayVersion时需要标记为重玩
  1032. public static XmlDocument UpdateConfigDocument(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc)
  1033. {
  1034. if (nativeVersion < 0)
  1035. {
  1036. Debug.LogWarning("UpdateArchive to 0");
  1037. ToVersion0(nativeDoc, defaultDoc);
  1038. }
  1039. if (nativeVersion < 1)
  1040. {
  1041. Debug.LogWarning("UpdateArchive to 1");
  1042. ToVersion1(nativeDoc, defaultDoc);
  1043. }
  1044. if (nativeVersion < 2)
  1045. {
  1046. Debug.LogWarning("UpdateArchive to 2");
  1047. ToVersion2(nativeDoc, defaultDoc);
  1048. }
  1049. if (nativeVersion < 3)
  1050. {
  1051. Debug.LogWarning("UpdateArchive to 3");
  1052. ToVersion3(nativeDoc, defaultDoc);
  1053. }
  1054. if (nativeVersion < 4)
  1055. {
  1056. Debug.LogWarning("UpdateArchive to 4");
  1057. ToVersion4(nativeDoc, defaultDoc);
  1058. }
  1059. if (nativeVersion < 5)
  1060. {
  1061. Debug.LogWarning("UpdateArchive to 5");
  1062. ToVersion5(nativeDoc, defaultDoc);
  1063. }
  1064. if (nativeVersion < 6)
  1065. {
  1066. Debug.LogWarning("UpdateArchive to 6");
  1067. ToVersion6(nativeDoc, defaultDoc);
  1068. }
  1069. if (nativeVersion < 7)
  1070. {
  1071. Debug.LogWarning("UpdateArchive to 7");
  1072. ToVersion7(nativeDoc, defaultDoc);
  1073. }
  1074. if (nativeVersion < 8)
  1075. {
  1076. Debug.LogWarning("UpdateArchive to 8");
  1077. ToVersion8(nativeDoc, defaultDoc);
  1078. }
  1079. if (nativeVersion < 9)
  1080. {
  1081. Debug.LogWarning("UpdateArchive to 9");
  1082. ToVersion9(nativeDoc, defaultDoc);
  1083. }
  1084. if (nativeVersion < 10)
  1085. {
  1086. Debug.LogWarning("UpdateArchive to 10");
  1087. ToVersion10(nativeDoc, defaultDoc);
  1088. }
  1089. if (nativeVersion < 11)
  1090. {
  1091. Debug.LogWarning("UpdateArchive to 11");
  1092. ToVersion11(nativeDoc, defaultDoc);
  1093. }
  1094. if (nativeVersion < 12)
  1095. {
  1096. Debug.LogWarning("UpdateArchive to 12");
  1097. ToVersion12(nativeDoc, defaultDoc);
  1098. }
  1099. if (nativeVersion < 13)
  1100. {
  1101. Debug.LogWarning("UpdateArchive to 13");
  1102. ToVersion13(nativeDoc, defaultDoc);
  1103. }
  1104. if (nativeVersion < 14)
  1105. {
  1106. Debug.LogWarning("UpdateArchive to 14");
  1107. ToVersion14(nativeDoc, defaultDoc);
  1108. }
  1109. if (nativeVersion < 15)
  1110. {
  1111. Debug.LogWarning("UpdateArchive to 15");
  1112. ToVersion15(nativeDoc, defaultDoc);
  1113. }
  1114. if (nativeVersion < 16)
  1115. {
  1116. Debug.LogWarning("UpdateArchive to 16");
  1117. ToVersion16(nativeDoc, defaultDoc);
  1118. }
  1119. if (nativeVersion < 17)
  1120. {
  1121. Debug.LogWarning("UpdateArchive to 17");
  1122. ToVersion17(nativeDoc, defaultDoc);
  1123. }
  1124. if (nativeVersion < 18)
  1125. {
  1126. Debug.LogWarning("UpdateArchive to 18");
  1127. ToVersion18(nativeDoc, defaultDoc);
  1128. }
  1129. if (nativeVersion < 19)
  1130. {
  1131. Debug.LogWarning("UpdateArchive to 19");
  1132. ToVersion19(nativeDoc, defaultDoc);
  1133. }
  1134. if (nativeVersion < 20)
  1135. {
  1136. Debug.LogWarning("UpdateArchive to 20");
  1137. ToVersion20(nativeDoc, defaultDoc);
  1138. }
  1139. if (nativeVersion < 21)
  1140. {
  1141. Debug.LogWarning("UpdateArchive to 21");
  1142. ToVersion21(nativeDoc, defaultDoc);
  1143. }
  1144. if (nativeVersion < 22)
  1145. {
  1146. Debug.LogWarning("UpdateArchive to 22");
  1147. ToVersion22(nativeDoc, defaultDoc);
  1148. }
  1149. if (nativeVersion < 23)
  1150. {
  1151. Debug.LogWarning("UpdateArchive to 23");
  1152. ToVersion23(nativeDoc, defaultDoc);
  1153. }
  1154. if (nativeVersion < 24)
  1155. {
  1156. Debug.LogWarning("UpdateArchive to 24");
  1157. ToVersion24(nativeDoc, defaultDoc);
  1158. }
  1159. if (nativeVersion < 25)
  1160. {
  1161. Debug.LogWarning("UpdateArchive to 25");
  1162. ToVersion25(nativeDoc, defaultDoc);
  1163. }
  1164. if (nativeVersion < 26)
  1165. {
  1166. Debug.LogWarning("UpdateArchive to 26");
  1167. ToVersion26(nativeDoc, defaultDoc);
  1168. }
  1169. if (nativeVersion < 28)
  1170. {
  1171. Debug.LogWarning("UpdateArchive to 28");
  1172. ToVersion28(nativeDoc, defaultDoc);
  1173. }
  1174. if (nativeVersion < 29)
  1175. {
  1176. Debug.LogWarning("UpdateArchive to 29");
  1177. ToVersion29(nativeDoc, defaultDoc);
  1178. }
  1179. if (nativeVersion < 30)
  1180. {
  1181. Debug.LogWarning("UpdateArchive to 30");
  1182. ToVersion30(nativeDoc, defaultDoc);
  1183. }
  1184. if (nativeVersion < 31)
  1185. {
  1186. Debug.LogWarning("UpdateArchive to 31");
  1187. ToVersion31(nativeDoc, defaultDoc);
  1188. }
  1189. if (nativeVersion < 32)
  1190. {
  1191. Debug.LogWarning("UpdateArchive to 32");
  1192. ToVersion32(nativeDoc, defaultDoc);
  1193. }
  1194. if (nativeVersion < 33)
  1195. {
  1196. Debug.LogWarning("UpdateArchive to 33");
  1197. ToVersion33(nativeDoc, defaultDoc);
  1198. }
  1199. if (nativeVersion < 34)
  1200. {
  1201. Debug.LogWarning("UpdateArchive to 34");
  1202. ToVersion34(nativeDoc, defaultDoc);
  1203. }
  1204. if (nativeVersion < 35)
  1205. {
  1206. Debug.LogWarning("UpdateArchive to 35");
  1207. ToVersion35(nativeDoc, defaultDoc);
  1208. }
  1209. if (nativeVersion < 36)
  1210. {
  1211. Debug.LogWarning("UpdateArchive to 36");
  1212. ToVersion36(nativeDoc, defaultDoc);
  1213. }
  1214. if (nativeVersion < 37)
  1215. {
  1216. Debug.LogWarning("UpdateArchive to 37");
  1217. ToVersion37(nativeDoc, defaultDoc);
  1218. }
  1219. if (nativeVersion < 38)
  1220. {
  1221. Debug.LogWarning("UpdateArchive to 38");
  1222. ToVersion38(nativeDoc, defaultDoc);
  1223. }
  1224. if (nativeVersion < 39)
  1225. {
  1226. Debug.LogWarning("UpdateArchive to 39");
  1227. ToVersion39(nativeDoc, defaultDoc);
  1228. }
  1229. if (nativeVersion < 40)
  1230. {
  1231. Debug.LogWarning("UpdateArchive to 40");
  1232. ToVersion40(nativeDoc, defaultDoc);
  1233. }
  1234. if (nativeVersion < 41)
  1235. {
  1236. Debug.LogWarning("UpdateArchive to 41");
  1237. ToVersion41(nativeDoc, defaultDoc);
  1238. }
  1239. if (nativeVersion < 42)
  1240. {
  1241. Debug.LogWarning("UpdateArchive to 42");
  1242. ToVersion42(nativeDoc, defaultDoc);
  1243. }
  1244. if (nativeVersion < 43)
  1245. {
  1246. Debug.LogWarning("UpdateArchive to 43");
  1247. ToVersion43(nativeDoc, defaultDoc);
  1248. }
  1249. if (nativeVersion < 44)
  1250. {
  1251. Debug.LogWarning("UpdateArchive to 44");
  1252. ToVersion44(nativeDoc, defaultDoc);
  1253. }
  1254. if (nativeVersion < 45)
  1255. {
  1256. Debug.LogWarning("UpdateArchive to 45");
  1257. ToVersion45(nativeDoc, defaultDoc);
  1258. }
  1259. return nativeDoc;
  1260. }
  1261. public static XmlDocument ToVersion0(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1262. {
  1263. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 0.ToString();
  1264. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ADPlayTime);
  1265. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1266. return nativeDoc;
  1267. }
  1268. public static XmlDocument ToVersion1(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1269. {
  1270. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 1.ToString();
  1271. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.SerialNumber);
  1272. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1273. return nativeDoc;
  1274. }
  1275. public static XmlDocument ToVersion2(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1276. {
  1277. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 2.ToString();
  1278. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NotificationIndex);
  1279. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1280. return nativeDoc;
  1281. }
  1282. public static XmlDocument ToVersion3(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1283. {
  1284. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 3.ToString();
  1285. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NickName);
  1286. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1287. return nativeDoc;
  1288. }
  1289. public static XmlDocument ToVersion4(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1290. {
  1291. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 4.ToString();
  1292. XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.DressData);
  1293. XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftLongSleeveSlot));
  1294. attribute.Value="Empty";
  1295. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftShortSleeveSlot));
  1296. attribute.Value="Empty";
  1297. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightLongSleeveSlot));
  1298. attribute.Value="Empty";
  1299. attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightShortSleeveSlot));
  1300. attribute.Value="Empty";
  1301. List<string> sleeveList = GetSleeveListByTop (xmlNode.Attributes [4].Value);
  1302. xmlNode.Attributes [8].Value = sleeveList[0];
  1303. xmlNode.Attributes [9].Value = sleeveList[1];
  1304. xmlNode.Attributes [10].Value = sleeveList[2];
  1305. xmlNode.Attributes [11].Value = sleeveList[3];
  1306. return nativeDoc;
  1307. }
  1308. public static List<string> GetSleeveListByTop(string topName)
  1309. {
  1310. List<string> sleeveList = new List<string>() {"Empty", "Empty", "Empty", "Empty"};
  1311. if (topName == "上衣1")
  1312. {
  1313. sleeveList[1] = "短袖1左";
  1314. sleeveList[3] = "短袖1右";
  1315. }
  1316. else if (topName == "上衣2")
  1317. {
  1318. sleeveList[1] = "短袖2左";
  1319. sleeveList[3] = "短袖2右";
  1320. }
  1321. else if (topName == "上衣3")
  1322. {
  1323. sleeveList[1] = "短袖2左";
  1324. sleeveList[3] = "短袖2右";
  1325. }
  1326. else if (topName == "上衣5")
  1327. {
  1328. sleeveList[1] = "短袖2左";
  1329. sleeveList[3] = "短袖2右";
  1330. }
  1331. else if (topName == "上衣6")
  1332. {
  1333. sleeveList[1] = "短袖6左";
  1334. sleeveList[3] = "短袖6右";
  1335. }
  1336. else if (topName == "上衣7")
  1337. {
  1338. sleeveList[1] = "短袖7左";
  1339. sleeveList[3] = "短袖7右";
  1340. }
  1341. else if (topName == "上衣7(粉)")
  1342. {
  1343. sleeveList[1] = "短袖7粉左";
  1344. sleeveList[3] = "短袖7粉右";
  1345. }
  1346. else if (topName == "上衣12")
  1347. {
  1348. sleeveList[1] = "短袖12左";
  1349. sleeveList[3] = "短袖12右";
  1350. }
  1351. else if (topName == "上衣13")
  1352. {
  1353. sleeveList[1] = "短袖13左";
  1354. sleeveList[3] = "短袖13右";
  1355. }
  1356. else if (topName == "上衣13(紫)")
  1357. {
  1358. sleeveList[1] = "短袖13蓝左";
  1359. sleeveList[3] = "短袖13蓝右";
  1360. }
  1361. else
  1362. {
  1363. sleeveList[0] = "长袖9左";
  1364. sleeveList[2] = "长袖9右";
  1365. }
  1366. return sleeveList;
  1367. }
  1368. public static XmlDocument ToVersion5(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1369. {
  1370. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 5.ToString();
  1371. return nativeDoc;
  1372. }
  1373. public static XmlDocument ToVersion6(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1374. {
  1375. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 6.ToString();
  1376. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NewFlowerFlag);
  1377. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1378. return nativeDoc;
  1379. }
  1380. private static int DefaultFlowerAmt = 1;
  1381. public static XmlDocument ToVersion7(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1382. {
  1383. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 7.ToString();
  1384. XmlNode xmlNode1 = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerList);
  1385. string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' ');
  1386. xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerAmtList);
  1387. xmlNode1.Attributes[0].Value = "";
  1388. foreach (var flowerID in flowerIDs)
  1389. {
  1390. xmlNode1.Attributes[0].Value += " " + DefaultFlowerAmt;
  1391. }
  1392. xmlNode1.Attributes[0].Value = xmlNode1.Attributes[0].Value.TrimStart();
  1393. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1394. return nativeDoc;
  1395. }
  1396. public static XmlDocument ToVersion8(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1397. {
  1398. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 8.ToString();
  1399. XmlNode xmlNode0 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom);
  1400. XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom);
  1401. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode0, true));
  1402. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true));
  1403. return nativeDoc;
  1404. }
  1405. private static int DefaultAchieveValue = 0;
  1406. public static XmlDocument ToVersion9(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1407. {
  1408. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 9.ToString();
  1409. XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.AchieveData);
  1410. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateRoomAmt));
  1411. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateChestAmt));
  1412. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateLuckyChestAmt));
  1413. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessColorChestAmt));
  1414. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessNumberChestAmt));
  1415. xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.GetChestAwardAmt));
  1416. xmlNode.Attributes[9].Value = DefaultAchieveValue.ToString();
  1417. xmlNode.Attributes[10].Value = DefaultAchieveValue.ToString();
  1418. xmlNode.Attributes[11].Value = DefaultAchieveValue.ToString();
  1419. xmlNode.Attributes[12].Value = DefaultAchieveValue.ToString();
  1420. xmlNode.Attributes[13].Value = DefaultAchieveValue.ToString();
  1421. xmlNode.Attributes[14].Value = DefaultAchieveValue.ToString();
  1422. return nativeDoc;
  1423. }
  1424. public static XmlDocument ToVersion10(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1425. {
  1426. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 10.ToString();
  1427. ChestManager.ClearRefundAndOperateData(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode));
  1428. return nativeDoc;
  1429. }
  1430. public static XmlDocument ToVersion11(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1431. {
  1432. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 11.ToString();
  1433. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion);
  1434. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1435. return nativeDoc;
  1436. }
  1437. public static XmlDocument ToVersion12(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1438. {
  1439. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 12.ToString();
  1440. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ExtraSlot);
  1441. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1442. return nativeDoc;
  1443. }
  1444. public static XmlDocument ToVersion13(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1445. {
  1446. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 13.ToString();
  1447. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.CurrentMinigameType);
  1448. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1449. return nativeDoc;
  1450. }
  1451. public static XmlDocument ToVersion14(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1452. {
  1453. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 14.ToString();
  1454. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.LastPrivateMessageDate);
  1455. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1456. return nativeDoc;
  1457. }
  1458. public static XmlDocument ToVersion15(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1459. {
  1460. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 15.ToString();
  1461. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.LastApplicantSerialNumber);
  1462. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1463. return nativeDoc;
  1464. }
  1465. public static XmlDocument ToVersion16(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1466. {
  1467. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 16.ToString();
  1468. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorial);
  1469. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1470. xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FindMissingMinigameTutorialIndex);
  1471. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1472. return nativeDoc;
  1473. }
  1474. public static XmlDocument ToVersion17(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1475. {
  1476. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 17.ToString();
  1477. return nativeDoc;
  1478. }
  1479. public static XmlDocument ToVersion18(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1480. {
  1481. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 18.ToString();
  1482. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1483. if (Directory.Exists(persistentFolderPath))
  1484. {
  1485. Directory.Delete(persistentFolderPath, true);
  1486. }
  1487. return nativeDoc;
  1488. }
  1489. public static XmlDocument ToVersion19(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1490. {
  1491. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 19.ToString();
  1492. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1493. if (Directory.Exists(persistentFolderPath))
  1494. {
  1495. Directory.Delete(persistentFolderPath, true);
  1496. }
  1497. return nativeDoc;
  1498. }
  1499. public static XmlDocument ToVersion20(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1500. {
  1501. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 20.ToString();
  1502. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.MinigameCoolFlag);
  1503. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1504. return nativeDoc;
  1505. }
  1506. public static XmlDocument ToVersion21(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1507. {
  1508. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 21.ToString();
  1509. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1510. if (Directory.Exists(persistentFolderPath))
  1511. {
  1512. Directory.Delete(persistentFolderPath, true);
  1513. }
  1514. return nativeDoc;
  1515. }
  1516. public static XmlDocument ToVersion22(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1517. {
  1518. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 22.ToString();
  1519. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1520. if (Directory.Exists(persistentFolderPath))
  1521. {
  1522. Directory.Delete(persistentFolderPath, true);
  1523. }
  1524. return nativeDoc;
  1525. }
  1526. public static XmlDocument ToVersion23(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1527. {
  1528. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 23.ToString();
  1529. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1530. if (Directory.Exists(persistentFolderPath))
  1531. {
  1532. Directory.Delete(persistentFolderPath, true);
  1533. }
  1534. return nativeDoc;
  1535. }
  1536. public static XmlDocument ToVersion24(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1537. {
  1538. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 24.ToString();
  1539. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1540. if (Directory.Exists(persistentFolderPath))
  1541. {
  1542. Directory.Delete(persistentFolderPath, true);
  1543. }
  1544. return nativeDoc;
  1545. }
  1546. public static XmlDocument ToVersion25(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1547. {
  1548. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 25.ToString();
  1549. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FashionShowTutorial);
  1550. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1551. xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FashionShowTutorialIndex);
  1552. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1553. return nativeDoc;
  1554. }
  1555. public static XmlDocument ToVersion26(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1556. {
  1557. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 26.ToString();
  1558. return nativeDoc;
  1559. }
  1560. public static XmlDocument ToVersion27(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1561. {
  1562. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 27.ToString();
  1563. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1564. if (Directory.Exists(persistentFolderPath))
  1565. {
  1566. Directory.Delete(persistentFolderPath, true);
  1567. }
  1568. return nativeDoc;
  1569. }
  1570. public static XmlDocument ToVersion28(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1571. {
  1572. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 28.ToString();
  1573. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1574. if (Directory.Exists(persistentFolderPath))
  1575. {
  1576. Directory.Delete(persistentFolderPath, true);
  1577. }
  1578. return nativeDoc;
  1579. }
  1580. public static XmlDocument ToVersion29(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1581. {
  1582. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 29.ToString();
  1583. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1584. if (Directory.Exists(persistentFolderPath))
  1585. {
  1586. Directory.Delete(persistentFolderPath, true);
  1587. }
  1588. return nativeDoc;
  1589. }
  1590. public static XmlDocument ToVersion30(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1591. {
  1592. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 30.ToString();
  1593. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1594. if (Directory.Exists(persistentFolderPath))
  1595. {
  1596. Directory.Delete(persistentFolderPath, true);
  1597. }
  1598. return nativeDoc;
  1599. }
  1600. public static XmlDocument ToVersion31(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1601. {
  1602. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 31.ToString();
  1603. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1604. if (Directory.Exists(persistentFolderPath))
  1605. {
  1606. Directory.Delete(persistentFolderPath, true);
  1607. }
  1608. return nativeDoc;
  1609. }
  1610. public static XmlDocument ToVersion32(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1611. {
  1612. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 32.ToString();
  1613. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1614. if (Directory.Exists(persistentFolderPath))
  1615. {
  1616. Directory.Delete(persistentFolderPath, true);
  1617. }
  1618. return nativeDoc;
  1619. }
  1620. public static XmlDocument ToVersion33(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1621. {
  1622. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 33.ToString();
  1623. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1624. if (Directory.Exists(persistentFolderPath))
  1625. {
  1626. Directory.Delete(persistentFolderPath, true);
  1627. }
  1628. return nativeDoc;
  1629. }
  1630. public static XmlDocument ToVersion34(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1631. {
  1632. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 34.ToString();
  1633. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1634. if (Directory.Exists(persistentFolderPath))
  1635. {
  1636. Directory.Delete(persistentFolderPath, true);
  1637. }
  1638. return nativeDoc;
  1639. }
  1640. public static XmlDocument ToVersion35(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1641. {
  1642. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 35.ToString();
  1643. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1644. if (Directory.Exists(persistentFolderPath))
  1645. {
  1646. Directory.Delete(persistentFolderPath, true);
  1647. }
  1648. return nativeDoc;
  1649. }
  1650. public static XmlDocument ToVersion36(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1651. {
  1652. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 36.ToString();
  1653. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1654. if (Directory.Exists(persistentFolderPath))
  1655. {
  1656. Directory.Delete(persistentFolderPath, true);
  1657. }
  1658. return nativeDoc;
  1659. }
  1660. public static XmlDocument ToVersion37(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1661. {
  1662. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 37.ToString();
  1663. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1664. if (Directory.Exists(persistentFolderPath))
  1665. {
  1666. Directory.Delete(persistentFolderPath, true);
  1667. }
  1668. return nativeDoc;
  1669. }
  1670. public static XmlDocument ToVersion38(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1671. {
  1672. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 38.ToString();
  1673. XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ChangeMouseTutorial);
  1674. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true));
  1675. return nativeDoc;
  1676. }
  1677. public static XmlDocument ToVersion39(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1678. {
  1679. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 39.ToString();
  1680. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1681. if (Directory.Exists(persistentFolderPath))
  1682. {
  1683. Directory.Delete(persistentFolderPath, true);
  1684. }
  1685. return nativeDoc;
  1686. }
  1687. public static XmlDocument ToVersion40(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1688. {
  1689. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 40.ToString();
  1690. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1691. if (Directory.Exists(persistentFolderPath))
  1692. {
  1693. Directory.Delete(persistentFolderPath, true);
  1694. }
  1695. return nativeDoc;
  1696. }
  1697. public static XmlDocument ToVersion41(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1698. {
  1699. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 41.ToString();
  1700. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1701. if (Directory.Exists(persistentFolderPath))
  1702. {
  1703. Directory.Delete(persistentFolderPath, true);
  1704. }
  1705. return nativeDoc;
  1706. }
  1707. public static XmlDocument ToVersion42(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1708. {
  1709. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 42.ToString();
  1710. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1711. if (Directory.Exists(persistentFolderPath))
  1712. {
  1713. Directory.Delete(persistentFolderPath, true);
  1714. }
  1715. return nativeDoc;
  1716. }
  1717. public static XmlDocument ToVersion43(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1718. {
  1719. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 43.ToString();
  1720. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1721. if (Directory.Exists(persistentFolderPath))
  1722. {
  1723. Directory.Delete(persistentFolderPath, true);
  1724. }
  1725. return nativeDoc;
  1726. }
  1727. public static XmlDocument ToVersion44(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1728. {
  1729. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 44.ToString();
  1730. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1731. if (Directory.Exists(persistentFolderPath))
  1732. {
  1733. Directory.Delete(persistentFolderPath, true);
  1734. }
  1735. return nativeDoc;
  1736. }
  1737. public static XmlDocument ToVersion45(XmlDocument nativeDoc, XmlDocument defaultDoc)
  1738. {
  1739. nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 45.ToString();
  1740. string persistentFolderPath = string.Format("{0}{1}HotUpdate", Application.persistentDataPath, Path.DirectorySeparatorChar);
  1741. if (Directory.Exists(persistentFolderPath))
  1742. {
  1743. Directory.Delete(persistentFolderPath, true);
  1744. }
  1745. return nativeDoc;
  1746. }
  1747. }