ActivityDataManager.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System.Collections.Generic;
  2. namespace GFGGame
  3. {
  4. public class ActivityDataManager : SingletonBase<ActivityDataManager>
  5. {
  6. public void Clear()
  7. {
  8. luckyBoxActBonusState.Clear();
  9. allPlayTimes = 0;
  10. lastActLuckyBoxId = 0;
  11. lastActLimitChargeId = 0;
  12. luckyActTsyBonusState.Clear();
  13. allTsyPlayTimes = 0;
  14. lastActLimitTsyId = 0;
  15. lastActLimitStlycId = 0;
  16. }
  17. /**********************************************************活动*************************************************/
  18. /// <summary>
  19. /// 获取指定类型活动当前开启的活动id
  20. /// </summary>
  21. /// <returns></returns>
  22. public int GetCurOpenActiveByType(int type)
  23. {
  24. List<ActivityOpenCfg> activityOpenCfgs = ActivityOpenCfgArray.Instance.GetCfgsBytype(type);
  25. for (int i = 0; i < activityOpenCfgs.Count; i++)
  26. {
  27. if (TimeUtil.IsBeforeCurTime(activityOpenCfgs[i].openTime) && TimeUtil.IsLaterCurTime(activityOpenCfgs[i].endTime))
  28. {
  29. return activityOpenCfgs[i].id;
  30. }
  31. }
  32. return 0;
  33. }
  34. /**********************************************************活动弹窗*************************************************/
  35. public int todayActivityTips = 0;
  36. public int todayMonthlyCardTips = 0;
  37. /**********************************************************限时累充*************************************************/
  38. public int lastActLimitChargeId = 0;
  39. private int _actLimitChargeId = 0;
  40. /// <summary>
  41. /// 当前限时累充活动id
  42. /// </summary>
  43. /// <value></value>
  44. public int actLimitChargeId { get { return _actLimitChargeId; } set { _actLimitChargeId = value; } }
  45. /**********************************************************限时抽奖活动*********************************************/
  46. public int lastActLuckyBoxId = 0;
  47. public int lastActLimitTsyId = 0;
  48. public int lastActLimitStlycId = 0;
  49. private int _actLuckyBoxId = 0;
  50. private int _actLuckyTsyId = 0;
  51. private int _actLimitStlycId = 0;
  52. /// <summary>
  53. /// 当前抽奖活动id
  54. /// </summary>
  55. /// <value></value>
  56. public int actLuckyBoxId { get { return _actLuckyBoxId; } set { _actLuckyBoxId = value; } }
  57. /// <summary>
  58. /// 抽奖总次数
  59. /// </summary>
  60. /// <value></value>
  61. public long allPlayTimes { get; set; }
  62. /// <summary>
  63. /// 限时抽奖必掉次数
  64. /// </summary>
  65. /// <value></value>
  66. public int lastDrawCount { get; set; }
  67. /// <summary>
  68. /// </summary>
  69. /// <typeparam name="int">奖励key,这里对应抽奖次数</typeparam>
  70. /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
  71. /// <returns></returns>
  72. public Dictionary<int, int> luckyBoxActBonusState = new Dictionary<int, int>();
  73. /// <summary>
  74. /// 当前天市垣抽奖活动id
  75. /// </summary>
  76. /// <value></value>
  77. public int actLimitTsyId { get { return _actLuckyTsyId; } set { _actLuckyTsyId = value; } }
  78. /// <summary>
  79. /// 天市垣抽奖总次数
  80. /// </summary>
  81. /// <value></value>
  82. public long allTsyPlayTimes { get; set; }
  83. /// <summary>
  84. /// 限时天市垣抽奖必掉次数
  85. /// </summary>
  86. /// <value></value>
  87. public int lastTsyDrawCount { get; set; }
  88. /// <summary>
  89. /// </summary>
  90. /// <typeparam name="int">奖励key,这里对应天市垣抽奖次数</typeparam>
  91. /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
  92. /// <returns></returns>
  93. public Dictionary<int, int> luckyActTsyBonusState = new Dictionary<int, int>();
  94. /// <summary>
  95. /// 当前隋唐洛阳城活动id
  96. /// </summary>
  97. /// <value></value>
  98. public int actLimitStlycId { get { return _actLimitStlycId; } set { _actLimitStlycId = value; } }
  99. /// <summary>
  100. /// 开服活动抽奖总次数
  101. /// </summary>
  102. /// <value></value>
  103. public long allLimitStlycTimes { get; set; }
  104. /// <summary>
  105. /// 开服抽奖必掉次数
  106. /// </summary>
  107. /// <value></value>
  108. public int lastStlycDrawCount { get; set; }
  109. /// <summary>
  110. /// </summary>
  111. /// <typeparam name="int">奖励key,这里对应抽奖次数</typeparam>
  112. /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
  113. /// <returns></returns>
  114. public Dictionary<int, int> limitStlycActBonusState = new Dictionary<int, int>();
  115. public List<ActivityLuckybonusCfg> SortActivityLuckybonusCfg(List<ActivityLuckybonusCfg> list,int typeId)
  116. {
  117. list.Sort((ActivityLuckybonusCfg a, ActivityLuckybonusCfg b) =>
  118. {
  119. long allPlayTimes = 0;
  120. int stateA = 0;
  121. int stateB = 0;
  122. if (typeId == ConstLimitTimeActivityType.ActLimitLuckyBox) {
  123. allPlayTimes = ActivityDataManager.Instance.allPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore);
  124. stateA = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(a.num) ? 1 : -1;
  125. stateB = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(b.num) ? 1 : -1;
  126. }
  127. else if(typeId == ConstLimitTimeActivityType.ActLimitTsy)
  128. {
  129. allPlayTimes = ActivityDataManager.Instance.allTsyPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore);
  130. stateA = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(a.num) ? 1 : -1;
  131. stateB = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(b.num) ? 1 : -1;
  132. }
  133. else if (typeId == ConstLimitTimeActivityType.ActLimitStlyc)
  134. {
  135. allPlayTimes = ActivityDataManager.Instance.allTsyPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore);
  136. stateA = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(a.num) ? 1 : -1;
  137. stateB = ActivityDataManager.Instance.luckyActTsyBonusState.ContainsKey(b.num) ? 1 : -1;
  138. }
  139. if (allPlayTimes >= a.num && allPlayTimes < b.num && stateA < 0) return -1;
  140. if (allPlayTimes >= b.num && allPlayTimes < a.num && stateB < 0) return 1;
  141. if (stateA >= 0 && stateB < 0) return 1;
  142. if (stateB >= 0 && stateA < 0) return -1;
  143. return a.num - b.num;
  144. });
  145. return list;
  146. }
  147. /**********************************************************每日登录*************************************************/
  148. private int _sevenDayLoginLoginId = 1;
  149. /// <summary>
  150. /// 七日登录 当日奖励id
  151. /// </summary>
  152. /// <value></value>
  153. public int sevenDayLoginLoginId
  154. {
  155. get { return _sevenDayLoginLoginId; }
  156. set { _sevenDayLoginLoginId = value; }
  157. }
  158. private int _sevenDayLoginBonusStatus = 0;
  159. /// <summary>
  160. /// 七日登录 当前奖励状态
  161. /// </summary>
  162. /// <value></value>
  163. public int sevenDayLoginBonusStatus
  164. {
  165. get { return _sevenDayLoginBonusStatus; }
  166. set { _sevenDayLoginBonusStatus = value; }
  167. }
  168. /******************************************************************************************************************/
  169. /**********************************************************每日登录修改*************************************************/
  170. public List<int> sevenDayLoginLoginIdList = new List<int>();
  171. /// <summary>
  172. /// 七日登录 当日奖励id
  173. /// </summary>
  174. /// <value></value>
  175. public List<int> sevenDayLoginBonusStatusList = new List<int>();
  176. /// <summary>
  177. /// 七日登录 当前奖励状态
  178. /// </summary>
  179. /// <value></value>
  180. ///
  181. public bool CanGetSevenDayBonus()
  182. {
  183. foreach(int a in sevenDayLoginBonusStatusList)
  184. {
  185. if (a == 1) return true;
  186. }
  187. return false;
  188. }
  189. public bool AllSevenDayBonusGot()
  190. {
  191. foreach (int a in sevenDayLoginBonusStatusList)
  192. {
  193. if (a != 2) return false;
  194. }
  195. return true;
  196. }
  197. /******************************************************************************************************************/
  198. private int _firstChargeBonusStatus = 0;
  199. /// <summary>
  200. /// 首冲奖励 当前奖励状态,ConstBonusStatus 0不可领,1可领,2已领
  201. /// </summary>
  202. /// <value></value>
  203. public int firstChargeBonusStatus
  204. {
  205. get
  206. {
  207. var status = GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.FirstRechargeBonusStatus);
  208. if (status == ConstBonusStatus.GOT)
  209. {
  210. return ConstBonusStatus.GOT;
  211. }
  212. if (GameGlobal.myNumericComponent.GetAsLong(ET.NumericType.FirstRechargeTotal) > 0)
  213. {
  214. return ConstBonusStatus.CAN_GET;
  215. }
  216. return ConstBonusStatus.CAN_NOT_GET;
  217. }
  218. }
  219. }
  220. }