ShenMiaoVo.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Newtonsoft.Json.Linq;
  5. public class ShenMiaoVo
  6. {
  7. public ShenMiaoVo(EShenMiaoActiveType type)
  8. {
  9. this.type = type;
  10. //this.id = id;
  11. }
  12. /// <summary>
  13. /// 活动类型
  14. /// </summary>
  15. public EShenMiaoActiveType type { get; set; }
  16. /// <summary>
  17. /// 活动id
  18. /// </summary>
  19. public string id
  20. {
  21. get
  22. {
  23. string id = "";
  24. Dictionary<int,Ins_Active> aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic;
  25. if (aDic.ContainsKey((int)this.type))
  26. {
  27. return aDic[(int)this.type].id;
  28. }
  29. //if (this.type == EShenMiaoActiveType.NewWish || this.type == EShenMiaoActiveType.OpenWish)
  30. //{
  31. // int type = (int)EShenMiaoActiveType.NewWish;
  32. // id = type.ToString();
  33. //}
  34. //else
  35. //{
  36. // //根据当前的时间 去找 对应活动
  37. //}
  38. return id;
  39. }
  40. }
  41. /// <summary>
  42. /// 活动名称
  43. /// </summary>
  44. public string name
  45. {
  46. get
  47. {
  48. return sm_shenmiao.GetMoById(this.id).name;
  49. }
  50. }
  51. /// <summary>
  52. /// 活动描述信息
  53. /// </summary>
  54. public string desc
  55. {
  56. get
  57. {
  58. return sm_shenmiao.GetMoById(this.id).desc;
  59. }
  60. }
  61. /// <summary>
  62. /// 活动图
  63. /// </summary>
  64. public string icon
  65. {
  66. get
  67. {
  68. return sm_shenmiao.GetMoById(this.id).icon;
  69. }
  70. }
  71. /// <summary>
  72. /// 消耗道具类型
  73. /// </summary>
  74. public EItemSubType costType
  75. {
  76. get
  77. {
  78. string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(',');
  79. int subType = sm_item_base.GetMoById(int.Parse(sList[0])).subType;
  80. return (EItemSubType)subType;
  81. }
  82. }
  83. /// <summary>
  84. /// 消耗道具id
  85. /// </summary>
  86. public int costId
  87. {
  88. get
  89. {
  90. string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(',');
  91. return int.Parse(sList[0]);
  92. }
  93. }
  94. /// <summary>
  95. /// 是否有折扣
  96. /// </summary>
  97. public bool isDisCount
  98. {
  99. get
  100. {
  101. return sm_shenmiao.GetMoById(this.id).discount != 0?true:false;
  102. }
  103. }
  104. /// <summary>
  105. /// 1次消耗道具数量
  106. /// </summary>
  107. public int oneCost
  108. {
  109. get
  110. {
  111. string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(',');
  112. return int.Parse(sList[1]);
  113. }
  114. }
  115. /// <summary>
  116. /// 10次 消耗道具类型
  117. /// </summary>
  118. public int tenCost
  119. {
  120. get
  121. {
  122. string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(',');
  123. int per = sm_shenmiao.GetMoById(this.id).discount;
  124. if (per != 0)
  125. {
  126. float f = 1.0f * per / 100;
  127. float n = 10 * f;
  128. return (int)n;
  129. }
  130. return 10;
  131. }
  132. }
  133. /// <summary>
  134. /// 剩余次数
  135. /// </summary>
  136. public int num
  137. {
  138. get
  139. {
  140. if (this.type == EShenMiaoActiveType.NewWish)
  141. {
  142. string num = GameConfigData.Ins.globalsettings.UserWishNumLimit.ToString();
  143. Dictionary<int, Ins_Active> aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic;
  144. if (aDic.ContainsKey((int)this.type))
  145. {
  146. int cNum = aDic[(int)this.type].num;
  147. int tNum = int.Parse(num) - cNum;
  148. if (tNum <= 0)
  149. {
  150. return 0;
  151. }
  152. return tNum;
  153. }
  154. }
  155. return 0;
  156. }
  157. }
  158. /// <summary>
  159. /// 一个券需要的价格
  160. /// </summary>
  161. public int price
  162. {
  163. get
  164. {
  165. string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(',');
  166. int subType = sm_item_base.GetMoById(int.Parse(sList[0])).subType;
  167. if (subType == (int)EItemSubType.commonWishCoupons)
  168. {
  169. return GameConfigData.Ins.GetshopMo("801022").yuanjia;
  170. }
  171. else
  172. {
  173. return GameConfigData.Ins.GetshopMo("801023").yuanjia;
  174. }
  175. return 0;
  176. }
  177. }
  178. public long endTs
  179. {
  180. get
  181. {
  182. if (this.type >= EShenMiaoActiveType.HuanlingshiActive)
  183. {
  184. Dictionary<int, Ins_Active> aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic;
  185. if (aDic.ContainsKey((int)this.type))
  186. {
  187. return sm_shenmiao.GetMoById(aDic[(int)this.type].id).endTs;
  188. }
  189. }
  190. return 0;
  191. }
  192. }
  193. }