Ability.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. using System.Xml;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using Random = UnityEngine.Random;
  9. public class Ability : SkillRoot
  10. {
  11. #region Config
  12. #region 配置
  13. public float UnlockAheadAmt
  14. {
  15. get { return UnlockAheadBaseAmt + (UnlockLv - Manager.GardenLevel - 1)*UnlockAheadDeltaAmt; }
  16. }
  17. public override string FullID
  18. {
  19. get { return AbilityFullIDPrefix + ID; }
  20. }
  21. public static string ElfAnim = "Elf";
  22. public static string ItemAnim = "Item";
  23. public float Person;
  24. public float SkillCD;
  25. public float CoinPerson;
  26. public double UpgradeAmt;
  27. public float Plus;
  28. public float PersonBuff;
  29. public float SkillCdBuff;
  30. public int UnlockLv;
  31. public float UnlockAmt;
  32. public float UnlockAheadBaseAmt;
  33. public float UnlockAheadDeltaAmt;
  34. public string UnlockPos;
  35. public Current UnlockCur;
  36. public Current UpgradeCur;
  37. public Current UnlockAheadCur;
  38. public string Label;
  39. public string Anim;
  40. public string UpgradeCD;
  41. public string UpgradeFml;
  42. public string UpgradePlus;
  43. public string UpgradePerson;
  44. #endregion
  45. public bool ElfFlag = true;
  46. public string Elf;
  47. public string Item;
  48. public float NewPlus;
  49. public float NewPerson;
  50. public float NewSkillCD;
  51. public float NewSkillCdBuff;
  52. public float NewPersonBuff;
  53. public float NewCoinPerson;
  54. public double NewUpgradeAmt;
  55. public override SkillStatus ItemStatus
  56. {
  57. get { return itemStatus; }
  58. set
  59. {
  60. itemStatus = value;
  61. if (itemStatus == SkillStatus.Lock)
  62. {
  63. if (UnlockAheadCur == Current.Free)
  64. {
  65. button.interactable = false;
  66. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab1), "\n", new MulLanStr(LanguageLabel.UI__Fe_BtnLab4), UnlockLv.ToString());
  67. }
  68. else
  69. {
  70. button.interactable = true;
  71. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab0), "\n", new MulLanStr(LanguageLabel.UI__Fe_BtnLab4), UnlockLv.ToString());
  72. }
  73. }
  74. else if (itemStatus == SkillStatus.UnLock)
  75. {
  76. button.interactable = true;
  77. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab1) + "\n" + Auxiliary.ImageParse(UnlockCur) + Auxiliary.ShrinkBigNumberStr(UnlockAmt);
  78. }
  79. else if (itemStatus == SkillStatus.Upgrade)
  80. {
  81. button.interactable = true;
  82. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab2) + "\n" + Auxiliary.ImageParse(UpgradeCur) + Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt);
  83. }
  84. }
  85. }
  86. private static int BannedSlotIndexForZoomIn = 4;
  87. #endregion
  88. public Ability(XmlAttributeCollection attribute)
  89. {
  90. #region 配置
  91. ID = int.Parse(attribute[0].Value);
  92. icon = attribute[21].Value;
  93. Anim = attribute[22].Value;
  94. Label = attribute[23].Value;
  95. UnlockPos = attribute[13].Value;
  96. UpgradeCD = attribute[19].Value;
  97. UpgradeFml = attribute[16].Value;
  98. UpgradePlus = attribute[17].Value;
  99. UpgradePerson = attribute[18].Value;
  100. UnlockLv = Auxiliary.StringToInt(attribute[7].Value,0);
  101. ItemIndex = Auxiliary.StringToInt(attribute[3].Value,0);
  102. UnlockAmt = Auxiliary.StringToFloat(attribute[12].Value,0);
  103. UnlockAheadBaseAmt = Auxiliary.StringToFloat(attribute[10].Value,0);
  104. UnlockAheadDeltaAmt = Auxiliary.StringToFloat(attribute[9].Value, 0);
  105. SkillTab = SkillClassParse(attribute[2].Value);
  106. UpgradeAmt = GetUpgradeAmt(attribute[15].Value);
  107. UnlockCur = Auxiliary.CurrentParse(attribute[11].Value);
  108. UpgradeCur = Auxiliary.CurrentParse(attribute[14].Value);
  109. UnlockAheadCur = Auxiliary.CurrentParse(attribute[8].Value);
  110. ValueBuffParse(out Person, out PersonBuff, attribute[5].Value);
  111. ValueBuffParse(out SkillCD, out SkillCdBuff, attribute[6].Value);
  112. ValueBuffParse(out CoinPerson, out Plus, attribute[4].Value);
  113. #endregion
  114. SkillType = SkillType.Ability;
  115. }
  116. public void UnlockTab()
  117. {
  118. ResourceManager.Get<Graphic>(CanvasLabel.F_Elf).material = null;
  119. ResourceManager.Get<Graphic>(CanvasLabel.F_Store).material = null;
  120. ResourceManager.Get<Graphic>(CanvasLabel.F_Magic).material = null;
  121. ResourceManager.Get<Graphic>(CanvasLabel.F_ElfLab).material = null;
  122. ResourceManager.Get<Graphic>(CanvasLabel.F_StoreLab).material = null;
  123. ResourceManager.Get<Graphic>(CanvasLabel.F_MagicLab).material = null;
  124. ResourceManager.Get<Button>(CanvasLabel.F_Elf).interactable = true;
  125. ResourceManager.Get<Button>(CanvasLabel.F_Store).interactable = true;
  126. ResourceManager.Get<Button>(CanvasLabel.F_Magic).interactable = true;
  127. }
  128. public override void Reactive()
  129. {
  130. //if (Level > 0)
  131. //{
  132. // AnnulA();
  133. // AnnulB();
  134. //}
  135. }
  136. public override void Init(bool firstInit, float elapse, List<List<Skill>> useList, XmlAttributeCollection attribute)
  137. {
  138. if (!firstInit)
  139. {
  140. return;
  141. }
  142. Level = int.Parse(attribute[3].Value);
  143. itemStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), attribute[2].Value);
  144. NewPlus = Plus;
  145. NewPerson = Person;
  146. NewSkillCD = SkillCD;
  147. NewSkillCdBuff = SkillCdBuff;
  148. NewPersonBuff = PersonBuff;
  149. NewCoinPerson = CoinPerson;
  150. NewUpgradeAmt = UpgradeAmt;
  151. if (FullID == "Ability1")
  152. {
  153. Manager.GardenLevel = Level;
  154. if (Level > 0)
  155. {
  156. UnlockTab();
  157. }
  158. }
  159. if (itemStatus == SkillStatus.Lock || itemStatus == SkillStatus.UnLock)
  160. {
  161. SkillIcon.material = Lib.GrayMat;
  162. }
  163. else
  164. {
  165. SkillIcon.material = null;
  166. }
  167. if (itemStatus == SkillStatus.Upgrade)
  168. {
  169. for (int i = 0; i < Level - 1; i++)
  170. {
  171. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString("0.00"));
  172. }
  173. UpgradeValue(ref NewPlus, UpgradePlus, Level - 1);
  174. UpgradeValue(ref NewPersonBuff, UpgradePerson, Level - 1);
  175. UpgradeSkillCdBuff(ref NewSkillCdBuff, UpgradeCD, Level - 1);
  176. UpgradeValue(ref NewPerson, Person, UpgradePerson, Level - 1);
  177. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, Level - 1);
  178. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, Level - 1);
  179. GetAward();
  180. GetSlot();
  181. }
  182. else if (itemStatus == SkillStatus.UnLock)
  183. {
  184. UIManager.UpdateManagePanelHint();
  185. }
  186. ItemStatus = ItemStatus;
  187. button.onClick.RemoveAllListeners();
  188. button.onClick.AddListener(OnClick);
  189. DescriptionText.text = GetDescription(0);
  190. }
  191. public override void SwitchLanguage()
  192. {
  193. base.SwitchLanguage();
  194. ItemStatus = ItemStatus;
  195. }
  196. protected void GetAward()
  197. {
  198. if (ElfFlag)
  199. {
  200. ElfFlag = false;
  201. if (!string.IsNullOrEmpty(Anim))
  202. {
  203. if (Anim.Contains(ElfAnim))
  204. {
  205. string[] strings = Anim.Split(',');
  206. for (int i = 1; i < strings.Length; i++)
  207. {
  208. GardenManager.ElfList.Add(strings[i].ToEnum<ElfType>());
  209. }
  210. Elf = strings[1];
  211. }
  212. else if (Anim.Contains(ItemAnim))
  213. {
  214. string[] strings = Anim.Split(',');
  215. for (int i = 1; i < strings.Length; i++)
  216. {
  217. ResourceManager.Get(strings[i]).TweenForSr();
  218. }
  219. Item = strings[1];
  220. }
  221. }
  222. }
  223. Manager.Person += NewPerson;
  224. Manager.CoinPerson += NewCoinPerson;
  225. Manager.SkillCoinPersonBuff += NewPlus;
  226. Manager.SkillPersonBuff += NewPersonBuff;
  227. if (Math.Abs(NewPerson) > 0.001f || Math.Abs(NewPersonBuff) > 0.001f)
  228. {
  229. Manager.ExtraPersonSourceSpritesName.UniqueAdd(icon);
  230. }
  231. if (Math.Abs(NewPlus) > 0.001f || Math.Abs(NewCoinPerson) > 0.001f)
  232. {
  233. Manager.ExtraCoinPersonSourceSpritesName.UniqueAdd(icon);
  234. }
  235. if (!NewSkillCD.Equal(0))
  236. {
  237. for (int i = 0; i < Manager.SkillList.Count; i++)
  238. {
  239. Manager.SkillList[i].Cool(NewSkillCD, false, false);
  240. }
  241. }
  242. if (!NewSkillCdBuff.Equal(0))
  243. {
  244. for (int i = 0; i < Manager.SkillList.Count; i++)
  245. {
  246. Manager.SkillList[i].Cool(NewSkillCdBuff, false, true);
  247. }
  248. }
  249. }
  250. protected void AddAchieve()
  251. {
  252. if (!string.IsNullOrEmpty(Elf))
  253. {
  254. Manager.AllElfLevel++;
  255. }
  256. }
  257. protected void GetSlot()
  258. {
  259. for (int i = 0; i < Auxiliary.StringToInt(UnlockPos, 0); i++)
  260. {
  261. GardenManager.UnlockSlot();
  262. }
  263. }
  264. protected void Zoom()
  265. {
  266. if (!string.IsNullOrEmpty(Elf))
  267. {
  268. if (GardenManager.PlantSlotList.Count <= Garden.CurrentPage * GardenManager.TotalSlotInOnePage)
  269. {
  270. return;
  271. }
  272. GardenManager.CreateElfTimer = Random.Range(GardenManager.MinCreateElfTime, GardenManager.MaxCreateElfTime);
  273. Slot zoomSlot = GardenManager.PlantSlotList.Random(1, false, false, slot => { return slot.Index >= Garden.CurrentPage* GardenManager.TotalSlotInOnePage; })[0];
  274. if (zoomSlot.Index% GardenManager.TotalSlotInOnePage == BannedSlotIndexForZoomIn)
  275. {
  276. return;
  277. }
  278. Flower flower = zoomSlot.PlantFlower;
  279. flower.GetElf(GardenManager.ElfList.Back(0), 0, 0, 0, 0);
  280. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  281. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  282. TweenRoot tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  283. tween.AddEventOnetime
  284. (
  285. EventType.BackwardFinish,
  286. () =>
  287. {
  288. ResourceManager.Get(ResourceLabel.MainCamera).Zoom2D(1.5f, 3f, 1, flower.ElfList.Back(0), Curve.EaseOutQuad);
  289. }
  290. );
  291. }
  292. else if (!string.IsNullOrEmpty(Item))
  293. {
  294. TweenRoot tween = ResourceManager.Get(Item).GetTweenSr();
  295. Vector3 pos = ResourceManager.Get(Item).position;
  296. pos.z = -2;
  297. tween.AddEventOnetime
  298. (
  299. EventType.ForwardFinish,
  300. () =>
  301. {
  302. ResourceManager.GetFirework(pos);
  303. }
  304. );
  305. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  306. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  307. tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  308. tween.AddEventOnetime
  309. (
  310. EventType.BackwardFinish,
  311. () =>
  312. {
  313. ResourceManager.Get(ResourceLabel.MainCamera).Zoom2D(3.5f, 3f, 1, ResourceManager.Get(Item), Curve.EaseOutQuad);
  314. }
  315. );
  316. }
  317. }
  318. public void Unlock()
  319. {
  320. Manager.Pay
  321. (
  322. FullID,
  323. UnlockAmt,
  324. UnlockCur,
  325. () =>
  326. {
  327. UnlockSucceed();
  328. Zoom();
  329. if (FullID == "Ability1")
  330. {
  331. Manager.GardenLevel = 1;
  332. UnlockTab();
  333. }
  334. },
  335. StaticsManager.ItemID.解锁技能,
  336. StaticsManager.ConsumeModule.Shop
  337. );
  338. }
  339. public void UnlockSucceed()
  340. {
  341. AudioManager.PlayClip(AudioLabel.UseSkill);
  342. SkillIcon.material = null;
  343. ItemStatus = SkillStatus.Upgrade;
  344. if (UnlockCur != Current.Free)
  345. {
  346. UIManager.UpdateManagePanelHint();
  347. }
  348. Level = 1;
  349. GetAward();
  350. AddAchieve();
  351. GetSlot();
  352. }
  353. public void OnClick()
  354. {
  355. AudioManager.PlayClip(AudioLabel.ClickButton);
  356. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  357. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  358. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  359. if (ItemStatus == SkillStatus.Lock)
  360. {
  361. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  362. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  363. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab0), Auxiliary.ImageParse(UnlockAheadCur), UnlockAheadAmt.ToString("0")));
  364. ResourceManager.SetButtonEvent
  365. (
  366. CanvasLabel.Fe_Btn,
  367. () =>
  368. {
  369. UnlockAhead();
  370. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  371. }
  372. );
  373. }
  374. else if (ItemStatus == SkillStatus.UnLock)
  375. {
  376. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  377. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  378. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab1), Auxiliary.ImageParse(UnlockCur), UnlockAmt.ToString("0")));
  379. ResourceManager.SetButtonEvent
  380. (
  381. CanvasLabel.Fe_Btn,
  382. () =>
  383. {
  384. Unlock();
  385. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  386. }
  387. );
  388. }
  389. else if (ItemStatus == SkillStatus.Upgrade)
  390. {
  391. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  392. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  393. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab2), Auxiliary.ImageParse(UpgradeCur), Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt)));
  394. ResourceManager.SetButtonEvent
  395. (
  396. CanvasLabel.Fe_Btn,
  397. () =>
  398. {
  399. Upgrade();
  400. DescriptionText.text = GetDescription(0);
  401. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab2) + "\n" + Auxiliary.ImageParse(UpgradeCur) + Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt);
  402. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  403. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  404. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  405. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab2), Auxiliary.ImageParse(UpgradeCur), Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt)));
  406. }
  407. );
  408. }
  409. }
  410. public void Upgrade()
  411. {
  412. Manager.Pay
  413. (
  414. FullID,
  415. NewUpgradeAmt,
  416. UpgradeCur,
  417. () =>
  418. {
  419. UpgradeSucceed();
  420. },
  421. StaticsManager.ItemID.升级技能,
  422. StaticsManager.ConsumeModule.Shop
  423. );
  424. }
  425. public void UpgradeSucceed()
  426. {
  427. AudioManager.PlayClip(AudioLabel.UseSkill);
  428. Level++;
  429. AnnulEffect();
  430. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString("0.00"));
  431. UpgradeValue(ref NewPlus, UpgradePlus, 1);
  432. UpgradeValue(ref NewPersonBuff, UpgradePerson, 1);
  433. UpgradeSkillCdBuff(ref NewSkillCdBuff, UpgradeCD, 1);
  434. UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
  435. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
  436. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, 1);
  437. GetAward();
  438. AddAchieve();
  439. if (FullID == "Ability1")
  440. {
  441. Manager.GardenLevel++;
  442. }
  443. }
  444. public void UnlockAhead()
  445. {
  446. Manager.Pay
  447. (
  448. FullID,
  449. UnlockAheadAmt,
  450. UnlockAheadCur,
  451. () =>
  452. {
  453. UnlockAheadSucceed();
  454. },
  455. StaticsManager.ItemID.提前解锁技能,
  456. StaticsManager.ConsumeModule.Shop
  457. );
  458. }
  459. public void UnlockAheadSucceed()
  460. {
  461. AudioManager.PlayClip(AudioLabel.UseSkill);
  462. if (UnlockCur == Current.Free)
  463. {
  464. Unlock();
  465. }
  466. else
  467. {
  468. ItemStatus = SkillStatus.UnLock;
  469. UIManager.UpdateManagePanelHint();
  470. }
  471. }
  472. public override void AnnulEffect()
  473. {
  474. Manager.Person -= NewPerson;
  475. Manager.CoinPerson -= NewCoinPerson;
  476. Manager.SkillCoinPersonBuff -= NewPlus;
  477. Manager.SkillPersonBuff -= NewPersonBuff;
  478. Manager.ExtraPersonSourceSpritesName.Remove(icon);
  479. Manager.ExtraCoinPersonSourceSpritesName.Remove(icon);
  480. if (Math.Abs(NewSkillCD) > 0.0005f)
  481. {
  482. for (int i = 0; i < Manager.SkillList.Count; i++)
  483. {
  484. Manager.SkillList[i].Cool(-NewSkillCD, false, false);
  485. }
  486. }
  487. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  488. {
  489. for (int i = 0; i < Manager.SkillList.Count; i++)
  490. {
  491. Manager.SkillList[i].Cool(-NewSkillCdBuff, false, true);
  492. }
  493. }
  494. }
  495. public override void UpdateStatus()
  496. {
  497. if (!Manager.Inited)
  498. {
  499. return;
  500. }
  501. if (Manager.GardenLevel >= UnlockLv)
  502. {
  503. if (ItemStatus == SkillStatus.Lock)
  504. {
  505. if (UnlockCur == Current.Free)
  506. {
  507. Unlock();
  508. }
  509. else
  510. {
  511. ItemStatus = SkillStatus.UnLock;
  512. UIManager.UpdateManagePanelHint();
  513. }
  514. }
  515. }
  516. }
  517. public ExchangeInfo GetUnlockAheadExchangeValue(float rate, StaticsManager.ConsumeModule consumeModule)
  518. {
  519. ExchangeInfo info = ExchangeInfo.GetExchangeInfo(UnlockAheadCur, UnlockAheadAmt, rate);
  520. ExchangeInfo.GetExchangeValue(info, consumeModule);
  521. return info;
  522. }
  523. protected double GetUpgradeAmt(string str)
  524. {
  525. if (string.IsNullOrEmpty(str))
  526. {
  527. return UnlockAmt;
  528. }
  529. else
  530. {
  531. return double.Parse(str);
  532. }
  533. }
  534. protected override string GetDescription(int offset)
  535. {
  536. float temp;
  537. string[] strings = Desc.Split(TransferLabel.OpenChar, TransferLabel.CloseChar);
  538. StringBuilder stringBuilder = new StringBuilder();
  539. for (int i = 0; i < strings.Length; i++)
  540. {
  541. if (strings[i].Contains(TransferLabel.Level))
  542. {
  543. }
  544. else if (strings[i].Contains(TransferLabel.Person))
  545. {
  546. #region MyRegion
  547. if (!Person.Equal(0))
  548. {
  549. temp = NewPerson;
  550. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  551. UpgradeUnit(ref temp, strings[i]);
  552. float remainder = temp % 1;
  553. if (remainder > 0)
  554. {
  555. stringBuilder.Append(temp.ToString("0") + "+");
  556. }
  557. else
  558. {
  559. stringBuilder.Append(temp.ToString("0"));
  560. }
  561. }
  562. else if (!PersonBuff.Equal(0))
  563. {
  564. temp = NewPersonBuff;
  565. UpgradeValue(ref temp, UpgradePerson, offset);
  566. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  567. }
  568. #endregion
  569. }
  570. else if (strings[i].Contains(TransferLabel.SkillCD))
  571. {
  572. #region MyRegion
  573. if (!SkillCD.Equal(0))
  574. {
  575. temp = NewSkillCD;
  576. UpgradeValue(ref temp, SkillCD, UpgradeCD, offset);
  577. UpgradeUnit(ref temp, strings[i]);
  578. stringBuilder.Append(temp.ToString("0"));
  579. }
  580. else if (!SkillCdBuff.Equal(0))
  581. {
  582. temp = NewSkillCdBuff;
  583. UpgradeSkillCdBuff(ref temp, UpgradeCD, offset);
  584. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  585. }
  586. #endregion
  587. }
  588. else if (strings[i].Contains(TransferLabel.CoinPerson))
  589. {
  590. #region MyRegion
  591. if (!CoinPerson.Equal(0))
  592. {
  593. temp = NewCoinPerson;
  594. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  595. UpgradeUnit(ref temp, strings[i]);
  596. float remainder = temp % 1;
  597. if (remainder > 0)
  598. {
  599. stringBuilder.Append(temp.ToString("0") + "+");
  600. }
  601. else
  602. {
  603. stringBuilder.Append(temp.ToString("0"));
  604. }
  605. }
  606. else if (!Plus.Equal(0))
  607. {
  608. temp = NewPlus;
  609. UpgradeValue(ref temp, UpgradePlus, offset);
  610. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  611. }
  612. #endregion
  613. }
  614. else
  615. {
  616. stringBuilder.Append(strings[i]);
  617. }
  618. }
  619. return stringBuilder.ToString();
  620. }
  621. }