ActivityDataManager.cs 8.2 KB

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