ActivityDataManager.cs 5.0 KB

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