Skill.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. using System.Xml;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. public class Skill : 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 SkillFullIDPrefix + ID; }
  20. }
  21. public bool CoolLock;
  22. public float CD;
  23. public float Person;
  24. public float SkillCD;
  25. public float UseAmt;
  26. public float Duration;
  27. public float CoinOnce;
  28. public float CoinPerson;
  29. public float DiamondOnce;
  30. public double UpgradeAmt;
  31. public float Plus;
  32. public float CdBuff = 1;
  33. public float PersonBuff;
  34. public float SkillCdBuff;
  35. public float CoinOnceBuff;
  36. public int UnlockLv;
  37. public float UnlockAmt;
  38. public float UnlockAheadBaseAmt;
  39. public float UnlockAheadDeltaAmt;
  40. public string UnlockPos;
  41. public Current BuyCur;
  42. public Current UnlockCur;
  43. public Current UpgradeCur;
  44. public Current UnlockAheadCur;
  45. public string Label;
  46. public string Anim;
  47. public string UpgradeCD;
  48. public string UpgradeFml;
  49. public string UpgradePlus;
  50. public string UpgradePerson;
  51. public string UpgradeDuration;
  52. public string UpgradeCoinOnce;
  53. #endregion
  54. public float UseTimer;
  55. public float CoolTimer;
  56. public float NewPlus;
  57. public float NewPerson;
  58. public float NewSkillCD;
  59. public float NewDuration;
  60. public float NewCoinOnce;
  61. public float NewSkillCdBuff;
  62. public float NewPersonBuff;
  63. public float NewCoinPerson;
  64. public float NewCoinOnceBuff;
  65. public double NewUpgradeAmt;
  66. public override SkillStatus ItemStatus
  67. {
  68. get { return itemStatus; }
  69. set
  70. {
  71. itemStatus = value;
  72. if (itemStatus == SkillStatus.Buy)
  73. {
  74. button.interactable = true;
  75. if (BuyCur == Current.AD)
  76. {
  77. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.Common__AD));
  78. }
  79. else
  80. {
  81. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab3), "\n", Auxiliary.ImageParse(BuyCur), UseAmt.ToString("0"));
  82. }
  83. }
  84. else if (itemStatus == SkillStatus.Use)
  85. {
  86. button.interactable = false;
  87. }
  88. else if (itemStatus == SkillStatus.Lock)
  89. {
  90. button.interactable = true;
  91. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab0), "\n", new MulLanStr(LanguageLabel.UI__Fe_BtnLab4), UnlockLv.ToString());
  92. }
  93. else if (itemStatus == SkillStatus.Cool)
  94. {
  95. button.interactable = false;
  96. }
  97. }
  98. }
  99. #endregion
  100. public Skill(XmlAttributeCollection attribute)
  101. {
  102. #region 配置
  103. ID = int.Parse(attribute[0].Value);
  104. icon = attribute[31].Value;
  105. Anim = attribute[32].Value;
  106. Label = attribute[33].Value;
  107. UnlockPos = attribute[19].Value;
  108. UpgradeCD = attribute[29].Value;
  109. UpgradeFml = attribute[24].Value;
  110. UpgradePlus = attribute[25].Value;
  111. UpgradePerson = attribute[26].Value;
  112. UpgradeDuration = attribute[28].Value;
  113. UpgradeCoinOnce = attribute[27].Value;
  114. UnlockLv = Auxiliary.StringToInt(attribute[13].Value,0);
  115. ItemIndex = Auxiliary.StringToInt(attribute[3].Value,0);
  116. CD = Auxiliary.StringToFloat(attribute[12].Value,0);
  117. UseAmt = Auxiliary.StringToFloat(attribute[21].Value,0);
  118. Duration = Auxiliary.StringToFloat(attribute[11].Value,0);
  119. UnlockAmt = Auxiliary.StringToFloat(attribute[18].Value,0);
  120. DiamondOnce = Auxiliary.StringToFloat(attribute[9].Value,0);
  121. UnlockAheadBaseAmt = Auxiliary.StringToFloat(attribute[16].Value,0);
  122. UnlockAheadDeltaAmt = Auxiliary.StringToFloat(attribute[15].Value, 0);
  123. SkillTab = SkillClassParse(attribute[2].Value);
  124. CoolLock = Auxiliary.StringToBool(attribute[5].Value, false);
  125. UpgradeAmt = GetUpgradeAmt(attribute[23].Value);
  126. BuyCur = Auxiliary.CurrentParse(attribute[20].Value);
  127. UnlockCur = Auxiliary.CurrentParse(attribute[17].Value);
  128. UpgradeCur = Auxiliary.CurrentParse(attribute[22].Value);
  129. UnlockAheadCur = Auxiliary.CurrentParse(attribute[14].Value);
  130. ValueBuffParse(out Person, out PersonBuff, attribute[7].Value);
  131. ValueBuffParse(out SkillCD, out SkillCdBuff, attribute[10].Value);
  132. ValueBuffParse(out CoinOnce, out CoinOnceBuff, attribute[8].Value);
  133. ValueBuffParse(out CoinPerson, out Plus, attribute[6].Value);
  134. #endregion
  135. SkillType = SkillType.Skill;
  136. }
  137. public virtual void AnnulBuff()
  138. {
  139. Manager.TempSkillCoinPersonBuff -= NewPlus;
  140. Manager.TempSkillPerson -= NewPerson;
  141. Manager.TempSkillPersonBuff -= NewPersonBuff;
  142. Manager.TempSkillCoinPerson -= NewCoinPerson;
  143. Manager.ExtraPersonSourceSpritesName.Remove(icon);
  144. Manager.ExtraCoinPersonSourceSpritesName.Remove(icon);
  145. if (!NewSkillCD.Equal(0))
  146. {
  147. for (int i = 0; i < Manager.SkillList.Count; i++)
  148. {
  149. Manager.SkillList[i].Cool(-NewSkillCD, true, false);
  150. }
  151. }
  152. if (!NewSkillCdBuff.Equal(0))
  153. {
  154. for (int i = 0; i < Manager.SkillList.Count; i++)
  155. {
  156. Manager.SkillList[i].Cool(-NewSkillCdBuff, true, true);
  157. }
  158. }
  159. }
  160. public virtual bool DoCD()
  161. {
  162. CoolTimer -= Time.deltaTime;
  163. TimeSpan timeSpan = new TimeSpan(0, 0, Mathf.CeilToInt(CoolTimer));
  164. if (timeSpan.Hours >= 1)
  165. {
  166. ButtonTitle.text = string.Format("{0}\n{1}{2}:{3}", Language.GetStr(LanguageLabel.UI__Fe_BtnLab6), Language.GetStr(LanguageLabel.UI__Fe_BtnLab7), timeSpan.Hours.ToString("00"), timeSpan.Minutes.ToString("00"));
  167. }
  168. else
  169. {
  170. ButtonTitle.text = string.Format("{0}\n{1}{2}:{3}", Language.GetStr(LanguageLabel.UI__Fe_BtnLab6), Language.GetStr(LanguageLabel.UI__Fe_BtnLab7), timeSpan.Minutes.ToString("00"), timeSpan.Seconds.ToString("00"));
  171. }
  172. if (CoolTimer <= 0)
  173. {
  174. ItemStatus = SkillStatus.Buy;
  175. return true;
  176. }
  177. else
  178. {
  179. return false;
  180. }
  181. }
  182. public override bool DoUpdate()
  183. {
  184. UseTimer -= Time.deltaTime;
  185. TimeSpan timeSpan = new TimeSpan(0, 0, Mathf.CeilToInt(UseTimer));
  186. if (timeSpan.Hours >= 1)
  187. {
  188. ButtonTitle.text = string.Format("{0}\n{1}{2}:{3}", Language.GetStr(LanguageLabel.UI__Fe_BtnLab8), Language.GetStr(LanguageLabel.UI__Fe_BtnLab7), timeSpan.Hours.ToString("00"), timeSpan.Minutes.ToString("00"));
  189. }
  190. else
  191. {
  192. ButtonTitle.text = string.Format("{0}\n{1}{2}:{3}", Language.GetStr(LanguageLabel.UI__Fe_BtnLab8), Language.GetStr(LanguageLabel.UI__Fe_BtnLab7), timeSpan.Minutes.ToString("00"), timeSpan.Seconds.ToString("00"));
  193. }
  194. if (UseTimer <= 0)
  195. {
  196. AnnulEffect();
  197. return true;
  198. }
  199. else
  200. {
  201. return false;
  202. }
  203. }
  204. public override void AnnulEffect()
  205. {
  206. CoolTimer = CD * CdBuff - 1;
  207. ItemStatus = SkillStatus.Cool;
  208. Manager.CoolSkillList.Add(this);
  209. AnnulBuff();
  210. }
  211. public override void UpdateStatus()
  212. {
  213. if (!Manager.Inited)
  214. {
  215. return;
  216. }
  217. if (Manager.GardenLevel >= UnlockLv)
  218. {
  219. if (ItemStatus == SkillStatus.Lock)
  220. {
  221. SkillIcon.material = null;
  222. ItemStatus = SkillStatus.Buy;
  223. }
  224. }
  225. }
  226. protected virtual void GetAward()
  227. {
  228. float temp = NewCoinOnce + Manager.CoinPerson * NewCoinOnceBuff;
  229. Manager.AddCoin(temp, StaticsManager.ItemID.获得金币, StaticsManager.ConsumeModule.AD);
  230. Manager.AddDiamond(DiamondOnce, StaticsManager.ItemID.获得钻石, StaticsManager.ConsumeModule.AD);
  231. StringBuilder sb = new StringBuilder();
  232. if (!temp.Equal(0))
  233. {
  234. sb.AppendFormat("{0}{1}{2}", Language.GetStr(LanguageLabel.UI__J_Info0), TransferLabel.CoinSprite, temp.ToString("0"));
  235. }
  236. if (!DiamondOnce.Equal(0))
  237. {
  238. sb.AppendFormat("{0}{1}{2}", Language.GetStr(LanguageLabel.UI__J_Info0), TransferLabel.DiamondSprite, DiamondOnce.ToString("0"));
  239. }
  240. string str = sb.ToString();
  241. if (!string.IsNullOrEmpty(str))
  242. {
  243. InfoBoxManager.GardenInfoBox.Display(sb.ToString(), 10f, Color.white, ResourceManager.LoadSprite("Atlas", Folder.Atlas));
  244. }
  245. }
  246. protected virtual void GetBuff()
  247. {
  248. if (UseTimer.Equal(-1))
  249. {
  250. AnnulEffect();
  251. }
  252. else
  253. {
  254. ItemStatus = SkillStatus.Use;
  255. Manager.UsingSkillList.Add(this);
  256. }
  257. Manager.TempSkillCoinPersonBuff += NewPlus;
  258. Manager.TempSkillPerson += NewPerson;
  259. Manager.TempSkillPersonBuff += NewPersonBuff;
  260. Manager.TempSkillCoinPerson += NewCoinPerson;
  261. if (Math.Abs(NewPerson) > 0.001f || Math.Abs(NewPersonBuff) > 0.001f)
  262. {
  263. Manager.ExtraPersonSourceSpritesName.UniqueAdd(icon);
  264. }
  265. if (Math.Abs(NewPlus) > 0.001f || Math.Abs(NewCoinPerson) > 0.001f)
  266. {
  267. Manager.ExtraCoinPersonSourceSpritesName.UniqueAdd(icon);
  268. }
  269. if (!NewSkillCD.Equal(0))
  270. {
  271. for (int i = 0; i < Manager.SkillList.Count; i++)
  272. {
  273. Manager.SkillList[i].Cool(NewSkillCD, true, false);
  274. }
  275. }
  276. if (!NewSkillCdBuff.Equal(0))
  277. {
  278. for (int i = 0; i < Manager.SkillList.Count; i++)
  279. {
  280. Manager.SkillList[i].Cool(NewSkillCdBuff, true, true);
  281. }
  282. }
  283. }
  284. protected virtual void Buy()
  285. {
  286. if (ID == 5)
  287. {
  288. StaticsManager.GetInstance().AdClicked(1);
  289. }
  290. else if (ID == 6)
  291. {
  292. StaticsManager.GetInstance().AdClicked(2);
  293. }
  294. Manager.Pay
  295. (
  296. FullID,
  297. UseAmt,
  298. BuyCur,
  299. () =>
  300. {
  301. AudioManager.PlayClip(AudioLabel.UseSkill);
  302. if (BuyCur != Current.AD)
  303. {
  304. Manager.UseSkillAmt++;
  305. }
  306. UseTimer = NewDuration - 1;
  307. GetBuff();
  308. GetAward();
  309. InfoBoxManager.GardenInfoBox.Display(string.Format("{0}{1}", Language.GetStr(LanguageLabel.UI__J_Info1), Language.GetStr(LanguageLabel.CombineLanguageLabel(LanguageLabel.SkillName, FullID))), 10f, Color.white, ResourceManager.LoadSprite(ResourceLabel.Atlas, Folder.Atlas));
  310. ConfigManager.SaveConfigDocument();
  311. ConfigManager.SaveConfigDocumentToDisk();
  312. },
  313. StaticsManager.ItemID.使用技能,
  314. StaticsManager.ConsumeModule.Shop
  315. );
  316. }
  317. protected virtual void OnClick()
  318. {
  319. AudioManager.PlayClip(AudioLabel.ClickButton);
  320. if (ItemStatus == SkillStatus.Buy)
  321. {
  322. if (BuyCur == Current.AD)
  323. {
  324. Buy();
  325. }
  326. else
  327. {
  328. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  329. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  330. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  331. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  332. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  333. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab3), Auxiliary.ImageParse(BuyCur), UseAmt));
  334. ResourceManager.SetButtonEvent
  335. (
  336. CanvasLabel.Fe_Btn,
  337. () =>
  338. {
  339. Buy();
  340. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  341. }
  342. );
  343. }
  344. }
  345. else if (ItemStatus == SkillStatus.Lock)
  346. {
  347. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  348. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  349. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  350. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  351. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  352. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab0), Auxiliary.ImageParse(UnlockAheadCur), UnlockAheadAmt.ToString("0")));
  353. ResourceManager.SetButtonEvent
  354. (
  355. CanvasLabel.Fe_Btn,
  356. () =>
  357. {
  358. UnlockAhead();
  359. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  360. }
  361. );
  362. }
  363. }
  364. protected virtual void UnlockAhead()
  365. {
  366. Manager.Pay
  367. (
  368. FullID,
  369. UnlockAheadAmt,
  370. UnlockAheadCur,
  371. () =>
  372. {
  373. AudioManager.PlayClip(AudioLabel.ClickButton);
  374. SkillIcon.material = null;
  375. ItemStatus = SkillStatus.Buy;
  376. ConfigManager.SaveConfigDocument();
  377. ConfigManager.SaveConfigDocumentToDisk();
  378. },
  379. StaticsManager.ItemID.提前解锁技能,
  380. StaticsManager.ConsumeModule.Shop
  381. );
  382. }
  383. public override void Reactive()
  384. {
  385. if (ItemStatus == SkillStatus.Use)
  386. {
  387. AnnulBuff();
  388. Manager.UsingSkillList.Remove(this);
  389. }
  390. else if (ItemStatus == SkillStatus.Cool)
  391. {
  392. Manager.CoolSkillList.Remove(this);
  393. }
  394. }
  395. public override void Init(bool firstInit, float elapse, List<List<Skill>> useList, XmlAttributeCollection attribute)
  396. {
  397. Level = int.Parse(attribute[3].Value);
  398. UseTimer = float.Parse(attribute[5].Value);
  399. CoolTimer = float.Parse(attribute[4].Value);
  400. itemStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), attribute[2].Value);
  401. NewPlus = Plus;
  402. NewPerson = Person;
  403. NewSkillCD = SkillCD;
  404. NewDuration = Duration;
  405. NewCoinOnce = CoinOnce;
  406. NewSkillCdBuff = SkillCdBuff;
  407. NewPersonBuff = PersonBuff;
  408. NewCoinPerson = CoinPerson;
  409. NewUpgradeAmt = UpgradeAmt;
  410. NewCoinOnceBuff = CoinOnceBuff;
  411. if (itemStatus == SkillStatus.Lock || itemStatus == SkillStatus.UnLock)
  412. {
  413. SkillIcon.material = Lib.GrayMat;
  414. }
  415. else
  416. {
  417. SkillIcon.material = null;
  418. }
  419. if (itemStatus == SkillStatus.Use)
  420. {
  421. GetBuff();
  422. if (UseTimer < elapse)
  423. {
  424. Manager.UsingSkillList.Remove(this);
  425. if (useList.Count > 0)
  426. {
  427. if (UseTimer < Manager.IncomeCircleTimer)
  428. {
  429. useList[0].UniqueAdd(this);
  430. }
  431. else
  432. {
  433. int circle = 1 + Mathf.FloorToInt((UseTimer - Manager.IncomeCircleTimer)/Manager.IncomeCircleTime);
  434. useList[circle].UniqueAdd(this);
  435. }
  436. }
  437. }
  438. else
  439. {
  440. UseTimer -= elapse;
  441. }
  442. }
  443. else if (itemStatus == SkillStatus.Cool)
  444. {
  445. CoolTimer -= elapse;
  446. Manager.CoolSkillList.Add(this);
  447. }
  448. button.onClick.RemoveAllListeners();
  449. button.onClick.AddListener(OnClick);
  450. DescriptionText.text = GetDescription(0);
  451. ItemStatus = ItemStatus;
  452. }
  453. public override void Cool(float amt, bool current, bool buff)
  454. {
  455. if (!CoolLock)
  456. {
  457. return;
  458. }
  459. if (current)
  460. {
  461. if (ItemStatus != SkillStatus.Cool)
  462. {
  463. return;
  464. }
  465. if (buff)
  466. {
  467. CoolTimer -= CD * amt;
  468. }
  469. else
  470. {
  471. CoolTimer -= amt;
  472. }
  473. }
  474. else
  475. {
  476. if (buff)
  477. {
  478. CdBuff = 1 - amt;
  479. }
  480. else
  481. {
  482. CD -= amt;
  483. }
  484. }
  485. }
  486. protected double GetUpgradeAmt(string str)
  487. {
  488. if (string.IsNullOrEmpty(str))
  489. {
  490. return UnlockAmt;
  491. }
  492. else
  493. {
  494. return double.Parse(str);
  495. }
  496. }
  497. protected override string GetDescription(int offset)
  498. {
  499. float temp;
  500. string[] strings = Desc.Split(TransferLabel.OpenChar, TransferLabel.CloseChar);
  501. StringBuilder stringBuilder = new StringBuilder();
  502. for (int i = 0; i < strings.Length; i++)
  503. {
  504. if (strings[i].Contains(TransferLabel.Level))
  505. {
  506. }
  507. else if (strings[i].Contains(TransferLabel.Person))
  508. {
  509. #region MyRegion
  510. if (!Person.Equal(0))
  511. {
  512. temp = NewPerson;
  513. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  514. UpgradeUnit(ref temp, strings[i]);
  515. float remainder = temp % 1;
  516. if (remainder > 0)
  517. {
  518. stringBuilder.Append(temp.ToString("0") + "+");
  519. }
  520. else
  521. {
  522. stringBuilder.Append(temp.ToString("0"));
  523. }
  524. }
  525. else if (!PersonBuff.Equal(0))
  526. {
  527. temp = NewPersonBuff;
  528. UpgradeValue(ref temp, UpgradePerson, offset);
  529. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  530. }
  531. #endregion
  532. }
  533. else if (strings[i].Contains(TransferLabel.Duration))
  534. {
  535. #region MyRegion
  536. temp = NewDuration;
  537. UpgradeValue(ref temp, Duration, UpgradeDuration, offset);
  538. UpgradeUnit(ref temp, strings[i]);
  539. stringBuilder.Append(temp.ToString("0"));
  540. #endregion
  541. }
  542. else if (strings[i].Contains(TransferLabel.CoinOnce))
  543. {
  544. #region MyRegion
  545. if (!CoinOnce.Equal(0))
  546. {
  547. temp = NewCoinOnce;
  548. UpgradeValue(ref temp, CoinOnce, UpgradeCoinOnce, offset);
  549. stringBuilder.Append(temp.ToString("0"));
  550. }
  551. else if (!CoinOnceBuff.Equal(0))
  552. {
  553. temp = NewCoinOnceBuff;
  554. UpgradeValue(ref temp, UpgradeCoinOnce, offset);
  555. stringBuilder.Append(temp.ToString("0"));
  556. }
  557. #endregion
  558. }
  559. else if (strings[i].Contains(TransferLabel.DiamondOnce))
  560. {
  561. #region MyRegion
  562. stringBuilder.Append(DiamondOnce.ToString("0"));
  563. #endregion
  564. }
  565. else if (strings[i].Contains(TransferLabel.CoinPerson))
  566. {
  567. #region MyRegion
  568. if (!CoinPerson.Equal(0))
  569. {
  570. temp = NewCoinPerson;
  571. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  572. float remainder = temp % 1;
  573. if (remainder > 0)
  574. {
  575. stringBuilder.Append(temp.ToString("0") + "+");
  576. }
  577. else
  578. {
  579. stringBuilder.Append(temp.ToString("0"));
  580. }
  581. }
  582. else if (!Plus.Equal(0))
  583. {
  584. temp = NewPlus;
  585. UpgradeValue(ref temp, UpgradePlus, offset);
  586. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  587. }
  588. else
  589. {
  590. throw new Exception();
  591. }
  592. #endregion
  593. }
  594. else
  595. {
  596. stringBuilder.Append(strings[i]);
  597. }
  598. }
  599. return stringBuilder.ToString();
  600. }
  601. }