ManaVisit.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. using LitJson;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using UnityEngine.Events;
  5. using System.Xml;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. public class ManaVisit
  9. {
  10. #region 变量
  11. #region 配置
  12. public static int Cost
  13. {
  14. get { return Cost_; }
  15. set
  16. {
  17. Cost_ = value;
  18. ManaReso.Get<Text>("C_CostLab").text = "<(金币)>" + Cost;
  19. }
  20. }
  21. public static int Cost_;
  22. public static int CoolTime;
  23. public static float FancyRate;
  24. public static float AwardRate;
  25. public static float CreateRate;
  26. public static string CostFml;
  27. public static string AwardMinFml;
  28. public static string AwardMaxFml;
  29. #endregion
  30. public static bool InVisit;
  31. public static bool Complete;
  32. public static bool LoadComplete;
  33. public static bool TweenComplete;
  34. public static string XmlStr;
  35. public static int Slot;
  36. public static int Level;
  37. public static XmlNode Node;
  38. public static XmlDocument Document;
  39. public static int VisiteePraise;
  40. public static string VisiteeSerialNumber;
  41. public static bool OriginBird;
  42. public static bool OriginTree;
  43. public static bool OriginRainbow;
  44. public static List<Slot> VisitPlantList;
  45. public static List<Slot> OriginPlantList;
  46. public static List<ElfType> OriginElfList;
  47. #endregion
  48. public static void Initialize()
  49. {
  50. XmlAttributeCollection attribute = ManaData.GetVisitConfig();
  51. CostFml = attribute[5].Value;
  52. Cost = Mathf.FloorToInt((float)Auxiliary.FmlParse(CostFml, "l", ManaCenter.Level.ToString()));
  53. AwardMinFml = attribute[2].Value;
  54. AwardMaxFml = attribute[3].Value;
  55. CoolTime = int.Parse(attribute[4].Value);
  56. FancyRate = float.Parse(attribute[7].Value);
  57. AwardRate = float.Parse(attribute[1].Value);
  58. CreateRate = float.Parse(attribute[6].Value);
  59. #region 倒计时
  60. if (CoolTime != 0)
  61. {
  62. Text text = ManaReso.Get<Text>("C_VisitLab");
  63. List<float> delayList = new List<float>();
  64. List<float> durationList = new List<float>();
  65. List<VecPair> pairList = new List<VecPair>();
  66. List<UnityAction> actionList = new List<UnityAction>();
  67. Vector3 v1 = new Vector3(0.75f, 0.75f, 0.75f);
  68. Vector3 v2 = new Vector3(0.4f, 0.4f, 0.4f);
  69. Vector3 v3 = new Vector3(0, 0, 0);
  70. for (int i = 0; i < CoolTime - 1; i++)
  71. {
  72. delayList.Add(0.5f);
  73. delayList.Add(0);
  74. }
  75. delayList.Add(0.5f);
  76. for (int i = 0; i < CoolTime; i++)
  77. {
  78. durationList.Add(0.25f);
  79. durationList.Add(0.25f);
  80. pairList.Add(new VecPair(v1, v2));
  81. pairList.Add(new VecPair(v2, v3));
  82. var tempInt = i;
  83. actionList.Add
  84. (
  85. () =>
  86. {
  87. text.text = (CoolTime - tempInt).ToString();
  88. ManaAudio.PlayClip(Clip.BtnClip);
  89. }
  90. );
  91. actionList.Add(null);
  92. }
  93. TweenRoot tween = ManaReso.Get("C_VisitLab").CreateStreamScale
  94. (
  95. delayList,
  96. durationList,
  97. pairList,
  98. true,
  99. false,
  100. Curve.EaseOutQuad,
  101. false,
  102. actionList
  103. );
  104. tween.OnForwardFinish += () =>
  105. {
  106. ManaAudio.PlayClip(Clip.BubbleClip);
  107. };
  108. }
  109. #endregion
  110. Complete = true;
  111. }
  112. public static void Exit()
  113. {
  114. TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenForCG();
  115. tweenRoot.AddEventOnetime
  116. (
  117. EventType.ForwardFinish,
  118. () =>
  119. {
  120. ManaPlayer.Player.SetAllCollider(true);
  121. }
  122. );
  123. HideTip ();
  124. SetPlayerPraise();
  125. ManaReso.SetActive("C_Visit", true);
  126. ManaReso.SetActive("C_Coin", true);
  127. ManaReso.SetActive("C_Group1", true);
  128. ManaReso.SetActive("C_Group2", true);
  129. ManaReso.SetActive("C_Return", false);
  130. ManaReso.SetActive("C_Garden", false);
  131. ManaGarden.MiniLock = true;
  132. #region Garden
  133. ManaGarden.RetriveFlowerAll();
  134. for (int i = 0; i < ManaGarden.PageList.Count; i++)
  135. {
  136. ManaReso.Save(ManaGarden.PageList[i]);
  137. }
  138. ManaGarden.PageList = new List<Transform>();
  139. Garden.CurPage = 0;
  140. ManaGarden.SlotList = new List<Slot>();
  141. ManaGarden.PageList = new List<Transform>();
  142. Garden.ResetPage();
  143. Garden.PagePos = new List<Vector3>();
  144. int pageAmt = 2;
  145. if (ManaGarden.Slot >= 7)
  146. {
  147. pageAmt = (ManaGarden.Slot - 7)/9 + 3;
  148. }
  149. for (int i = 0; i < pageAmt; i++)
  150. {
  151. ManaGarden.CreatePage();
  152. }
  153. for (int i = 0; i < ManaGarden.SlotList.Count; i++)
  154. {
  155. if (i < ManaGarden.Slot)
  156. {
  157. ManaGarden.SlotList[i].Lock = true;
  158. ManaGarden.SlotList[i].Available = true;
  159. }
  160. else
  161. {
  162. ManaGarden.SlotList[i].Lock = false;
  163. ManaGarden.SlotList[i].Available = false;
  164. }
  165. }
  166. List<KV<int, int>> plantList = ManaData.GetPlantList();
  167. for (int i = 0; i < plantList.Count; i++)
  168. {
  169. ManaGarden.PlantFlower(plantList[i].Key, plantList[i].Value);
  170. }
  171. #endregion
  172. #region Bird Tree Rainbow
  173. if (OriginBird)
  174. {
  175. ManaReso.Get("Bird0").GetTweenSr().InDestination = true;
  176. }
  177. else
  178. {
  179. ManaReso.Get("Bird0").GetTweenSr().InOrigin = true;
  180. }
  181. if (OriginTree)
  182. {
  183. ManaReso.Get("Tree1").GetTweenSr().InDestination = true;
  184. ManaReso.Get("Tree2").GetTweenSr().InDestination = true;
  185. }
  186. else
  187. {
  188. ManaReso.Get("Tree1").GetTweenSr().InOrigin = true;
  189. ManaReso.Get("Tree2").GetTweenSr().InOrigin = true;
  190. }
  191. if (OriginRainbow)
  192. {
  193. ManaReso.Get("Rainbow").GetTweenSr().InDestination = true;
  194. }
  195. else
  196. {
  197. ManaReso.Get("Rainbow").GetTweenSr().InOrigin = true;
  198. }
  199. #endregion
  200. #region Player
  201. ManaReso.Save(ManaPlayer.Player);
  202. ManaReso.TraDic.Remove("Player");
  203. ManaPlayer.Instance.GetPlayer();
  204. Garden.PlayerPos = new List<Vector3>();
  205. Garden.Player = ManaReso.Get("Player");
  206. Garden.PlayerPos.Add(ManaPlayer.Player.ChildDic["Pos1"].position);
  207. Garden.PlayerPos.Add(ManaPlayer.Player.ChildDic["Pos2"].position);
  208. #endregion
  209. ManaGarden.ElfList = new List<ElfType>(OriginElfList);
  210. InVisit = false;
  211. }
  212. public static void Enter()
  213. {
  214. if (!LoadComplete || !TweenComplete)
  215. {
  216. return;
  217. }
  218. ManaReso.Get("I_BlackMask").TweenForCG();
  219. ShowTip ();
  220. Node = Document.SelectSingleNode("PlayerConfig");
  221. ManaReso.SetActive("C_Coin", false);
  222. ManaReso.SetActive("C_Group1", false);
  223. ManaReso.SetActive("C_Group2", false);
  224. ManaReso.SetActive("C_Garden", true);
  225. if (!InVisit)
  226. {
  227. for (int i = 0; i < ManaGarden.StarList.Count; i++)
  228. {
  229. ManaReso.Save(ManaGarden.StarList[i]);
  230. }
  231. ManaGarden.StarList = new List<Star>();
  232. }
  233. ManaReso.SetActive("C_Return", true);
  234. ManaGarden.MiniLock = false;
  235. #region Bird Tree Rainbow
  236. if (!InVisit)
  237. {
  238. if (ManaReso.Get("Bird0").gameObject.activeSelf)
  239. {
  240. OriginBird = true;
  241. }
  242. if (ManaReso.Get("Tree1").gameObject.activeSelf)
  243. {
  244. OriginTree = true;
  245. }
  246. if (ManaReso.Get("Rainbow").gameObject.activeSelf)
  247. {
  248. OriginRainbow = true;
  249. }
  250. }
  251. ManaReso.SetActive("Bird0", false);
  252. ManaReso.SetActive("Tree1", false);
  253. ManaReso.SetActive("Tree2", false);
  254. ManaReso.SetActive("Rainbow", false);
  255. #endregion
  256. #region Ability
  257. Slot = 1;
  258. if (!InVisit)
  259. {
  260. OriginElfList = new List<ElfType>(ManaGarden.ElfList);
  261. }
  262. ManaGarden.ElfList = new List<ElfType>();
  263. List<XmlAttributeCollection> attributeList = ManaData.GetSkillList(Node);
  264. for (int i = 0; i < attributeList.Count; i++)
  265. {
  266. if (!attributeList[i][0].Value.Contains("Ability"))
  267. {
  268. continue;
  269. }
  270. if (attributeList[i][0].Value == "Ability1")
  271. {
  272. Level = int.Parse(attributeList[i][3].Value);
  273. ManaReso.SetText("C_GardenLab", Language.GetStr("UI", "C_GardenLab") + Level);
  274. continue;
  275. }
  276. if (int.Parse(attributeList[i][3].Value) == 0)
  277. {
  278. continue;
  279. }
  280. if (attributeList[i][0].Value == "Ability2")
  281. {
  282. ManaReso.Get("Rainbow").GetTweenSr().InDestination = true;
  283. }
  284. else if (attributeList[i][0].Value == "Ability3")
  285. {
  286. ManaReso.Get("Tree1").GetTweenSr().InDestination = true;
  287. ManaReso.Get("Tree2").GetTweenSr().InDestination = true;
  288. }
  289. else if (attributeList[i][0].Value == "Ability4")
  290. {
  291. ManaReso.Get("Bird0").GetTweenSr().InDestination = true;
  292. }
  293. else if (attributeList[i][0].Value == "Ability5")
  294. {
  295. ManaGarden.ElfList.Add(ElfType.Bee_Yellow);
  296. }
  297. else if (attributeList[i][0].Value == "Ability6")
  298. {
  299. Slot++;
  300. ManaGarden.ElfList.Add(ElfType.Bee_Purple);
  301. }
  302. else if (attributeList[i][0].Value == "Ability7")
  303. {
  304. Slot++;
  305. ManaGarden.ElfList.Add(ElfType.Bee_Blue);
  306. }
  307. else if (attributeList[i][0].Value == "Ability8")
  308. {
  309. Slot++;
  310. ManaGarden.ElfList.Add(ElfType.Bee_Red);
  311. }
  312. else if (attributeList[i][0].Value == "Ability9")
  313. {
  314. Slot++;
  315. ManaGarden.ElfList.Add(ElfType.Bee_White);
  316. }
  317. else if (attributeList[i][0].Value == "Ability10")
  318. {
  319. Slot++;
  320. ManaGarden.ElfList.Add(ElfType.Butterfly_Yellow);
  321. }
  322. else if (attributeList[i][0].Value == "Ability11")
  323. {
  324. Slot++;
  325. ManaGarden.ElfList.Add(ElfType.Butterfly_Purple);
  326. }
  327. else if (attributeList[i][0].Value == "Ability12")
  328. {
  329. Slot++;
  330. ManaGarden.ElfList.Add(ElfType.Butterfly_Blue);
  331. }
  332. else if (attributeList[i][0].Value == "Ability13")
  333. {
  334. Slot++;
  335. ManaGarden.ElfList.Add(ElfType.Butterfly_Red);
  336. }
  337. else if (attributeList[i][0].Value == "Ability14")
  338. {
  339. Slot++;
  340. ManaGarden.ElfList.Add(ElfType.Butterfly_White);
  341. }
  342. else if (attributeList[i][0].Value == "Ability15")
  343. {
  344. Slot++;
  345. ManaGarden.ElfList.Add(ElfType.Dragonfly_Yellow);
  346. }
  347. else if (attributeList[i][0].Value == "Ability16")
  348. {
  349. Slot++;
  350. ManaGarden.ElfList.Add(ElfType.Dragonfly_Purple);
  351. }
  352. else if (attributeList[i][0].Value == "Ability17")
  353. {
  354. Slot++;
  355. ManaGarden.ElfList.Add(ElfType.Dragonfly_Blue);
  356. }
  357. else if (attributeList[i][0].Value == "Ability18")
  358. {
  359. Slot++;
  360. ManaGarden.ElfList.Add(ElfType.Dragonfly_Red);
  361. }
  362. else if (attributeList[i][0].Value == "Ability19")
  363. {
  364. Slot++;
  365. ManaGarden.ElfList.Add(ElfType.Dragonfly_White);
  366. }
  367. else if (attributeList[i][0].Value == "Ability20")
  368. {
  369. Slot++;
  370. ManaGarden.ElfList.Add(ElfType.Beetle_Yellow);
  371. }
  372. else if (attributeList[i][0].Value == "Ability21")
  373. {
  374. Slot++;
  375. ManaGarden.ElfList.Add(ElfType.Beetle_Purple);
  376. }
  377. else if (attributeList[i][0].Value == "Ability22")
  378. {
  379. Slot++;
  380. ManaGarden.ElfList.Add(ElfType.Beetle_Blue);
  381. }
  382. else if (attributeList[i][0].Value == "Ability23")
  383. {
  384. Slot++;
  385. ManaGarden.ElfList.Add(ElfType.Beetle_Red);
  386. }
  387. else if (attributeList[i][0].Value == "Ability24")
  388. {
  389. Slot++;
  390. ManaGarden.ElfList.Add(ElfType.Beetle_White);
  391. }
  392. }
  393. #endregion
  394. #region Garden
  395. if (!InVisit)
  396. {
  397. OriginPlantList = new List<Slot>(ManaGarden.PlantList);
  398. ManaData.SaveDress();
  399. ManaData.SavePlantList();
  400. }
  401. ManaGarden.RetriveFlowerAll();
  402. for (int i = 0; i < ManaGarden.PageList.Count; i++)
  403. {
  404. ManaReso.Save(ManaGarden.PageList[i]);
  405. }
  406. ManaGarden.PageList = new List<Transform>();
  407. Garden.CurPage = 0;
  408. ManaGarden.SlotList = new List<Slot>();
  409. ManaGarden.PageList = new List<Transform>();
  410. Garden.ResetPage();
  411. Garden.PagePos = new List<Vector3>();
  412. int pageAmt = 2;
  413. if (Slot >= 7)
  414. {
  415. pageAmt = (Slot - 7) / 9 + 3;
  416. }
  417. for (int i = 0; i < pageAmt; i++)
  418. {
  419. ManaGarden.CreatePage();
  420. }
  421. for (int i = 0; i < ManaGarden.SlotList.Count; i++)
  422. {
  423. if (i < Slot)
  424. {
  425. ManaGarden.SlotList[i].Lock = true;
  426. ManaGarden.SlotList[i].Available = true;
  427. }
  428. else
  429. {
  430. ManaGarden.SlotList[i].Lock = false;
  431. ManaGarden.SlotList[i].Available = false;
  432. }
  433. }
  434. List<KV<int, int>> plantList = ManaData.GetPlantList(Node);
  435. for (int i = 0; i < plantList.Count; i++)
  436. {
  437. ManaGarden.PlantFlower(plantList[i].Key, plantList[i].Value);
  438. }
  439. #endregion
  440. #region Player
  441. ManaReso.Save(ManaPlayer.Player);
  442. ManaReso.TraDic.Remove("Player");
  443. ManaPlayer.Instance.GetPlayer(Node).SetAllCollider(false);
  444. Garden.PlayerPos = new List<Vector3>();
  445. Garden.Player = ManaReso.Get("Player");
  446. Garden.PlayerPos.Add(ManaPlayer.Player.ChildDic["Pos1"].position);
  447. Garden.PlayerPos.Add(ManaPlayer.Player.ChildDic["Pos2"].position);
  448. #endregion
  449. #region Award
  450. if (ManaTutorial.TutorialC || Random.Range(0f,1f) <= AwardRate)
  451. {
  452. if (ManaTutorial.TutorialC)
  453. {
  454. ManaTutorial.EndC();
  455. }
  456. if (ManaGarden.PlantList.Count > 0)
  457. {
  458. ManaGarden.PlantList.Random()[0].Flower.Award = true;
  459. }
  460. }
  461. #endregion
  462. InVisit = true;
  463. }
  464. public static void SetPlayerPraise()
  465. {
  466. ManaSocial.PraiseText.text = ManaServer.PraiseAmt.ToString();
  467. }
  468. public static void SetVisiteePraise(XmlDocument document)
  469. {
  470. ManaSocial.PraiseText.text = VisiteePraise.ToString();
  471. if (document.SelectSingleNode("PlayerConfig").SelectSingleNode("SerialNumber") == null)
  472. {
  473. ManaSocial.EnablePraise();
  474. }
  475. else
  476. {
  477. VisiteeSerialNumber = document.SelectSingleNode("PlayerConfig").SelectSingleNode("SerialNumber").Attributes[0].Value;
  478. ManaServer.Target
  479. (
  480. ManaServer.SerialNumber,
  481. VisiteeSerialNumber,
  482. jsonData =>
  483. {
  484. if (jsonData["i"].ToString() == "0")
  485. {
  486. ManaSocial.EnablePraise();
  487. }
  488. else if (jsonData["i"].ToString() == "1")
  489. {
  490. ManaSocial.DisablePraise();
  491. }
  492. }
  493. );
  494. }
  495. }
  496. public static void UpdateCost()
  497. {
  498. if (Complete)
  499. {
  500. Cost = Mathf.FloorToInt((float)Auxiliary.FmlParse(CostFml, "l", ManaCenter.Level.ToString()));
  501. }
  502. }
  503. public static void DataReverse()
  504. {
  505. if (InVisit)
  506. {
  507. VisitPlantList = new List<Slot>(ManaGarden.PlantList);
  508. ManaGarden.PlantList = OriginPlantList;
  509. }
  510. }
  511. public static void DataRecover()
  512. {
  513. if (InVisit)
  514. {
  515. ManaGarden.PlantList = VisitPlantList;
  516. }
  517. }
  518. public static void ShowTip()
  519. {
  520. ManaReso.SetActive ("C_Tip", true);
  521. ManaReso.Get<Text> ("C_TipLab").text = Language.GetStr ("Tip", "Tip" + Random.Range(1,10));
  522. }
  523. public static void HideTip()
  524. {
  525. ManaReso.SetActive ("C_Tip", false);
  526. }
  527. public static void GetArchive()
  528. {
  529. if (Random.Range(0f, 1f) <= CreateRate)
  530. {
  531. LoadComplete = true;
  532. XmlStr = WriteArchive();
  533. Document = new XmlDocument();
  534. Document.LoadXml(XmlStr);
  535. Enter();
  536. }
  537. else
  538. {
  539. ManaServer.RandomLoad
  540. (
  541. jsonData =>
  542. {
  543. LoadComplete = true;
  544. if (jsonData.Inst_Object.ContainsKey("l"))
  545. {
  546. XmlStr = jsonData["l"].ToString();
  547. VisiteePraise = int.Parse(jsonData["p"].ToString());
  548. Document = new XmlDocument();
  549. Document.LoadXml(XmlStr);
  550. SetVisiteePraise(Document);
  551. }
  552. else
  553. {
  554. LoadComplete = true;
  555. XmlStr = WriteArchive();
  556. Document = new XmlDocument();
  557. Document.LoadXml(XmlStr);
  558. }
  559. Enter();
  560. }
  561. );
  562. }
  563. }
  564. public static string WriteArchive()
  565. {
  566. XmlDocument doc = new XmlDocument();
  567. doc.LoadXml(ManaData.PlayerDoc.OuterXml);
  568. bool fancy;
  569. if (Random.Range(0f, 1f) < FancyRate)
  570. {
  571. fancy = true;
  572. }
  573. else
  574. {
  575. fancy = false;
  576. }
  577. int slot = 1;
  578. int newLevel = Random.Range(1, 301);
  579. XmlNodeList nodeList = doc.SelectSingleNode("PlayerConfig").SelectSingleNode("SkillList").ChildNodes;
  580. for (int i = 0; i < nodeList.Count; i++)
  581. {
  582. SkillType type = nodeList[i].Attributes[1].Value.ToEnum<SkillType>();
  583. if (type == SkillType.Ability)
  584. {
  585. Ability ability = (Ability) ManaCenter.SkillDic[nodeList[i].Attributes[0].Value];
  586. int unlockLevel = ability.UnlockLv;
  587. if (newLevel >= unlockLevel)
  588. {
  589. if (ability.ID_ >= 6)
  590. {
  591. slot++;
  592. }
  593. nodeList[i].Attributes[2].Value = "Upgrade";
  594. nodeList[i].Attributes[3].Value = newLevel.ToString();
  595. }
  596. else
  597. {
  598. nodeList[i].Attributes[2].Value = "Lock";
  599. nodeList[i].Attributes[3].Value = "0";
  600. }
  601. }
  602. }
  603. List<int> flowerList = new List<int>();
  604. for (int i = 2; i < 28; i++)
  605. {
  606. flowerList.Add(i);
  607. }
  608. int slotIndex = 0;
  609. string plantList = "";
  610. for (int i = 0; i < slot; i++)
  611. {
  612. if (fancy || Random.Range(0f, 1f) >= 0.35f)
  613. {
  614. int flowerID = slotIndex + 1;
  615. plantList += string.Format("{0},{1} ", flowerID, slotIndex);
  616. slotIndex++;
  617. }
  618. }
  619. plantList = plantList.TrimEnd(' ');
  620. doc.SelectSingleNode("PlayerConfig").SelectSingleNode("PlantList").Attributes[0].Value = plantList;
  621. XmlNode xmlNode = doc.SelectSingleNode("PlayerConfig").SelectSingleNode("DressData");
  622. xmlNode.Attributes[0].Value = "";
  623. xmlNode.Attributes[0].Value = ManaPlayer.CloseUnitDic[Random.Range(2, (int) Mathf.Lerp(2, 30, newLevel/300f)+1)].ArmatureName;
  624. xmlNode.Attributes[1].Value = ManaPlayer.CloseUnitDic[Random.Range(201, (int) Mathf.Lerp(201, 217, newLevel/300f)+1)].ArmatureName;
  625. xmlNode.Attributes[2].Value = ManaPlayer.CloseUnitDic[Random.Range(401, (int) Mathf.Lerp(401, 415, newLevel/300f)+1)].ArmatureName;
  626. xmlNode.Attributes[3].Value = ManaPlayer.CloseUnitDic[Random.Range(601, (int) Mathf.Lerp(601, 612, newLevel/300f)+1)].ArmatureName;
  627. xmlNode.Attributes[4].Value = ManaPlayer.CloseUnitDic[Random.Range(801, (int) Mathf.Lerp(801, 817, newLevel/300f)+1)].ArmatureName;
  628. xmlNode.Attributes[7].Value = ManaPlayer.CloseUnitDic[Random.Range(1001, (int) Mathf.Lerp(1001, 1003, newLevel/300f)+1)].ArmatureName;
  629. float eyeMouseRate = Random.Range(0f, 1f);
  630. if (eyeMouseRate <= 0.33f)
  631. {
  632. xmlNode.Attributes[5].Value = "眼睛1";
  633. xmlNode.Attributes[6].Value = "嘴巴1";
  634. }
  635. else if (eyeMouseRate <= 0.66f)
  636. {
  637. xmlNode.Attributes[5].Value = "眼睛2";
  638. xmlNode.Attributes[6].Value = "嘴巴2";
  639. }
  640. else
  641. {
  642. xmlNode.Attributes[5].Value = "眼睛3";
  643. xmlNode.Attributes[6].Value = "嘴巴3";
  644. }
  645. return doc.OuterXml;
  646. }
  647. }