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 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. }
  79. else if (_ItemStatus == SkillStatus.Lock)
  80. {
  81. ItemBtnLab.text = string.Format("{0}\n{1}{2}", Language.GetStr("UI", "Fe_BtnLab0"), Language.GetStr("UI", "Fe_BtnLab4"), UnlockLv);
  82. }
  83. else if (_ItemStatus == SkillStatus.UnLock)
  84. {
  85. ItemBtnLab.text = string.Format(Language.GetStr("UI", "Fe_BtnLab1"));
  86. }
  87. else if (_ItemStatus == SkillStatus.Upgrade)
  88. {
  89. ItemBtnLab.text = string.Format(Language.GetStr("UI", "Fe_BtnLab2"));
  90. }
  91. else
  92. {
  93. throw new Exception();
  94. }
  95. }
  96. }
  97. public SkillStatus _ItemStatus;
  98. #endregion
  99. public Skill(XmlAttributeCollection attributes)
  100. {
  101. #region 配置
  102. ID = int.Parse(attributes[0].Value);
  103. Icon = attributes[30].Value;
  104. Desc = Language.GetStr("SkillDescription", "Skill" + ID);
  105. Anim = attributes[31].Value;
  106. Label = attributes[32].Value;
  107. Name = Language.GetStr("SkillName", "Skill" +ID);
  108. UnlockPos = attributes[18].Value;
  109. UpgradeCD = attributes[28].Value;
  110. UpgradeFml = attributes[23].Value;
  111. UpgradePlus = attributes[24].Value;
  112. UpgradePerson = attributes[25].Value;
  113. UpgradeDuration = attributes[27].Value;
  114. UpgradeCoinOnce = attributes[26].Value;
  115. ClassID = IntParse(attributes[3].Value);
  116. UnlockLv = IntParse(attributes[13].Value);
  117. CD = FloatParse(attributes[12].Value);
  118. UseAmt = FloatParse(attributes[20].Value);
  119. Duration = FloatParse(attributes[11].Value);
  120. UnlockAmt = FloatParse(attributes[17].Value);
  121. DiamondOnce = FloatParse(attributes[9].Value);
  122. UnlockAheadAmt = FloatParse(attributes[15].Value);
  123. SkillTab = SkillClassParse(attributes[2].Value);
  124. ReduceCD = BoolParse(attributes[5].Value);
  125. UpgradeAmt = UpgradeAmtParse(attributes[22].Value);
  126. BuyCur = CurrentParse(attributes[19].Value);
  127. UnlockCur = CurrentParse(attributes[16].Value);
  128. UpgradeCur = CurrentParse(attributes[21].Value);
  129. UnlockAheadCur = CurrentParse(attributes[14].Value);
  130. ValueBuffParse(out Person, out PersonBuff, attributes[7].Value);
  131. ValueBuffParse(out SkillCD, out SkillCdBuff, attributes[10].Value);
  132. ValueBuffParse(out CoinOnce, out CoinOnceBuff, attributes[8].Value);
  133. ValueBuffParse(out CoinPerson, out Plus, attributes[6].Value);
  134. #endregion
  135. SkillType = SkillType.Skill;
  136. }
  137. public virtual bool DoCool()
  138. {
  139. CoolTimer -= Time.deltaTime;
  140. TimeSpan timeSpan = new TimeSpan(0, 0, (int)CoolTimer);
  141. ItemBtnLab.text = string.Format("{0}\n{1}({2}:{3})", Language.GetStr("UI", "Fe_BtnLab6"), Language.GetStr("UI", "Fe_BtnLab7"), timeSpan.Minutes, timeSpan.Seconds);
  142. if (CoolTimer <= 0)
  143. {
  144. ItemStatus = SkillStatus.Buy;
  145. ManaData.CoolList.Remove(this);
  146. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已冷却", Name));
  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. ManaData.UseList.Add(this);
  401. if (Math.Abs(Duration) < 0.0005f)
  402. {
  403. ItemStatus = SkillStatus.Cool;
  404. }
  405. else
  406. {
  407. ItemStatus = SkillStatus.Use;
  408. ItemBtnLab.color = Color.blue;
  409. }
  410. UseConti();
  411. UseImmed();
  412. #region 调试
  413. StringBuilder strb = new StringBuilder();
  414. strb.AppendFormat("使用技能 : <color=red>{0}</color>", Name);
  415. if (Math.Abs(NewPlus) > 0.0005f)
  416. {
  417. strb.AppendFormat(" 收入加成<color=red>+{0}%</color>", NewPlus * 100);
  418. }
  419. if (Math.Abs(NewPerson) > 0.0005f)
  420. {
  421. strb.AppendFormat(" 参观人次<color=red>+{0}</color>", NewPerson);
  422. }
  423. if (Math.Abs(NewPersonBuff) > 0.0005f)
  424. {
  425. strb.AppendFormat(" 参观人次<color=red>+{0}%</color>", NewPersonBuff * 100);
  426. }
  427. if (Math.Abs(NewCoinPerson) > 0.0005f)
  428. {
  429. strb.AppendFormat(" 每次金币<color=red>+{0}</color>", NewCoinPerson);
  430. }
  431. if (Math.Abs(NewSkillCD) > 0.0005f)
  432. {
  433. strb.AppendFormat(" 减少冷却<color=red>{0}</color>", NewSkillCD);
  434. }
  435. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  436. {
  437. strb.AppendFormat(" 减少冷却<color=red>{0}%</color>", NewSkillCdBuff * 100);
  438. }
  439. if (Math.Abs(NewCoinOnce) > 0.0005f)
  440. {
  441. strb.AppendFormat(" 获得金币<color=red>{0}</color>", NewCoinOnce);
  442. }
  443. if (Math.Abs(NewCoinOnceBuff) > 0.0005f)
  444. {
  445. strb.AppendFormat(" 获得金币<color=red>{0}</color>", ManaData.Person * ManaData.CoinPerson * ManaData.CircleTime * NewCoinOnceBuff);
  446. }
  447. if (Math.Abs(DiamondOnce) > 0.0005f)
  448. {
  449. strb.AppendFormat(" 获得钻石<color=red>{0}</color>", DiamondOnce);
  450. }
  451. if (Math.Abs(NewDuration) > 0.0005f)
  452. {
  453. strb.AppendFormat(" 持续时间<color=red>{0}</color>秒", NewDuration);
  454. }
  455. else
  456. {
  457. strb.Append(" <color=red>永久有效</color>");
  458. }
  459. ManaDebug.Log(strb.ToString());
  460. #endregion
  461. }
  462. }
  463. protected virtual void Unlock()
  464. {
  465. if (ManaData.Pay(UnlockAmt, UnlockCur))
  466. {
  467. if (BuyCur != Current.Free)
  468. {
  469. ItemStatus = SkillStatus.Buy;
  470. }
  471. else if (UpgradeCur != Current.Free)
  472. {
  473. ItemStatus = SkillStatus.Upgrade;
  474. }
  475. else
  476. {
  477. throw new Exception();
  478. }
  479. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
  480. }
  481. }
  482. protected virtual void Upgrade()
  483. {
  484. if (ManaData.Pay(NewUpgradeAmt, UpgradeCur))
  485. {
  486. Level++;
  487. if (ItemStatus == SkillStatus.Use)
  488. {
  489. Annul();
  490. }
  491. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString());
  492. UpgradeValue(ref NewPlus, Plus, UpgradePlus, 1);
  493. UpgradeValue(ref NewSkillCdBuff, UpgradeCD, 1);
  494. UpgradeValue(ref NewPersonBuff, PersonBuff, UpgradePerson, 1);
  495. UpgradeValue(ref NewCoinOnceBuff, UpgradeCoinOnce, 1);
  496. UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
  497. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
  498. UpgradeValue(ref NewDuration, Duration, UpgradeDuration, 1);
  499. UpgradeValue(ref NewCoinOnce, CoinOnce, UpgradeCoinOnce, 1);
  500. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, 1);
  501. ItemLab.text = Description(0);
  502. ManaReso.SetText("Fe_Lab0", Description(0));
  503. ManaReso.SetText("Fe_Lab1", Description(1));
  504. ManaReso.SetText("Fe_BtnLab", string.Format("{0}({1}{2:0})", Language.GetStr("UI", "Fe_BtnLab2"), UpgradeCur, NewUpgradeAmt));
  505. ManaDebug.Log(string.Format("<color=red>{0}</color>升级 : {1}", Name, Level));
  506. if (ItemStatus == SkillStatus.Use)
  507. {
  508. UseConti();
  509. }
  510. }
  511. }
  512. protected virtual void UnlockAhead()
  513. {
  514. if (ItemStatus != SkillStatus.Lock)
  515. {
  516. ManaDebug.Log("您并不需要提前解锁");
  517. return;
  518. }
  519. if (ManaData.Pay(UnlockAheadAmt, UnlockAheadCur))
  520. {
  521. if (BuyCur != Current.Free)
  522. {
  523. ItemStatus = SkillStatus.Buy;
  524. }
  525. else if (UpgradeCur != Current.Free)
  526. {
  527. ItemStatus = SkillStatus.Upgrade;
  528. }
  529. else
  530. {
  531. throw new Exception();
  532. }
  533. ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
  534. }
  535. }
  536. #region 解读器
  537. protected string Description(int offset)
  538. {
  539. float temp;
  540. string[] strings = Desc.Split('[', ']');
  541. StringBuilder stringBuilder = new StringBuilder();
  542. for (int i = 0; i < strings.Length; i++)
  543. {
  544. if (strings[i].Contains("lv"))
  545. {
  546. }
  547. else if (strings[i].Contains("&person&"))
  548. {
  549. #region MyRegion
  550. if (Math.Abs(Person) > 0.0005f)
  551. {
  552. temp = NewPerson;
  553. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  554. UpgradeUnit(ref temp, strings[i]);
  555. stringBuilder.Append(temp.ToString("0"));
  556. }
  557. else if (Math.Abs(PersonBuff) > 0.0005f)
  558. {
  559. temp = NewPersonBuff;
  560. UpgradeValue(ref temp, PersonBuff, UpgradePerson, offset);
  561. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  562. }
  563. #endregion
  564. }
  565. else if (strings[i].Contains("&duration&"))
  566. {
  567. #region MyRegion
  568. temp = NewDuration;
  569. UpgradeValue(ref temp, Duration, UpgradeDuration, offset);
  570. UpgradeUnit(ref temp, strings[i]);
  571. stringBuilder.Append(temp.ToString("0"));
  572. #endregion
  573. }
  574. else if (strings[i].Contains("&coin_once&"))
  575. {
  576. #region MyRegion
  577. if (Math.Abs(CoinOnce) > 0.0005f)
  578. {
  579. temp = NewCoinOnce;
  580. UpgradeValue(ref temp, CoinOnce, UpgradeCoinOnce, offset);
  581. stringBuilder.Append(temp.ToString("0"));
  582. }
  583. else if (Math.Abs(CoinOnceBuff) > 0.0005f)
  584. {
  585. temp = NewCoinOnceBuff;
  586. UpgradeValue(ref temp, CoinOnceBuff, UpgradeCoinOnce, offset);
  587. stringBuilder.Append(temp.ToString("0"));
  588. }
  589. #endregion
  590. }
  591. else if (strings[i].Contains("&diamond_once&"))
  592. {
  593. #region MyRegion
  594. stringBuilder.Append(DiamondOnce.ToString("0"));
  595. #endregion
  596. }
  597. else if (strings[i].Contains("&coin_person&"))
  598. {
  599. #region MyRegion
  600. if (Math.Abs(CoinPerson) > 0.0005f)
  601. {
  602. temp = NewCoinPerson;
  603. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  604. stringBuilder.Append(temp.ToString("0.0"));
  605. }
  606. else if (Math.Abs(Plus) > 0.0005f)
  607. {
  608. temp = NewPlus;
  609. UpgradeValue(ref temp, Plus, UpgradePlus, offset);
  610. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  611. }
  612. else
  613. {
  614. throw new Exception();
  615. }
  616. #endregion
  617. }
  618. else
  619. {
  620. stringBuilder.Append(strings[i]);
  621. }
  622. }
  623. return stringBuilder.ToString();
  624. }
  625. protected double UpgradeAmtParse(string str)
  626. {
  627. if (string.IsNullOrEmpty(str))
  628. {
  629. return UnlockAmt;
  630. }
  631. else
  632. {
  633. return double.Parse(str);
  634. }
  635. }
  636. #endregion
  637. }