Skill.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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. },
  311. StaticsManager.ItemID.使用技能,
  312. StaticsManager.ConsumeModule.Shop
  313. );
  314. }
  315. protected virtual void OnClick()
  316. {
  317. AudioManager.PlayClip(AudioLabel.ClickButton);
  318. if (ItemStatus == SkillStatus.Buy)
  319. {
  320. if (BuyCur == Current.AD)
  321. {
  322. Buy();
  323. }
  324. else
  325. {
  326. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  327. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  328. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  329. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  330. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  331. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab3), Auxiliary.ImageParse(BuyCur), UseAmt));
  332. ResourceManager.SetButtonEvent
  333. (
  334. CanvasLabel.Fe_Btn,
  335. () =>
  336. {
  337. Buy();
  338. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  339. }
  340. );
  341. }
  342. }
  343. else if (ItemStatus == SkillStatus.Lock)
  344. {
  345. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  346. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  347. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  348. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  349. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  350. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab0), Auxiliary.ImageParse(UnlockAheadCur), UnlockAheadAmt.ToString("0")));
  351. ResourceManager.SetButtonEvent
  352. (
  353. CanvasLabel.Fe_Btn,
  354. () =>
  355. {
  356. UnlockAhead();
  357. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  358. }
  359. );
  360. }
  361. }
  362. protected virtual void UnlockAhead()
  363. {
  364. Manager.Pay
  365. (
  366. FullID,
  367. UnlockAheadAmt,
  368. UnlockAheadCur,
  369. () =>
  370. {
  371. AudioManager.PlayClip(AudioLabel.ClickButton);
  372. SkillIcon.material = null;
  373. ItemStatus = SkillStatus.Buy;
  374. },
  375. StaticsManager.ItemID.提前解锁技能,
  376. StaticsManager.ConsumeModule.Shop
  377. );
  378. }
  379. public override void Reactive()
  380. {
  381. if (ItemStatus == SkillStatus.Use)
  382. {
  383. AnnulBuff();
  384. Manager.UsingSkillList.Remove(this);
  385. }
  386. else if (ItemStatus == SkillStatus.Cool)
  387. {
  388. Manager.CoolSkillList.Remove(this);
  389. }
  390. }
  391. public override void Init(bool firstInit, float elapse, List<List<Skill>> useList, XmlAttributeCollection attribute)
  392. {
  393. Level = int.Parse(attribute[3].Value);
  394. UseTimer = float.Parse(attribute[5].Value);
  395. CoolTimer = float.Parse(attribute[4].Value);
  396. itemStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), attribute[2].Value);
  397. NewPlus = Plus;
  398. NewPerson = Person;
  399. NewSkillCD = SkillCD;
  400. NewDuration = Duration;
  401. NewCoinOnce = CoinOnce;
  402. NewSkillCdBuff = SkillCdBuff;
  403. NewPersonBuff = PersonBuff;
  404. NewCoinPerson = CoinPerson;
  405. NewUpgradeAmt = UpgradeAmt;
  406. NewCoinOnceBuff = CoinOnceBuff;
  407. if (itemStatus == SkillStatus.Lock || itemStatus == SkillStatus.UnLock)
  408. {
  409. SkillIcon.material = Lib.GrayMat;
  410. }
  411. else
  412. {
  413. SkillIcon.material = null;
  414. }
  415. if (itemStatus == SkillStatus.Use)
  416. {
  417. GetBuff();
  418. if (UseTimer < elapse)
  419. {
  420. Manager.UsingSkillList.Remove(this);
  421. if (useList.Count > 0)
  422. {
  423. if (UseTimer < Manager.IncomeCircleTimer)
  424. {
  425. useList[0].UniqueAdd(this);
  426. }
  427. else
  428. {
  429. int circle = 1 + Mathf.FloorToInt((UseTimer - Manager.IncomeCircleTimer)/Manager.IncomeCircleTime);
  430. useList[circle].UniqueAdd(this);
  431. }
  432. }
  433. }
  434. else
  435. {
  436. UseTimer -= elapse;
  437. }
  438. }
  439. else if (itemStatus == SkillStatus.Cool)
  440. {
  441. CoolTimer -= elapse;
  442. Manager.CoolSkillList.Add(this);
  443. }
  444. button.onClick.RemoveAllListeners();
  445. button.onClick.AddListener(OnClick);
  446. DescriptionText.text = GetDescription(0);
  447. ItemStatus = ItemStatus;
  448. }
  449. public override void Cool(float amt, bool current, bool buff)
  450. {
  451. if (!CoolLock)
  452. {
  453. return;
  454. }
  455. if (current)
  456. {
  457. if (ItemStatus != SkillStatus.Cool)
  458. {
  459. return;
  460. }
  461. if (buff)
  462. {
  463. CoolTimer -= CD * amt;
  464. }
  465. else
  466. {
  467. CoolTimer -= amt;
  468. }
  469. }
  470. else
  471. {
  472. if (buff)
  473. {
  474. CdBuff = 1 - amt;
  475. }
  476. else
  477. {
  478. CD -= amt;
  479. }
  480. }
  481. }
  482. protected double GetUpgradeAmt(string str)
  483. {
  484. if (string.IsNullOrEmpty(str))
  485. {
  486. return UnlockAmt;
  487. }
  488. else
  489. {
  490. return double.Parse(str);
  491. }
  492. }
  493. protected override string GetDescription(int offset)
  494. {
  495. float temp;
  496. string[] strings = Desc.Split(TransferLabel.OpenChar, TransferLabel.CloseChar);
  497. StringBuilder stringBuilder = new StringBuilder();
  498. for (int i = 0; i < strings.Length; i++)
  499. {
  500. if (strings[i].Contains(TransferLabel.Level))
  501. {
  502. }
  503. else if (strings[i].Contains(TransferLabel.Person))
  504. {
  505. #region MyRegion
  506. if (!Person.Equal(0))
  507. {
  508. temp = NewPerson;
  509. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  510. UpgradeUnit(ref temp, strings[i]);
  511. float remainder = temp % 1;
  512. if (remainder > 0)
  513. {
  514. stringBuilder.Append(temp.ToString("0") + "+");
  515. }
  516. else
  517. {
  518. stringBuilder.Append(temp.ToString("0"));
  519. }
  520. }
  521. else if (!PersonBuff.Equal(0))
  522. {
  523. temp = NewPersonBuff;
  524. UpgradeValue(ref temp, UpgradePerson, offset);
  525. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  526. }
  527. #endregion
  528. }
  529. else if (strings[i].Contains(TransferLabel.Duration))
  530. {
  531. #region MyRegion
  532. temp = NewDuration;
  533. UpgradeValue(ref temp, Duration, UpgradeDuration, offset);
  534. UpgradeUnit(ref temp, strings[i]);
  535. stringBuilder.Append(temp.ToString("0"));
  536. #endregion
  537. }
  538. else if (strings[i].Contains(TransferLabel.CoinOnce))
  539. {
  540. #region MyRegion
  541. if (!CoinOnce.Equal(0))
  542. {
  543. temp = NewCoinOnce;
  544. UpgradeValue(ref temp, CoinOnce, UpgradeCoinOnce, offset);
  545. stringBuilder.Append(temp.ToString("0"));
  546. }
  547. else if (!CoinOnceBuff.Equal(0))
  548. {
  549. temp = NewCoinOnceBuff;
  550. UpgradeValue(ref temp, UpgradeCoinOnce, offset);
  551. stringBuilder.Append(temp.ToString("0"));
  552. }
  553. #endregion
  554. }
  555. else if (strings[i].Contains(TransferLabel.DiamondOnce))
  556. {
  557. #region MyRegion
  558. stringBuilder.Append(DiamondOnce.ToString("0"));
  559. #endregion
  560. }
  561. else if (strings[i].Contains(TransferLabel.CoinPerson))
  562. {
  563. #region MyRegion
  564. if (!CoinPerson.Equal(0))
  565. {
  566. temp = NewCoinPerson;
  567. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  568. float remainder = temp % 1;
  569. if (remainder > 0)
  570. {
  571. stringBuilder.Append(temp.ToString("0") + "+");
  572. }
  573. else
  574. {
  575. stringBuilder.Append(temp.ToString("0"));
  576. }
  577. }
  578. else if (!Plus.Equal(0))
  579. {
  580. temp = NewPlus;
  581. UpgradeValue(ref temp, UpgradePlus, offset);
  582. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  583. }
  584. else
  585. {
  586. throw new Exception();
  587. }
  588. #endregion
  589. }
  590. else
  591. {
  592. stringBuilder.Append(strings[i]);
  593. }
  594. }
  595. return stringBuilder.ToString();
  596. }
  597. }