ActivityDataManager.cs 5.2 KB

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