Skill.cs 21 KB

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