UpgradeVo.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UpgradeVo
  5. {
  6. public UpgradeVo(int id,int itemId,int num)
  7. {
  8. this.itemId = itemId;
  9. this.num = num;
  10. this.id = id;
  11. }
  12. /// <summary>
  13. /// 唤灵是id
  14. /// </summary>
  15. public int id { get; set; }
  16. /// <summary>
  17. /// 消耗道具id
  18. /// </summary>
  19. public int itemId { get; set; }
  20. /// <summary>
  21. /// 消耗数量
  22. /// </summary>
  23. public int num { get; set; }
  24. /// <summary>
  25. /// 增加的经验值
  26. /// </summary>
  27. public int addExp
  28. {
  29. get
  30. {
  31. int totalNum = sm_item_stones.GetMoById(this.itemId).baseExp * this.num;
  32. return totalNum;
  33. }
  34. }
  35. /// <summary>
  36. /// 变化等级
  37. /// </summary>
  38. public int addLv
  39. {
  40. get
  41. {
  42. if (!UserProxy.Instance.player.collectHero.collectHeroDic.ContainsKey(this.id.ToString()))
  43. {
  44. return 0;
  45. }
  46. GameHeroVo vo = UserProxy.Instance.player.collectHero.collectHeroDic[this.id.ToString()];
  47. int xp = vo.xp+this.addExp;
  48. int lv = 0;
  49. int temp = 0;
  50. Dictionary<int, sm_hero_levelexp> dic = GameConfigData.Ins.hero_levelexp;
  51. foreach (KeyValuePair<int,sm_hero_levelexp>kv in dic)
  52. {
  53. if (kv.Key <= vo.level)
  54. {
  55. continue;
  56. }
  57. if (kv.Value.requiredExp > xp)
  58. {
  59. break;
  60. }
  61. lv += 1;
  62. }
  63. return lv;
  64. }
  65. }
  66. /// <summary>
  67. /// 变化的金币
  68. /// </summary>
  69. public int gold
  70. {
  71. get
  72. {
  73. int gold = sm_item_stones.GetMoById(this.itemId).costGold * this.num;
  74. return gold;
  75. }
  76. }
  77. ///// <summary>
  78. ///// 增加的经验值
  79. ///// </summary>
  80. //public int addExp
  81. //{
  82. // get
  83. // {
  84. // return 0;
  85. // }
  86. //}
  87. }