ActivityDataManager.cs 5.0 KB

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