Skill.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  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 Label;
  37. protected string Anim;
  38. protected string UpgradeCD;
  39. protected string UpgradeFml;
  40. protected string UpgradePlus;
  41. protected string UpgradePerson;
  42. protected string UpgradeDuration;
  43. protected string UpgradeCoinOnce;
  44. #endregion
  45. public float UseTimer;
  46. public float CoolTimer;
  47. protected float NewPlus;
  48. protected float NewPerson;
  49. protected float NewSkillCD;
  50. protected float NewDuration;
  51. protected float NewCoinOnce;
  52. protected float NewSkillCdBuff;
  53. protected float NewPersonBuff;
  54. protected float NewCoinPerson;
  55. protected float NewCoinOnceBuff;
  56. protected double NewUpgradeAmt;
  57. public SkillStatus ItemStatus
  58. {
  59. get { return _ItemStatus; }
  60. set
  61. {
  62. _ItemStatus = value;
  63. if (SkillTab == SkillTab.Null)
  64. {
  65. return;
  66. }
  67. if (_ItemStatus == SkillStatus.Cool)
  68. {
  69. ManaData.CoolList.Add(this);
  70. }
  71. else if (_ItemStatus == SkillStatus.Buy)
  72. {
  73. ManaText.Add(ItemBtnLab, ImageParse(BuyCur), UseAmt.ToString("0"), "\n", new LanStr("UI", "Fe_BtnLab3"));
  74. }
  75. else if (_ItemStatus == SkillStatus.Use)
  76. {
  77. }
  78. else if (_ItemStatus == SkillStatus.Lock)
  79. {
  80. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab0"), "\n", new LanStr("UI", "Fe_BtnLab4"), UnlockLv.ToString());
  81. }
  82. else if (_ItemStatus == SkillStatus.UnLock)
  83. {
  84. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab1"));
  85. }
  86. else if (_ItemStatus == SkillStatus.Upgrade)
  87. {
  88. ManaText.Add(ItemBtnLab, new LanStr("UI", "Fe_BtnLab2"));
  89. }
  90. else
  91. {
  92. throw new Exception();
  93. }
  94. }
  95. }
  96. public SkillStatus _ItemStatus;
  97. #endregion
  98. public Skill(XmlAttributeCollection attributes)
  99. {
  100. #region 配置
  101. ID = int.Parse(attributes[0].Value);
  102. Icon = attributes[30].Value;
  103. Anim = attributes[31].Value;
  104. Label = attributes[32].Value;
  105. _Name ="Skill" +ID;
  106. UnlockPos = attributes[18].Value;
  107. UpgradeCD = attributes[28].Value;
  108. UpgradeFml = attributes[23].Value;
  109. UpgradePlus = attributes[24].Value;
  110. UpgradePerson = attributes[25].Value;
  111. UpgradeDuration = attributes[27].Value;
  112. UpgradeCoinOnce = attributes[26].Value;
  113. ClassID = IntParse(attributes[3].Value);
  114. UnlockLv = IntParse(attributes[13].Value);
  115. CD = FloatParse(attributes[12].Value);
  116. UseAmt = FloatParse(attributes[20].Value);
  117. Duration = FloatParse(attributes[11].Value);
  118. UnlockAmt = FloatParse(attributes[17].Value);
  119. DiamondOnce = FloatParse(attributes[9].Value);
  120. UnlockAheadAmt = FloatParse(attributes[15].Value);
  121. SkillTab = SkillClassParse(attributes[2].Value);
  122. ReduceCD = BoolParse(attributes[5].Value);
  123. UpgradeAmt = UpgradeAmtParse(attributes[22].Value);
  124. BuyCur = CurrentParse(attributes[19].Value);
  125. UnlockCur = CurrentParse(attributes[16].Value);
  126. UpgradeCur = CurrentParse(attributes[21].Value);
  127. UnlockAheadCur = CurrentParse(attributes[14].Value);
  128. ValueBuffParse(out Person, out PersonBuff, attributes[7].Value);
  129. ValueBuffParse(out SkillCD, out SkillCdBuff, attributes[10].Value);
  130. ValueBuffParse(out CoinOnce, out CoinOnceBuff, attributes[8].Value);
  131. ValueBuffParse(out CoinPerson, out Plus, attributes[6].Value);
  132. #endregion
  133. SkillType = SkillType.Skill;
  134. }
  135. public virtual bool DoCool()
  136. {
  137. CoolTimer -= Time.deltaTime;
  138. TimeSpan timeSpan = new TimeSpan(0, 0, (int)CoolTimer);
  139. ItemBtnLab.text = string.Format("{0}\n{1}({2}:{3})", Language.GetStr("UI", "Fe_BtnLab6"), Language.GetStr("UI", "Fe_BtnLab7"), timeSpan.Minutes, timeSpan.Seconds);
  140. if (CoolTimer <= 0)
  141. {
  142. ItemStatus = SkillStatus.Buy;
  143. ManaData.CoolList.Remove(this);
  144. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已冷却", Name));
  145. return true;
  146. }
  147. else
  148. {
  149. return false;
  150. }
  151. }
  152. public override void Annul()
  153. {
  154. CoolTimer = CD * (1 + CdBuff);
  155. ItemStatus = SkillStatus.Cool;
  156. ItemBtnLab.color = Color.white;
  157. ManaData.SkillPlus -= NewPlus;
  158. ManaData.SkillPerson -= NewPerson;
  159. ManaData.SkillPersonBuff -= NewPersonBuff;
  160. ManaData.SkillCoinPerson -= NewCoinPerson;
  161. if (Math.Abs(NewSkillCD) > 0.0005f)
  162. {
  163. for (int i = 0; i < ManaData.SkillList.Count; i++)
  164. {
  165. ManaData.SkillList[i].ReceiveCool(-NewSkillCD, true, false);
  166. }
  167. }
  168. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  169. {
  170. for (int i = 0; i < ManaData.SkillList.Count; i++)
  171. {
  172. ManaData.SkillList[i].ReceiveCool(-NewSkillCdBuff, true, true);
  173. }
  174. }
  175. ManaDebug.Log(string.Format("技能结束 <color=red>{0}</color>", Name));
  176. }
  177. public override bool DoUse()
  178. {
  179. UseTimer -= Time.deltaTime;
  180. ItemLab.text = UseTimer.ToString("0.0");
  181. if (UseTimer <= 0)
  182. {
  183. Annul();
  184. ManaData.UseList.Remove(this);
  185. return true;
  186. }
  187. else
  188. {
  189. return false;
  190. }
  191. }
  192. public override void UpdateStatus()
  193. {
  194. if (ManaData.Level >= UnlockLv)
  195. {
  196. if (ItemStatus == SkillStatus.Lock)
  197. {
  198. if (UnlockCur == Current.Free)
  199. {
  200. Unlock();
  201. }
  202. else
  203. {
  204. ItemStatus = SkillStatus.UnLock;
  205. }
  206. }
  207. }
  208. }
  209. public override void RegistValue(float elapse, List<List<SkillRoot>> ffList)
  210. {
  211. NewPlus = Plus;
  212. NewPerson = Person;
  213. NewSkillCD = SkillCD;
  214. NewDuration = Duration;
  215. NewCoinOnce = CoinOnce;
  216. NewSkillCdBuff = SkillCdBuff;
  217. NewPersonBuff = PersonBuff;
  218. NewCoinPerson = CoinPerson;
  219. NewUpgradeAmt = UpgradeAmt;
  220. NewCoinOnceBuff = CoinOnceBuff;
  221. ManaText.Add(ItemTit, new LanStr("SkillName", _Name));
  222. ItemLab.text = Description(0);
  223. ItemBtn.onClick.AddListener(OnClick);
  224. if (_ItemStatus != SkillStatus.Lock && _ItemStatus != SkillStatus.UnLock)
  225. {
  226. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
  227. }
  228. else if (_ItemStatus == SkillStatus.Use)
  229. {
  230. UseConti();
  231. if (UseTimer < elapse)
  232. {
  233. if (ffList.Count > 0)
  234. {
  235. if (UseTimer < ManaData.CircleTimer)
  236. {
  237. ffList[0].UniqueAdd(this);
  238. }
  239. else
  240. {
  241. int ffCircle = 1 + Mathf.FloorToInt((float)(UseTimer - ManaData.CircleTimer / ManaData.CircleTime));
  242. ffList[ffCircle].UniqueAdd(this);
  243. }
  244. }
  245. }
  246. else
  247. {
  248. UseTimer -= elapse;
  249. ItemBtnLab.color = Color.blue;
  250. }
  251. }
  252. else if (_ItemStatus == SkillStatus.Cool)
  253. {
  254. CoolTimer -= elapse;
  255. }
  256. ItemStatus = ItemStatus;
  257. }
  258. public override void ReceiveCool(float amt, bool current, bool buff)
  259. {
  260. if (!ReduceCD)
  261. {
  262. return;
  263. }
  264. if (current)
  265. {
  266. if (ItemStatus != SkillStatus.Cool)
  267. {
  268. return;
  269. }
  270. if (buff)
  271. {
  272. CoolTimer -= CD * amt;
  273. }
  274. else
  275. {
  276. CoolTimer -= amt;
  277. }
  278. }
  279. else
  280. {
  281. if (buff)
  282. {
  283. CdBuff -= amt;
  284. }
  285. else
  286. {
  287. CD -= amt;
  288. }
  289. }
  290. }
  291. protected void OnClick()
  292. {
  293. if (ManaData.Connect == false)
  294. {
  295. ManaReso.Get("Fg_Reconnect").TweenForCG();
  296. return;
  297. }
  298. ManaReso.Get("Fe_Info").TweenForCG();
  299. ManaReso.SetText("Fe_Tit", Name);
  300. if (ItemStatus == SkillStatus.Buy)
  301. {
  302. ManaReso.SetText("Fe_Lab1", Description(0));
  303. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab3"), ImageParse(BuyCur), UseAmt));
  304. ManaReso.SetButtonEvent
  305. (
  306. "Fe_Btn",
  307. () =>
  308. {
  309. Buy();
  310. ManaReso.Get("Fe_Info").TweenBacCG();
  311. }
  312. );
  313. }
  314. else if (ItemStatus == SkillStatus.Lock)
  315. {
  316. ManaReso.SetText("Fe_Lab0", "");
  317. ManaReso.SetText("Fe_Lab1", Description(0));
  318. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab0"), ImageParse(UnlockAheadCur), UnlockAheadAmt));
  319. ManaReso.SetButtonEvent
  320. (
  321. "Fe_Btn",
  322. () =>
  323. {
  324. UnlockAhead();
  325. ManaReso.Get("Fe_Info").TweenBacCG();
  326. }
  327. );
  328. }
  329. else if (ItemStatus == SkillStatus.UnLock)
  330. {
  331. ManaReso.SetText("Fe_Lab0", "");
  332. ManaReso.SetText("Fe_Lab1", Description(0));
  333. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab1"), ImageParse(UnlockCur), UnlockAmt));
  334. ManaReso.SetButtonEvent
  335. (
  336. "Fe_Btn",
  337. () =>
  338. {
  339. Unlock();
  340. ManaReso.Get("Fe_Info").TweenBacCG();
  341. }
  342. );
  343. }
  344. else if (ItemStatus == SkillStatus.Upgrade)
  345. {
  346. ManaReso.SetText("Fe_Lab0", Description(0));
  347. ManaReso.SetText("Fe_Lab1", Description(1));
  348. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), ImageParse(UpgradeCur), NewUpgradeAmt));
  349. ManaReso.SetButtonEvent
  350. (
  351. "Fe_Btn",
  352. () =>
  353. {
  354. Upgrade();
  355. }
  356. );
  357. }
  358. else if (ItemStatus == SkillStatus.Use)
  359. {
  360. }
  361. else
  362. {
  363. throw new Exception();
  364. }
  365. }
  366. protected void UseConti()
  367. {
  368. ManaData.SkillPlus += NewPlus;
  369. ManaData.SkillPerson += NewPerson;
  370. ManaData.SkillPersonBuff += NewPersonBuff;
  371. ManaData.SkillCoinPerson += NewCoinPerson;
  372. if (Math.Abs(NewSkillCD) > 0.0005f)
  373. {
  374. for (int i = 0; i < ManaData.SkillList.Count; i++)
  375. {
  376. ManaData.SkillList[i].ReceiveCool(NewSkillCD, true, false);
  377. }
  378. }
  379. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  380. {
  381. for (int i = 0; i < ManaData.SkillList.Count; i++)
  382. {
  383. ManaData.SkillList[i].ReceiveCool(NewSkillCdBuff, true, true);
  384. }
  385. }
  386. }
  387. protected void UseImmed()
  388. {
  389. ManaData.Coin += NewCoinOnce;
  390. ManaData.Coin += ManaData.CoinPerson * NewCoinOnceBuff;
  391. ManaData.Diamond += DiamondOnce;
  392. }
  393. protected virtual void Buy()
  394. {
  395. if (ManaData.Pay(UseAmt, BuyCur))
  396. {
  397. ManaData.Skill++;
  398. UseTimer = NewDuration;
  399. ManaData.UseList.Add(this);
  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 override 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. }