Skill.cs 21 KB

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