Ability.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System;
  4. using System.Xml;
  5. using System.Text;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using Random = UnityEngine.Random;
  9. public class Ability : SkillRoot
  10. {
  11. #region Config
  12. #region 配置
  13. public float UnlockAheadAmt
  14. {
  15. get { return UnlockAheadBaseAmt + (UnlockLv - Manager.GardenLevel - 1)*UnlockAheadDeltaAmt; }
  16. }
  17. public override string FullID
  18. {
  19. get { return AbilityFullIDPrefix + ID; }
  20. }
  21. public static string ElfAnim = "Elf";
  22. public static string ItemAnim = "Item";
  23. public float Person;
  24. public float SkillCD;
  25. public float CoinPerson;
  26. public double UpgradeAmt;
  27. public float Plus;
  28. public float PersonBuff;
  29. public float SkillCdBuff;
  30. public int UnlockLv;
  31. public float UnlockAmt;
  32. public float UnlockAheadBaseAmt;
  33. public float UnlockAheadDeltaAmt;
  34. public string UnlockPos;
  35. public Current UnlockCur;
  36. public Current UpgradeCur;
  37. public Current UnlockAheadCur;
  38. public string Label;
  39. public string Anim;
  40. public string UpgradeCD;
  41. public string UpgradeFml;
  42. public string UpgradePlus;
  43. public string UpgradePerson;
  44. #endregion
  45. public bool ElfFlag = true;
  46. public string Elf;
  47. public string Item;
  48. public float NewPlus;
  49. public float NewPerson;
  50. public float NewSkillCD;
  51. public float NewSkillCdBuff;
  52. public float NewPersonBuff;
  53. public float NewCoinPerson;
  54. public double NewUpgradeAmt;
  55. public override SkillStatus ItemStatus
  56. {
  57. get { return itemStatus; }
  58. set
  59. {
  60. itemStatus = value;
  61. if (itemStatus == SkillStatus.Lock)
  62. {
  63. if (UnlockAheadCur == Current.Free)
  64. {
  65. button.interactable = false;
  66. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab1), "\n", new MulLanStr(LanguageLabel.UI__Fe_BtnLab4), UnlockLv.ToString());
  67. }
  68. else
  69. {
  70. button.interactable = true;
  71. LanguageManager.Add(ButtonTitle, new MulLanStr(LanguageLabel.UI__Fe_BtnLab0), "\n", new MulLanStr(LanguageLabel.UI__Fe_BtnLab4), UnlockLv.ToString());
  72. }
  73. }
  74. else if (itemStatus == SkillStatus.UnLock)
  75. {
  76. button.interactable = true;
  77. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab1) + "\n" + Auxiliary.ImageParse(UnlockCur) + Auxiliary.ShrinkBigNumberStr(UnlockAmt);
  78. }
  79. else if (itemStatus == SkillStatus.Upgrade)
  80. {
  81. button.interactable = true;
  82. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab2) + "\n" + Auxiliary.ImageParse(UpgradeCur) + Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt);
  83. }
  84. }
  85. }
  86. private static int BannedSlotIndexForZoomIn = 4;
  87. #endregion
  88. public Ability(XmlAttributeCollection attribute)
  89. {
  90. #region 配置
  91. ID = int.Parse(attribute[0].Value);
  92. icon = attribute[21].Value;
  93. Anim = attribute[22].Value;
  94. Label = attribute[23].Value;
  95. UnlockPos = attribute[13].Value;
  96. UpgradeCD = attribute[19].Value;
  97. UpgradeFml = attribute[16].Value;
  98. UpgradePlus = attribute[17].Value;
  99. UpgradePerson = attribute[18].Value;
  100. UnlockLv = Auxiliary.StringToInt(attribute[7].Value,0);
  101. ItemIndex = Auxiliary.StringToInt(attribute[3].Value,0);
  102. UnlockAmt = Auxiliary.StringToFloat(attribute[12].Value,0);
  103. UnlockAheadBaseAmt = Auxiliary.StringToFloat(attribute[10].Value,0);
  104. UnlockAheadDeltaAmt = Auxiliary.StringToFloat(attribute[9].Value, 0);
  105. SkillTab = SkillClassParse(attribute[2].Value);
  106. UpgradeAmt = GetUpgradeAmt(attribute[15].Value);
  107. UnlockCur = Auxiliary.CurrentParse(attribute[11].Value);
  108. UpgradeCur = Auxiliary.CurrentParse(attribute[14].Value);
  109. UnlockAheadCur = Auxiliary.CurrentParse(attribute[8].Value);
  110. ValueBuffParse(out Person, out PersonBuff, attribute[5].Value);
  111. ValueBuffParse(out SkillCD, out SkillCdBuff, attribute[6].Value);
  112. ValueBuffParse(out CoinPerson, out Plus, attribute[4].Value);
  113. #endregion
  114. SkillType = SkillType.Ability;
  115. }
  116. public void UnlockTab()
  117. {
  118. ResourceManager.Get<Graphic>(CanvasLabel.F_Elf).material = null;
  119. ResourceManager.Get<Graphic>(CanvasLabel.F_Store).material = null;
  120. ResourceManager.Get<Graphic>(CanvasLabel.F_Magic).material = null;
  121. ResourceManager.Get<Graphic>(CanvasLabel.F_ElfLab).material = null;
  122. ResourceManager.Get<Graphic>(CanvasLabel.F_StoreLab).material = null;
  123. ResourceManager.Get<Graphic>(CanvasLabel.F_MagicLab).material = null;
  124. ResourceManager.Get<Button>(CanvasLabel.F_Elf).interactable = true;
  125. ResourceManager.Get<Button>(CanvasLabel.F_Store).interactable = true;
  126. ResourceManager.Get<Button>(CanvasLabel.F_Magic).interactable = true;
  127. }
  128. public override void Reactive()
  129. {
  130. //if (Level > 0)
  131. //{
  132. // AnnulA();
  133. // AnnulB();
  134. //}
  135. }
  136. public override void Init(bool firstInit, float elapse, List<List<Skill>> useList, XmlAttributeCollection attribute)
  137. {
  138. if (!firstInit)
  139. {
  140. return;
  141. }
  142. Level = int.Parse(attribute[3].Value);
  143. itemStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), attribute[2].Value);
  144. NewPlus = Plus;
  145. NewPerson = Person;
  146. NewSkillCD = SkillCD;
  147. NewSkillCdBuff = SkillCdBuff;
  148. NewPersonBuff = PersonBuff;
  149. NewCoinPerson = CoinPerson;
  150. NewUpgradeAmt = UpgradeAmt;
  151. if (FullID == "Ability1")
  152. {
  153. Manager.GardenLevel = Level;
  154. if (Level > 0)
  155. {
  156. UnlockTab();
  157. }
  158. }
  159. if (itemStatus == SkillStatus.Lock || itemStatus == SkillStatus.UnLock)
  160. {
  161. SkillIcon.material = Lib.GrayMat;
  162. }
  163. else
  164. {
  165. SkillIcon.material = null;
  166. }
  167. if (itemStatus == SkillStatus.Upgrade)
  168. {
  169. for (int i = 0; i < Level - 1; i++)
  170. {
  171. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString("0.00"));
  172. }
  173. UpgradeValue(ref NewPlus, UpgradePlus, Level - 1);
  174. UpgradeValue(ref NewPersonBuff, UpgradePerson, Level - 1);
  175. UpgradeSkillCdBuff(ref NewSkillCdBuff, UpgradeCD, Level - 1);
  176. UpgradeValue(ref NewPerson, Person, UpgradePerson, Level - 1);
  177. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, Level - 1);
  178. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, Level - 1);
  179. GetAward();
  180. GetSlot();
  181. }
  182. else if (itemStatus == SkillStatus.UnLock)
  183. {
  184. UIManager.UpdateManagePanelHint();
  185. }
  186. ItemStatus = ItemStatus;
  187. button.onClick.RemoveAllListeners();
  188. button.onClick.AddListener(OnClick);
  189. DescriptionText.text = GetDescription(0);
  190. }
  191. public override void SwitchLanguage()
  192. {
  193. base.SwitchLanguage();
  194. ItemStatus = ItemStatus;
  195. }
  196. protected void GetAward()
  197. {
  198. if (ElfFlag)
  199. {
  200. ElfFlag = false;
  201. if (!string.IsNullOrEmpty(Anim))
  202. {
  203. if (Anim.Contains(ElfAnim))
  204. {
  205. string[] strings = Anim.Split(',');
  206. for (int i = 1; i < strings.Length; i++)
  207. {
  208. GardenManager.ElfList.Add(strings[i].ToEnum<ElfType>());
  209. }
  210. Elf = strings[1];
  211. }
  212. else if (Anim.Contains(ItemAnim))
  213. {
  214. string[] strings = Anim.Split(',');
  215. for (int i = 1; i < strings.Length; i++)
  216. {
  217. ResourceManager.Get(strings[i]).TweenForSr();
  218. }
  219. Item = strings[1];
  220. }
  221. }
  222. }
  223. Manager.Person += NewPerson;
  224. Manager.CoinPerson += NewCoinPerson;
  225. Manager.SkillCoinPersonBuff += NewPlus;
  226. Manager.SkillPersonBuff += NewPersonBuff;
  227. if (Math.Abs(NewPerson) > 0.001f || Math.Abs(NewPersonBuff) > 0.001f)
  228. {
  229. if (FullID != "Ability1")
  230. {
  231. Manager.ExtraPersonSourceSpritesName.UniqueAdd(icon);
  232. }
  233. }
  234. if (Math.Abs(NewPlus) > 0.001f || Math.Abs(NewCoinPerson) > 0.001f)
  235. {
  236. if (FullID != "Ability1")
  237. {
  238. Manager.ExtraCoinPersonSourceSpritesName.UniqueAdd(icon);
  239. }
  240. }
  241. if (!NewSkillCD.Equal(0))
  242. {
  243. for (int i = 0; i < Manager.SkillList.Count; i++)
  244. {
  245. Manager.SkillList[i].Cool(NewSkillCD, false, false);
  246. }
  247. }
  248. if (!NewSkillCdBuff.Equal(0))
  249. {
  250. for (int i = 0; i < Manager.SkillList.Count; i++)
  251. {
  252. Manager.SkillList[i].Cool(NewSkillCdBuff, false, true);
  253. }
  254. }
  255. }
  256. protected void AddAchieve()
  257. {
  258. if (!string.IsNullOrEmpty(Elf))
  259. {
  260. Manager.AllElfLevel++;
  261. }
  262. }
  263. protected void GetSlot()
  264. {
  265. for (int i = 0; i < Auxiliary.StringToInt(UnlockPos, 0); i++)
  266. {
  267. GardenManager.UnlockSlot();
  268. }
  269. }
  270. protected void Zoom()
  271. {
  272. if (!string.IsNullOrEmpty(Elf))
  273. {
  274. if (GardenManager.PlantSlotList.Count <= Garden.CurrentPage * GardenManager.TotalSlotInOnePage)
  275. {
  276. return;
  277. }
  278. GardenManager.CreateElfTimer = Random.Range(GardenManager.MinCreateElfTime, GardenManager.MaxCreateElfTime);
  279. Slot zoomSlot = GardenManager.PlantSlotList.Random(1, false, false, slot => { return slot.Index >= Garden.CurrentPage* GardenManager.TotalSlotInOnePage; })[0];
  280. if (zoomSlot.Index% GardenManager.TotalSlotInOnePage == BannedSlotIndexForZoomIn)
  281. {
  282. return;
  283. }
  284. Flower flower = zoomSlot.PlantFlower;
  285. flower.GetElf(GardenManager.ElfList.Back(0), 0, 0, 0, 0);
  286. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  287. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  288. TweenRoot tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  289. tween.AddEventOnetime
  290. (
  291. EventType.BackwardFinish,
  292. () =>
  293. {
  294. ResourceManager.Get(ResourceLabel.MainCamera).Zoom2D(1.5f, 3f, 1, flower.ElfList.Back(0), Curve.EaseOutQuad);
  295. }
  296. );
  297. }
  298. else if (!string.IsNullOrEmpty(Item))
  299. {
  300. TweenRoot tween = ResourceManager.Get(Item).GetTweenSr();
  301. Vector3 pos = ResourceManager.Get(Item).position;
  302. pos.z = -2;
  303. tween.AddEventOnetime
  304. (
  305. EventType.ForwardFinish,
  306. () =>
  307. {
  308. ResourceManager.GetFirework(pos);
  309. }
  310. );
  311. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  312. ResourceManager.Get(CanvasLabel.F_Manage).TweenBacGra();
  313. tween = ResourceManager.Get(CanvasLabel.F_Manage0).GetTweenVec();
  314. tween.AddEventOnetime
  315. (
  316. EventType.BackwardFinish,
  317. () =>
  318. {
  319. ResourceManager.Get(ResourceLabel.MainCamera).Zoom2D(3.5f, 3f, 1, ResourceManager.Get(Item), Curve.EaseOutQuad);
  320. }
  321. );
  322. }
  323. }
  324. public void Unlock()
  325. {
  326. Manager.Pay
  327. (
  328. FullID,
  329. UnlockAmt,
  330. UnlockCur,
  331. () =>
  332. {
  333. UnlockSucceed();
  334. Zoom();
  335. if (FullID == "Ability1")
  336. {
  337. Manager.GardenLevel = 1;
  338. UnlockTab();
  339. }
  340. ConfigManager.SaveConfigDocument();
  341. ConfigManager.SaveConfigDocumentToDisk();
  342. },
  343. StaticsManager.ItemID.解锁技能,
  344. StaticsManager.ConsumeModule.Shop
  345. );
  346. }
  347. public void UnlockSucceed()
  348. {
  349. AudioManager.PlayClip(AudioLabel.UseSkill);
  350. SkillIcon.material = null;
  351. ItemStatus = SkillStatus.Upgrade;
  352. if (UnlockCur != Current.Free)
  353. {
  354. UIManager.UpdateManagePanelHint();
  355. }
  356. Level = 1;
  357. GetAward();
  358. AddAchieve();
  359. GetSlot();
  360. }
  361. public void OnClick()
  362. {
  363. AudioManager.PlayClip(AudioLabel.ClickButton);
  364. ResourceManager.Get(CanvasLabel.Fe_Info).TweenForCG();
  365. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  366. ResourceManager.SetSprite(CanvasLabel.Fe_Icon, Icon);
  367. if (ItemStatus == SkillStatus.Lock)
  368. {
  369. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  370. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  371. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab0), Auxiliary.ImageParse(UnlockAheadCur), UnlockAheadAmt.ToString("0")));
  372. ResourceManager.SetButtonEvent
  373. (
  374. CanvasLabel.Fe_Btn,
  375. () =>
  376. {
  377. UnlockAhead();
  378. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  379. }
  380. );
  381. }
  382. else if (ItemStatus == SkillStatus.UnLock)
  383. {
  384. ResourceManager.SetText(CanvasLabel.Fe_Lab0, "");
  385. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(0));
  386. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab1), Auxiliary.ImageParse(UnlockCur), UnlockAmt.ToString("0")));
  387. ResourceManager.SetButtonEvent
  388. (
  389. CanvasLabel.Fe_Btn,
  390. () =>
  391. {
  392. Unlock();
  393. ResourceManager.Get(CanvasLabel.Fe_Info).TweenBacCG();
  394. }
  395. );
  396. }
  397. else if (ItemStatus == SkillStatus.Upgrade)
  398. {
  399. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  400. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  401. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab2), Auxiliary.ImageParse(UpgradeCur), Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt)));
  402. ResourceManager.SetButtonEvent
  403. (
  404. CanvasLabel.Fe_Btn,
  405. () =>
  406. {
  407. Upgrade();
  408. DescriptionText.text = GetDescription(0);
  409. ButtonTitle.text = Language.GetStr(LanguageLabel.UI__Fe_BtnLab2) + "\n" + Auxiliary.ImageParse(UpgradeCur) + Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt);
  410. ResourceManager.SetText(CanvasLabel.Fe_Tit, Name);
  411. ResourceManager.SetText(CanvasLabel.Fe_Lab0, GetDescription(0));
  412. ResourceManager.SetText(CanvasLabel.Fe_Lab1, GetDescription(1));
  413. ResourceManager.SetText(CanvasLabel.Fe_BtnLab, string.Format("{0}({1}{2:0})", Language.GetStr(LanguageLabel.UI__Fe_BtnLab2), Auxiliary.ImageParse(UpgradeCur), Auxiliary.ShrinkBigNumberStr(NewUpgradeAmt)));
  414. }
  415. );
  416. }
  417. }
  418. public void Upgrade()
  419. {
  420. Manager.Pay
  421. (
  422. FullID,
  423. NewUpgradeAmt,
  424. UpgradeCur,
  425. () =>
  426. {
  427. UpgradeSucceed();
  428. ConfigManager.SaveConfigDocument();
  429. ConfigManager.SaveConfigDocumentToDisk();
  430. },
  431. StaticsManager.ItemID.升级技能,
  432. StaticsManager.ConsumeModule.Shop
  433. );
  434. }
  435. public void UpgradeSucceed()
  436. {
  437. AudioManager.PlayClip(AudioLabel.UseSkill);
  438. Level++;
  439. AnnulEffect();
  440. NewUpgradeAmt = Auxiliary.FmlParse(UpgradeFml, "a", NewUpgradeAmt.ToString("0.00"));
  441. UpgradeValue(ref NewPlus, UpgradePlus, 1);
  442. UpgradeValue(ref NewPersonBuff, UpgradePerson, 1);
  443. UpgradeSkillCdBuff(ref NewSkillCdBuff, UpgradeCD, 1);
  444. UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
  445. UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
  446. UpgradeValue(ref NewCoinPerson, CoinPerson, UpgradePlus, 1);
  447. GetAward();
  448. AddAchieve();
  449. if (FullID == "Ability1")
  450. {
  451. Manager.GardenLevel++;
  452. }
  453. }
  454. public void UnlockAhead()
  455. {
  456. Manager.Pay
  457. (
  458. FullID,
  459. UnlockAheadAmt,
  460. UnlockAheadCur,
  461. () =>
  462. {
  463. UnlockAheadSucceed();
  464. ConfigManager.SaveConfigDocument();
  465. ConfigManager.SaveConfigDocumentToDisk();
  466. },
  467. StaticsManager.ItemID.提前解锁技能,
  468. StaticsManager.ConsumeModule.Shop
  469. );
  470. }
  471. public void UnlockAheadSucceed()
  472. {
  473. AudioManager.PlayClip(AudioLabel.UseSkill);
  474. if (UnlockCur == Current.Free)
  475. {
  476. Unlock();
  477. }
  478. else
  479. {
  480. ItemStatus = SkillStatus.UnLock;
  481. UIManager.UpdateManagePanelHint();
  482. }
  483. }
  484. public override void AnnulEffect()
  485. {
  486. Manager.Person -= NewPerson;
  487. Manager.CoinPerson -= NewCoinPerson;
  488. Manager.SkillCoinPersonBuff -= NewPlus;
  489. Manager.SkillPersonBuff -= NewPersonBuff;
  490. Manager.ExtraPersonSourceSpritesName.Remove(icon);
  491. Manager.ExtraCoinPersonSourceSpritesName.Remove(icon);
  492. if (Math.Abs(NewSkillCD) > 0.0005f)
  493. {
  494. for (int i = 0; i < Manager.SkillList.Count; i++)
  495. {
  496. Manager.SkillList[i].Cool(-NewSkillCD, false, false);
  497. }
  498. }
  499. if (Math.Abs(NewSkillCdBuff) > 0.0005f)
  500. {
  501. for (int i = 0; i < Manager.SkillList.Count; i++)
  502. {
  503. Manager.SkillList[i].Cool(-NewSkillCdBuff, false, true);
  504. }
  505. }
  506. }
  507. public override void UpdateStatus()
  508. {
  509. if (!Manager.Inited)
  510. {
  511. return;
  512. }
  513. if (Manager.GardenLevel >= UnlockLv)
  514. {
  515. if (ItemStatus == SkillStatus.Lock)
  516. {
  517. if (UnlockCur == Current.Free)
  518. {
  519. Unlock();
  520. }
  521. else
  522. {
  523. ItemStatus = SkillStatus.UnLock;
  524. UIManager.UpdateManagePanelHint();
  525. }
  526. }
  527. }
  528. }
  529. public ExchangeInfo GetUnlockAheadExchangeValue(float rate, StaticsManager.ConsumeModule consumeModule)
  530. {
  531. ExchangeInfo info = ExchangeInfo.GetExchangeInfo(UnlockAheadCur, UnlockAheadAmt, rate);
  532. ExchangeInfo.GetExchangeValue(info, consumeModule);
  533. return info;
  534. }
  535. protected double GetUpgradeAmt(string str)
  536. {
  537. if (string.IsNullOrEmpty(str))
  538. {
  539. return UnlockAmt;
  540. }
  541. else
  542. {
  543. return double.Parse(str);
  544. }
  545. }
  546. protected override string GetDescription(int offset)
  547. {
  548. float temp;
  549. string[] strings = Desc.Split(TransferLabel.OpenChar, TransferLabel.CloseChar);
  550. StringBuilder stringBuilder = new StringBuilder();
  551. for (int i = 0; i < strings.Length; i++)
  552. {
  553. if (strings[i].Contains(TransferLabel.Level))
  554. {
  555. }
  556. else if (strings[i].Contains(TransferLabel.Person))
  557. {
  558. #region MyRegion
  559. if (!Person.Equal(0))
  560. {
  561. temp = NewPerson;
  562. UpgradeValue(ref temp, Person, UpgradePerson, offset);
  563. UpgradeUnit(ref temp, strings[i]);
  564. float remainder = temp % 1;
  565. if (remainder > 0)
  566. {
  567. stringBuilder.Append(temp.ToString("0") + "+");
  568. }
  569. else
  570. {
  571. stringBuilder.Append(temp.ToString("0"));
  572. }
  573. }
  574. else if (!PersonBuff.Equal(0))
  575. {
  576. temp = NewPersonBuff;
  577. UpgradeValue(ref temp, UpgradePerson, offset);
  578. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  579. }
  580. #endregion
  581. }
  582. else if (strings[i].Contains(TransferLabel.SkillCD))
  583. {
  584. #region MyRegion
  585. if (!SkillCD.Equal(0))
  586. {
  587. temp = NewSkillCD;
  588. UpgradeValue(ref temp, SkillCD, UpgradeCD, offset);
  589. UpgradeUnit(ref temp, strings[i]);
  590. stringBuilder.Append(temp.ToString("0"));
  591. }
  592. else if (!SkillCdBuff.Equal(0))
  593. {
  594. temp = NewSkillCdBuff;
  595. UpgradeSkillCdBuff(ref temp, UpgradeCD, offset);
  596. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  597. }
  598. #endregion
  599. }
  600. else if (strings[i].Contains(TransferLabel.CoinPerson))
  601. {
  602. #region MyRegion
  603. if (!CoinPerson.Equal(0))
  604. {
  605. temp = NewCoinPerson;
  606. UpgradeValue(ref temp, CoinPerson, UpgradePlus, offset);
  607. UpgradeUnit(ref temp, strings[i]);
  608. float remainder = temp % 1;
  609. if (remainder > 0)
  610. {
  611. stringBuilder.Append(temp.ToString("0") + "+");
  612. }
  613. else
  614. {
  615. stringBuilder.Append(temp.ToString("0"));
  616. }
  617. }
  618. else if (!Plus.Equal(0))
  619. {
  620. temp = NewPlus;
  621. UpgradeValue(ref temp, UpgradePlus, offset);
  622. stringBuilder.Append(string.Format("{0:0}%", temp * 100));
  623. }
  624. #endregion
  625. }
  626. else
  627. {
  628. stringBuilder.Append(strings[i]);
  629. }
  630. }
  631. return stringBuilder.ToString();
  632. }
  633. }