ActivityDataManager.cs 11 KB

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