Ability.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  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.ShrinkNumberStr(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.ShrinkNumberStr(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.SkillPlus += NewPlus;
  226. Manager.SkillPersonBuff += NewPersonBuff;
  227. if (!NewSkillCD.Equal(0))
  228. {
  229. for (int i = 0; i < Manager.SkillList.Count; i++)
  230. {
  231. Manager.SkillList[i].Cool(NewSkillCD, false, false);
  232. }
  233. }
  234. if (!NewSkillCdBuff.Equal(0))
  235. {
  236. for (int i = 0; i < Manager.SkillList.Count; i++)
  237. {
  238. Manager.SkillList[i].Cool(NewSkillCdBuff, false, true);
  239. }
  240. }
  241. }
  242. protected void AddAchieve()
  243. {
  244. if (!string.IsNullOrEmpty(Elf))
  245. {
  246. Manager.AllElfLevel++;
  247. }
  248. }
  249. protected void GetSlot()
  250. {
  251. for (int i = 0; i < Auxiliary.StringToInt(UnlockPos, 0); i++)
  252. {
  253. GardenManager.UnlockSlot();
  254. }
  255. }
  256. protected void Zoom()
  257. {
  258. if (!string.IsNullOrEmpty(Elf))
  259. {
  260. if (GardenManager.PlantSlotList.Count <= Garden.CurrentPage * GardenManager.TotalSlotInOnePage)
  261. {
  262. return;
  263. }
  264. GardenManager.CreateElfTimer = Random.Range(GardenManager.MinCreateElfTime, GardenManager.MaxCreateElfTime);
  265. Slot zoomSlot = GardenManager.PlantSlotList.Random(1, false, false, slot => { return slot.Index >= Garden.CurrentPage* GardenManager.TotalSlotInOnePage; })[0];
  266. if (zoomSlot.Index% GardenManager.TotalSlotInOnePage == BannedSlotIndexForZoomIn)
  267. {
  268. return;
  269. }
  270. Flower flower = zoomSlot.PlantFlower;
  271. flower.GetElf(GardenManager.ElfList.Back(0), 0, 0, 0, 0);
  272. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  273. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  274. TweenRoot tween = ResourceManager.Get(CanvasLabel.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(CanvasLabel.Fe_Info).TweenBacCG();
  298. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  299. tween = ResourceManager.Get(CanvasLabel.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. public 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.GardenLevel = 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. SkillIcon.material = null;
  335. ItemStatus = SkillStatus.Upgrade;
  336. if (UnlockCur != Current.Free)
  337. {
  338. UIManager.UpdateManagePanelHint();
  339. }
  340. Level = 1;
  341. GetAward();
  342. AddAchieve();
  343. GetSlot();
  344. }
  345. public void OnClick()
  346. {
  347. AudioManager.PlayClip(AudioLabel.ClickButton);
  348. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  349. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  350. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  351. if (ItemStatus == SkillStatus.Lock)
  352. {
  353. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  354. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  355. ResourceManager.SetText(CanvasLabel.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. CanvasLabel.Fe_Btn,
  359. () =>
  360. {
  361. UnlockAhead();
  362. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  363. }
  364. );
  365. }
  366. else if (ItemStatus == SkillStatus.UnLock)
  367. {
  368. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  369. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  370. ResourceManager.SetText(CanvasLabel.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. CanvasLabel.Fe_Btn,
  374. () =>
  375. {
  376. Unlock();
  377. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  378. }
  379. );
  380. }
  381. else if (ItemStatus == SkillStatus.Upgrade)
  382. {
  383. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  384. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  385. ResourceManager.SetText(CanvasLabel.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. CanvasLabel.Fe_Btn,
  389. () =>
  390. {
  391. Upgrade();
  392. DescriptionText.text = GetDescription(0);
  393. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab2) + "\n" + Auxiliary.ImageParse(UpgradeCur) + Auxiliary.ShrinkNumberStr(NewUpgradeAmt);
  394. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  395. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  396. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  397. ResourceManager.SetText(CanvasLabel.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. public 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.GardenLevel++;
  434. }
  435. }
  436. public 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.UpdateManagePanelHint();
  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].Cool(-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].Cool(-NewSkillCdBuff, false, true);
  482. }
  483. }
  484. }
  485. public override void UpdateStatus()
  486. {
  487. if (!Manager.Inited)
  488. {
  489. return;
  490. }
  491. if (Manager.GardenLevel >= 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.UpdateManagePanelHint();
  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. protected double GetUpgradeAmt(string str)
  514. {
  515. if (string.IsNullOrEmpty(str))
  516. {
  517. return UnlockAmt;
  518. }
  519. else
  520. {
  521. return double.Parse(str);
  522. }
  523. }
  524. protected override string GetDescription(int offset)
  525. {
  526. float temp;
  527. string[] strings = Desc.Split(TransferLabel.OpenChar, TransferLabel.CloseChar);
  528. StringBuilder stringBuilder = new StringBuilder();
  529. for (int i = 0; i < strings.Length; i++)
  530. {
  531. if (strings[i].Contains(TransferLabel.Level))
  532. {
  533. }
  534. else if (strings[i].Contains(TransferLabel.Person))
  535. {
  536. #region MyRegion
  537. if (!Person.Equal(0))
  538. {
  539. temp = NewPerson;
  540. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  541. UpgradeUnit(ref temp, strings[i]);
  542. float remainder = temp % 1;
  543. if (remainder > 0)
  544. {
  545. stringBuilder.Append(temp.ToString("0") + "+");
  546. }
  547. else
  548. {
  549. stringBuilder.Append(temp.ToString("0"));
  550. }
  551. }
  552. else if (!PersonBuff.Equal(0))
  553. {
  554. temp = NewPersonBuff;
  555. UpgradeValue(ref temp, UpgradePerson, offset);
  556. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  557. }
  558. #endregion
  559. }
  560. else if (strings[i].Contains(TransferLabel.SkillCD))
  561. {
  562. #region MyRegion
  563. if (!SkillCD.Equal(0))
  564. {
  565. temp = NewSkillCD;
  566. UpgradeValue(ref temp, SkillCD, UpgradeCD, offset);
  567. UpgradeUnit(ref temp, strings[i]);
  568. stringBuilder.Append(temp.ToString("0"));
  569. }
  570. else if (!SkillCdBuff.Equal(0))
  571. {
  572. temp = NewSkillCdBuff;
  573. UpgradeSkillCdBuff(ref temp, UpgradeCD, offset);
  574. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  575. }
  576. #endregion
  577. }
  578. else if (strings[i].Contains(TransferLabel.CoinPerson))
  579. {
  580. #region MyRegion
  581. if (!CoinPerson.Equal(0))
  582. {
  583. temp = NewCoinPerson;
  584. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  585. UpgradeUnit(ref temp, strings[i]);
  586. float remainder = temp % 1;
  587. if (remainder > 0)
  588. {
  589. stringBuilder.Append(temp.ToString("0") + "+");
  590. }
  591. else
  592. {
  593. stringBuilder.Append(temp.ToString("0"));
  594. }
  595. }
  596. else if (!Plus.Equal(0))
  597. {
  598. temp = NewPlus;
  599. UpgradeValue(ref temp, UpgradePlus, offset);
  600. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  601. }
  602. #endregion
  603. }
  604. else
  605. {
  606. stringBuilder.Append(strings[i]);
  607. }
  608. }
  609. return stringBuilder.ToString();
  610. }
  611. }