Ability.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. using UnityEngine;
  2. using System;
  3. using System.Xml;
  4. using System.Text;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. public class Ability : SkillRoot
  8. {
  9. #region 变量
  10. #region 配置
  11. protected float Person;
  12. protected float SkillCD;
  13. protected float CoinPerson;
  14. protected double UpgradeAmt;
  15. protected float Plus;
  16. protected float PersonBuff;
  17. protected float SkillCdBuff;
  18. protected int UnlockLv;
  19. protected float UnlockAmt;
  20. protected float UnlockAheadAmt;
  21. protected string UnlockPos;
  22. protected Current UnlockCur;
  23. protected Current UpgradeCur;
  24. protected Current UnlockAheadCur;
  25. protected bool ValidSlot;
  26. protected bool ValidAnim;
  27. protected string Label;
  28. protected string Anim;
  29. protected string UpgradeCD;
  30. protected string UpgradeFml;
  31. protected string UpgradePlus;
  32. protected string UpgradePerson;
  33. #endregion
  34. protected float NewPlus;
  35. protected float NewPerson;
  36. protected float NewSkillCD;
  37. protected float NewSkillCdBuff;
  38. protected float NewPersonBuff;
  39. protected float NewCoinPerson;
  40. protected double NewUpgradeAmt;
  41. public SkillStatus ItemStatus
  42. {
  43. get { return _ItemStatus; }
  44. set
  45. {
  46. _ItemStatus = value;
  47. if (_ItemStatus == SkillStatus.Lock)
  48. {
  49. if (UnlockAheadCur == Current.Free)
  50. {
  51. ItemBtn.interactable = false;
  52. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab4"), UnlockLv.ToString());
  53. }
  54. else
  55. {
  56. ItemBtn.interactable = true;
  57. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab0"), "\n", new LanStr("UI", "Fe_BtnLab4"), UnlockLv.ToString());
  58. }
  59. }
  60. else if (_ItemStatus == SkillStatus.UnLock)
  61. {
  62. ItemBtn.interactable = true;
  63. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab1"));
  64. }
  65. else if (_ItemStatus == SkillStatus.Upgrade)
  66. {
  67. ItemBtn.interactable = true;
  68. ManaText.Add(ItemTit, new LanStr("SkillName", _Name), " ", (Level + 1).ToString());
  69. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab2"));
  70. }
  71. else
  72. {
  73. throw new Exception(_ItemStatus.ToString());
  74. }
  75. }
  76. }
  77. public SkillStatus _ItemStatus;
  78. #endregion
  79. public Ability(XmlAttributeCollection attribute)
  80. {
  81. #region 配置
  82. ID = int.Parse(attribute[0].Value);
  83. Icon = attribute[20].Value;
  84. Anim = attribute[21].Value;
  85. Label = attribute[22].Value;
  86. _Name = "Ability" + ID;
  87. UnlockPos = attribute[12].Value;
  88. UpgradeCD = attribute[18].Value;
  89. UpgradeFml = attribute[15].Value;
  90. UpgradePlus = attribute[16].Value;
  91. UpgradePerson = attribute[17].Value;
  92. ClassID = IntParse(attribute[3].Value);
  93. UnlockLv = IntParse(attribute[7].Value);
  94. UnlockAmt = FloatParse(attribute[11].Value);
  95. UnlockAheadAmt = FloatParse(attribute[9].Value);
  96. SkillTab = SkillClassParse(attribute[2].Value);
  97. UpgradeAmt = UpgradeAmtParse(attribute[14].Value);
  98. UnlockCur = CurrentParse(attribute[10].Value);
  99. UpgradeCur = CurrentParse(attribute[13].Value);
  100. UnlockAheadCur = CurrentParse(attribute[8].Value);
  101. ValueBuffParse(out Person, out PersonBuff, attribute[5].Value);
  102. ValueBuffParse(out SkillCD, out SkillCdBuff, attribute[6].Value);
  103. ValueBuffParse(out CoinPerson, out Plus, attribute[4].Value);
  104. #endregion
  105. ValueBuffParse(out NewPerson, out NewPersonBuff, UpgradePerson);
  106. ValueBuffParse(out NewSkillCD, out NewSkillCdBuff, UpgradeCD);
  107. ValueBuffParse(out NewCoinPerson, out NewPlus, UpgradePlus);
  108. SkillType = SkillType.Ability;
  109. }
  110. public override void Annul()
  111. {
  112. if (_Name == "Ability1")
  113. {
  114. ManaData.Person -= NewPerson;
  115. ManaData.CoinPerson -= NewCoinPerson;
  116. }
  117. else
  118. {
  119. ManaData.SkillPerson -= NewPerson;
  120. ManaData.SkillCoinPerson -= NewCoinPerson;
  121. }
  122. ManaData.SkillPlus -= NewPlus;
  123. ManaData.SkillPersonBuff -= NewPersonBuff;
  124. if (Math.Abs(NewSkillCD) > 0.0005f)
  125. {
  126. for (int i = 0; i < ManaData.SkillList.Count; i++)
  127. {
  128. ManaData.SkillList[i].ReceiveCool(-NewSkillCD, false, false);
  129. }
  130. }
  131. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  132. {
  133. for (int i = 0; i < ManaData.SkillList.Count; i++)
  134. {
  135. ManaData.SkillList[i].ReceiveCool(-NewSkillCdBuff, false, true);
  136. }
  137. }
  138. }
  139. public override void RegistValue(float elapse, List<List<SkillRoot>> ffList, XmlAttributeCollection attribute)
  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. ManaText.Add(ItemTit, new LanStr("SkillName", _Name));
  151. ItemLab.text = Description(0);
  152. ItemBtn.onClick.AddListener(OnClick);
  153. if (_ItemStatus == SkillStatus.Upgrade)
  154. {
  155. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁 等级 : {1}", Name, Level));
  156. for (int i = 0; i < Level; i++)
  157. {
  158. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString());
  159. }
  160. UpgradeValue(ref NewPlus, Plus, UpgradePlus, Level);
  161. UpgradeValue(ref NewSkillCdBuff, UpgradeCD, Level);
  162. UpgradeValue(ref NewPersonBuff, PersonBuff, UpgradePerson, Level);
  163. UpgradeValue(ref NewPerson, Person, UpgradePerson, Level);
  164. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, Level);
  165. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, Level);
  166. UseConti();
  167. }
  168. ItemStatus = ItemStatus;
  169. }
  170. public override void UpdateStatus()
  171. {
  172. if (ManaData.Level >= UnlockLv)
  173. {
  174. if (ItemStatus == SkillStatus.Lock)
  175. {
  176. if (UnlockCur == Current.Free)
  177. {
  178. Unlock();
  179. }
  180. else
  181. {
  182. ItemStatus = SkillStatus.UnLock;
  183. }
  184. }
  185. }
  186. }
  187. protected void Unlock()
  188. {
  189. if (ManaData.Pay(UnlockAmt, UnlockCur))
  190. {
  191. ManaData.ElfLevel++;
  192. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
  193. UseConti();
  194. if (UpgradeCur != Current.Free)
  195. {
  196. ItemStatus = SkillStatus.Upgrade;
  197. }
  198. else
  199. {
  200. throw new Exception();
  201. }
  202. }
  203. }
  204. protected void OnClick()
  205. {
  206. if (Initializer.Tutorial)
  207. {
  208. TutorialClick();
  209. }
  210. else
  211. {
  212. RegularClick();
  213. }
  214. }
  215. protected void Upgrade()
  216. {
  217. if (Initializer.Tutorial)
  218. {
  219. TutorialUpgrade();
  220. }
  221. else
  222. {
  223. RegularUpgrade();
  224. }
  225. }
  226. protected void UseConti()
  227. {
  228. if (ValidAnim == false)
  229. {
  230. ValidAnim = true;
  231. if (!string.IsNullOrEmpty(Anim))
  232. {
  233. string[] strings = Anim.Split(',');
  234. if (strings.Length == 1)
  235. {
  236. ManaGarden.AnimList.Add((ObjType) Enum.Parse(typeof(ObjType), strings[0]));
  237. }
  238. else if (strings.Length > 1)
  239. {
  240. ManaReso.Get(strings[0], Folder.Character, false, ManaReso.Get(strings[1]), false);
  241. }
  242. }
  243. }
  244. if (ValidSlot == false)
  245. {
  246. ValidSlot = true;
  247. if (!string.IsNullOrEmpty(UnlockPos))
  248. {
  249. for (int i = 0; i < int.Parse(UnlockPos); i++)
  250. {
  251. ManaGarden.UnlockSlot();
  252. }
  253. }
  254. }
  255. ManaData.Person += NewPerson;
  256. ManaData.CoinPerson += NewCoinPerson;
  257. ManaData.SkillPlus += NewPlus;
  258. ManaData.SkillPersonBuff += NewPersonBuff;
  259. if (Math.Abs(NewSkillCD) > 0.0005f)
  260. {
  261. for (int i = 0; i < ManaData.SkillList.Count; i++)
  262. {
  263. ManaData.SkillList[i].ReceiveCool(NewSkillCD, false, false);
  264. }
  265. }
  266. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  267. {
  268. for (int i = 0; i < ManaData.SkillList.Count; i++)
  269. {
  270. ManaData.SkillList[i].ReceiveCool(NewSkillCdBuff, false, true);
  271. }
  272. }
  273. #region 调试输出
  274. StringBuilder strb = new StringBuilder();
  275. strb.AppendFormat("使用技能 : <color=red>{0}</color>", Name);
  276. if (Math.Abs(NewPlus) > 0.0005f)
  277. {
  278. strb.AppendFormat(" 收入加成<color=red>+{0}%</color>", NewPlus * 100);
  279. }
  280. if (Math.Abs(NewPerson) > 0.0005f)
  281. {
  282. strb.AppendFormat(" 参观人次<color=red>+{0}</color>", NewPerson);
  283. }
  284. if (Math.Abs(NewPersonBuff) > 0.0005f)
  285. {
  286. strb.AppendFormat(" 参观人次<color=red>+{0}%</color>", NewPersonBuff * 100);
  287. }
  288. if (Math.Abs(NewCoinPerson) > 0.0005f)
  289. {
  290. strb.AppendFormat(" 每次金币<color=red>+{0}</color>", NewCoinPerson);
  291. }
  292. if (Math.Abs(SkillCD) > 0.0005f)
  293. {
  294. strb.AppendFormat(" 减少冷却上限<color=red>{0}</color>", SkillCD);
  295. }
  296. if (Math.Abs(SkillCdBuff) > 0.0005f)
  297. {
  298. strb.AppendFormat(" 减少冷却上限<color=red>{0}%</color>", SkillCdBuff * 100);
  299. }
  300. if (!string.IsNullOrEmpty(UnlockPos))
  301. {
  302. int amt = int.Parse(UnlockPos);
  303. strb.AppendFormat(" 解锁了<color=red>{0}</color>块土地", amt);
  304. }
  305. strb.Append(" <color=red>永久有效</color>");
  306. ManaDebug.Log(strb.ToString());
  307. #endregion
  308. }
  309. protected void UnlockAhead()
  310. {
  311. if (ItemStatus != SkillStatus.Lock)
  312. {
  313. ManaDebug.Log("您并不需要提前解锁");
  314. return;
  315. }
  316. if (ManaData.Pay(UnlockAheadAmt, UnlockAheadCur))
  317. {
  318. ManaData.ElfLevel++;
  319. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
  320. UseConti();
  321. if (UpgradeCur != Current.Free)
  322. {
  323. ItemStatus = SkillStatus.Upgrade;
  324. }
  325. else
  326. {
  327. throw new Exception();
  328. }
  329. }
  330. }
  331. private void TutorialClick()
  332. {
  333. ManaReso.Get("Fe_Info").TweenForCG();
  334. ManaReso.SetText("Fe_Tit", Name);
  335. ManaReso.SetSprite("Fe_Icon", ItemIcon.sprite);
  336. if (ItemStatus == SkillStatus.Lock)
  337. {
  338. ManaReso.SetText("Fe_Lab0", "");
  339. ManaReso.SetText("Fe_Lab1", Description(0));
  340. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab0"), ImageParse(UnlockAheadCur), UnlockAheadAmt));
  341. ManaReso.SetButtonEvent
  342. (
  343. "Fe_Btn",
  344. () =>
  345. {
  346. UnlockAhead();
  347. ManaReso.Get("Fe_Info").TweenBacCG();
  348. }
  349. );
  350. }
  351. else if (ItemStatus == SkillStatus.UnLock)
  352. {
  353. ManaReso.SetText("Fe_Lab0", "");
  354. ManaReso.SetText("Fe_Lab1", Description(0));
  355. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab1"), ImageParse(UnlockCur), UnlockAmt));
  356. ManaReso.SetButtonEvent
  357. (
  358. "Fe_Btn",
  359. () =>
  360. {
  361. Unlock();
  362. ManaReso.Get("Fe_Info").TweenBacCG();
  363. }
  364. );
  365. }
  366. else if (ItemStatus == SkillStatus.Upgrade)
  367. {
  368. Tutorial.HightDisable(0, true);
  369. ManaReso.SetText("Fe_Lab0", Description(0));
  370. ManaReso.SetText("Fe_Lab1", Description(1));
  371. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), ImageParse(UpgradeCur), NewUpgradeAmt));
  372. ManaReso.SetButtonEvent
  373. (
  374. "Fe_Btn",
  375. () =>
  376. {
  377. Upgrade();
  378. ManaTutorial.EndStep7();
  379. ManaTutorial.PrepareStep8();
  380. }
  381. );
  382. }
  383. else
  384. {
  385. throw new Exception();
  386. }
  387. }
  388. private void RegularClick()
  389. {
  390. if (ManaData.Connect == false)
  391. {
  392. ManaReso.Get("Fg_Reconnect").TweenForCG();
  393. return;
  394. }
  395. ManaReso.Get("Fe_Info").TweenForCG();
  396. ManaReso.SetText("Fe_Tit", Name);
  397. ManaReso.SetSprite("Fe_Icon", ItemIcon.sprite);
  398. if (ItemStatus == SkillStatus.Lock)
  399. {
  400. ManaReso.SetText("Fe_Lab0", "");
  401. ManaReso.SetText("Fe_Lab1", Description(0));
  402. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab0"), ImageParse(UnlockAheadCur), UnlockAheadAmt));
  403. ManaReso.SetButtonEvent
  404. (
  405. "Fe_Btn",
  406. () =>
  407. {
  408. UnlockAhead();
  409. ManaReso.Get("Fe_Info").TweenBacCG();
  410. }
  411. );
  412. }
  413. else if (ItemStatus == SkillStatus.UnLock)
  414. {
  415. ManaReso.SetText("Fe_Lab0", "");
  416. ManaReso.SetText("Fe_Lab1", Description(0));
  417. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab1"), ImageParse(UnlockCur), UnlockAmt));
  418. ManaReso.SetButtonEvent
  419. (
  420. "Fe_Btn",
  421. () =>
  422. {
  423. Unlock();
  424. ManaReso.Get("Fe_Info").TweenBacCG();
  425. }
  426. );
  427. }
  428. else if (ItemStatus == SkillStatus.Upgrade)
  429. {
  430. ManaReso.SetText("Fe_Lab0", Description(0));
  431. ManaReso.SetText("Fe_Lab1", Description(1));
  432. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), ImageParse(UpgradeCur), NewUpgradeAmt));
  433. ManaReso.SetButtonEvent
  434. (
  435. "Fe_Btn",
  436. () =>
  437. {
  438. Upgrade();
  439. }
  440. );
  441. }
  442. else
  443. {
  444. throw new Exception();
  445. }
  446. }
  447. private void TutorialUpgrade()
  448. {
  449. if (_Name == "Ability1")
  450. {
  451. Level += 20;
  452. ManaData.Level += 20;
  453. }
  454. else
  455. {
  456. Level++;
  457. }
  458. ManaData.ElfLevel++;
  459. Annul();
  460. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString());
  461. UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
  462. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
  463. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, 1);
  464. UpgradeValue(ref NewPlus, Plus, UpgradePlus, 1);
  465. UpgradeValue(ref NewSkillCdBuff, UpgradeCD, 1);
  466. UpgradeValue(ref NewPersonBuff, PersonBuff, UpgradePerson, 1);
  467. ManaText.Add(ItemTit, new LanStr("SkillName", _Name), " ", (Level + 1).ToString());
  468. ItemLab.text = Description(0);
  469. ManaReso.SetText("Fe_Lab0", Description(0));
  470. ManaReso.SetText("Fe_Lab1", Description(1));
  471. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), ImageParse(UpgradeCur), NewUpgradeAmt));
  472. ManaDebug.Log(string.Format("<color=red>{0}</color> 升级 : {1}", Name, Level));
  473. UseConti();
  474. }
  475. private void RegularUpgrade()
  476. {
  477. if (ManaData.Pay(NewUpgradeAmt, UpgradeCur))
  478. {
  479. if (_Name == "Ability1")
  480. {
  481. ManaData.Level++;
  482. }
  483. Level++;
  484. ManaData.ElfLevel++;
  485. Annul();
  486. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString());
  487. UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
  488. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
  489. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, 1);
  490. UpgradeValue(ref NewPlus, Plus, UpgradePlus, 1);
  491. UpgradeValue(ref NewSkillCdBuff, UpgradeCD, 1);
  492. UpgradeValue(ref NewPersonBuff, PersonBuff, UpgradePerson, 1);
  493. ManaText.Add(ItemTit, new LanStr("SkillName", _Name), " ", (Level + 1).ToString());
  494. ItemLab.text = Description(0);
  495. ManaReso.SetText("Fe_Lab0", Description(0));
  496. ManaReso.SetText("Fe_Lab1", Description(1));
  497. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), ImageParse(UpgradeCur), NewUpgradeAmt));
  498. ManaDebug.Log(string.Format("<color=red>{0}</color> 升级 : {1}", Name, Level));
  499. UseConti();
  500. }
  501. }
  502. #region 解读器
  503. protected override string Description(int offset)
  504. {
  505. float temp;
  506. string[] strings = Desc.Split('[', ']');
  507. StringBuilder stringBuilder = new StringBuilder();
  508. for (int i = 0; i < strings.Length; i++)
  509. {
  510. if (strings[i].Contains("lv"))
  511. {
  512. }
  513. else if (strings[i].Contains("&person&"))
  514. {
  515. #region MyRegion
  516. if (Math.Abs(Person) > 0.0005f)
  517. {
  518. temp = NewPerson;
  519. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  520. UpgradeUnit(ref temp, strings[i]);
  521. stringBuilder.Append(temp.ToString("0"));
  522. }
  523. else if (Math.Abs(PersonBuff) > 0.0005f)
  524. {
  525. temp = NewPersonBuff;
  526. UpgradeValue(ref temp, PersonBuff, UpgradePerson, offset);
  527. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  528. }
  529. #endregion
  530. }
  531. else if (strings[i].Contains("&skill_cd&"))
  532. {
  533. #region MyRegion
  534. if (Math.Abs(SkillCD) > 0.0005f)
  535. {
  536. temp = NewSkillCD;
  537. UpgradeValue(ref temp, SkillCD, UpgradeCD, offset);
  538. UpgradeUnit(ref temp, strings[i]);
  539. stringBuilder.Append(temp.ToString("0"));
  540. }
  541. else if (Math.Abs(SkillCdBuff) > 0.0005f)
  542. {
  543. temp = NewSkillCdBuff;
  544. UpgradeValue(ref temp, UpgradeCD, offset);
  545. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  546. }
  547. #endregion
  548. }
  549. else if (strings[i].Contains("&coin_person&"))
  550. {
  551. #region MyRegion
  552. if (Math.Abs(CoinPerson) > 0.0005f)
  553. {
  554. temp = NewCoinPerson;
  555. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  556. UpgradeUnit(ref temp, strings[i]);
  557. stringBuilder.Append(temp.ToString("0.0"));
  558. }
  559. else if (Math.Abs(Plus) > 0.0005f)
  560. {
  561. temp = NewPlus;
  562. UpgradeValue(ref temp, Plus, UpgradePlus, offset);
  563. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  564. }
  565. #endregion
  566. }
  567. else
  568. {
  569. stringBuilder.Append(strings[i]);
  570. }
  571. }
  572. return stringBuilder.ToString();
  573. }
  574. protected double UpgradeAmtParse(string str)
  575. {
  576. if (string.IsNullOrEmpty(str))
  577. {
  578. return UnlockAmt;
  579. }
  580. else
  581. {
  582. return double.Parse(str);
  583. }
  584. }
  585. #endregion
  586. }