Ability.cs 22 KB

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