BattlePassTaskDataManager.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System.Collections.Generic;
  2. using ET;
  3. namespace GFGGame
  4. {
  5. public class BattlePassTaskDataManager : Singleton<BattlePassTaskDataManager>
  6. {
  7. //通行证赛季Id
  8. private int SeasonId = 0;
  9. //是否购买通行证
  10. private bool IsBuy = false;
  11. private long SeasonEndTime = 0;
  12. //已经领奖levelId
  13. private HashSet<int> NormalRewards = new HashSet<int>();
  14. //已经高级领奖levelId
  15. private HashSet<int> SuperRewards = new HashSet<int>();
  16. public int GetSeasonId()
  17. {
  18. return SeasonId;
  19. }
  20. public void AddNormalReward(int levelId)
  21. {
  22. NormalRewards.Add(levelId);
  23. }
  24. public void AddSuperReward(int levelId)
  25. {
  26. SuperRewards.Add(levelId);
  27. }
  28. public void SetSeasonId(int seasonId)
  29. {
  30. SeasonId = seasonId;
  31. //设置赛季结束时间
  32. //获取赛季配置
  33. var seasonCfg = BattlePassOpenCfgArray.Instance.GetCfg(seasonId);
  34. if (seasonCfg == null) return;
  35. SeasonEndTime = TimeUtil.GetResetTimeSec(seasonCfg.endTime);
  36. }
  37. public void SetIsBuy(bool isBuy)
  38. {
  39. IsBuy = isBuy;
  40. }
  41. //检查普通领取状态
  42. public bool CheckLevelRewardGet(int levelId)
  43. {
  44. return NormalRewards.Contains(levelId);
  45. }
  46. //检查高级领取状态
  47. public bool CheckSuperLevelRewardGet(int levelId)
  48. {
  49. return SuperRewards.Contains(levelId);
  50. }
  51. //获取赛季结束时间
  52. public long GetSeasonEndTime()
  53. {
  54. return SeasonEndTime;
  55. }
  56. //获取通行证当前等级
  57. public int GetBattlePassLevel()
  58. {
  59. return GameGlobal.myNumericComponent.GetAsInt(NumericType.PassLevel);
  60. }
  61. }
  62. }