ActivityDataManager.cs 11 KB

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