ActivityDataManager.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. }
  12. /**********************************************************活动*************************************************/
  13. /// <summary>
  14. /// 获取指定类型活动当前开启的活动id
  15. /// </summary>
  16. /// <returns></returns>
  17. public int GetCurOpenActiveByType(int type)
  18. {
  19. List<ActivityOpenCfg> activityOpenCfgs = ActivityOpenCfgArray.Instance.GetCfgsBytype(type);
  20. for (int i = 0; i < activityOpenCfgs.Count; i++)
  21. {
  22. if (TimeUtil.IsBeforeCurTime(activityOpenCfgs[i].openTime) && TimeUtil.IsLaterCurTime(activityOpenCfgs[i].endTime))
  23. {
  24. return activityOpenCfgs[i].id;
  25. }
  26. }
  27. return 0;
  28. }
  29. /**********************************************************限时累充*************************************************/
  30. private int _actLimitChargeId = 0;
  31. /// <summary>
  32. /// 当前限时累充活动id
  33. /// </summary>
  34. /// <value></value>
  35. public int actLimitChargeId { get { return _actLimitChargeId; } set { _actLimitChargeId = value; } }
  36. /**********************************************************限时抽奖活动*********************************************/
  37. public int lastActLuckyBoxId = 0;
  38. private int _actLuckyBoxId = 0;
  39. /// <summary>
  40. /// 当前抽奖活动id
  41. /// </summary>
  42. /// <value></value>
  43. public int actLuckyBoxId { get { return _actLuckyBoxId; } set { _actLuckyBoxId = value; } }
  44. /// <summary>
  45. /// 抽奖总次数
  46. /// </summary>
  47. /// <value></value>
  48. public long allPlayTimes { get; set; }
  49. /// <summary>
  50. /// 限时抽奖必掉次数
  51. /// </summary>
  52. /// <value></value>
  53. public int lastDrawCount { get; set; }
  54. /// <summary>
  55. /// </summary>
  56. /// <typeparam name="int">奖励key,这里对应抽奖次数</typeparam>
  57. /// <typeparam name="int">值由ConstBonusStatus定义</typeparam>
  58. /// <returns></returns>
  59. public Dictionary<int, int> luckyBoxActBonusState = new Dictionary<int, int>();
  60. public List<ActivityLuckybonusCfg> SortActivityLuckybonusCfg(List<ActivityLuckybonusCfg> list)
  61. {
  62. list.Sort((ActivityLuckybonusCfg a, ActivityLuckybonusCfg b) =>
  63. {
  64. long allPlayTimes = ActivityDataManager.Instance.allPlayTimes;// GameGlobal.myNumericComponent.GetAsInt(NumericType.TotalRechargeScore);
  65. int stateA = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(a.num) ? 1 : -1;
  66. int stateB = ActivityDataManager.Instance.luckyBoxActBonusState.ContainsKey(b.num) ? 1 : -1;
  67. if (allPlayTimes >= a.num && allPlayTimes < b.num && stateA < 0) return -1;
  68. if (allPlayTimes >= b.num && allPlayTimes < a.num && stateB < 0) return 1;
  69. if (stateA >= 0 && stateB < 0) return 1;
  70. if (stateB >= 0 && stateA < 0) return -1;
  71. return a.num - b.num;
  72. });
  73. return list;
  74. }
  75. /**********************************************************每日登录*************************************************/
  76. private int _sevenDayLoginLoginId = 1;
  77. /// <summary>
  78. /// 七日登录 当日奖励id
  79. /// </summary>
  80. /// <value></value>
  81. public int sevenDayLoginLoginId
  82. {
  83. get { return _sevenDayLoginLoginId; }
  84. set { _sevenDayLoginLoginId = value; }
  85. }
  86. private int _sevenDayLoginBonusStatus = 0;
  87. /// <summary>
  88. /// 七日登录 当前奖励状态
  89. /// </summary>
  90. /// <value></value>
  91. public int sevenDayLoginBonusStatus
  92. {
  93. get { return _sevenDayLoginBonusStatus; }
  94. set { _sevenDayLoginBonusStatus = value; }
  95. }
  96. /******************************************************************************************************************/
  97. private int _firstChargeBonusStatus = 0;
  98. /// <summary>
  99. /// 首冲奖励 当前奖励状态,ConstBonusStatus 0不可领,1可领,2已领
  100. /// </summary>
  101. /// <value></value>
  102. public int firstChargeBonusStatus
  103. {
  104. get
  105. {
  106. var status = GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.FirstRechargeBonusStatus);
  107. if (status == ConstBonusStatus.GOT)
  108. {
  109. return ConstBonusStatus.GOT;
  110. }
  111. if (GameGlobal.myNumericComponent.GetAsLong(ET.NumericType.RechargeTotal) > 0)
  112. {
  113. return ConstBonusStatus.CAN_GET;
  114. }
  115. return ConstBonusStatus.CAN_NOT_GET;
  116. }
  117. }
  118. }
  119. }