ActivityDataManager.cs 11 KB

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