123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class BattlePassTaskDataManager : Singleton<BattlePassTaskDataManager>
- {
- //通行证赛季Id
- private int SeasonId = 0;
- //是否购买通行证
- private bool IsBuy = false;
- private long SeasonEndTime = 0;
- //已经领奖levelId
- private HashSet<int> NormalRewards = new HashSet<int>();
- //已经高级领奖levelId
- private HashSet<int> SuperRewards = new HashSet<int>();
- public int GetSeasonId()
- {
- return SeasonId;
- }
- public void AddNormalReward(int levelId)
- {
- NormalRewards.Add(levelId);
- }
- public void AddSuperReward(int levelId)
- {
- SuperRewards.Add(levelId);
- }
- public void SetSeasonId(int seasonId)
- {
- SeasonId = seasonId;
- //设置赛季结束时间
- //获取赛季配置
- var seasonCfg = BattlePassOpenCfgArray.Instance.GetCfg(seasonId);
- if (seasonCfg == null) return;
- SeasonEndTime = TimeUtil.GetResetTimeSec(seasonCfg.endTime);
- }
- public void SetIsBuy(bool isBuy)
- {
- IsBuy = isBuy;
- }
- //检查普通领取状态
- public bool CheckLevelRewardGet(int levelId)
- {
- return NormalRewards.Contains(levelId);
- }
- //检查高级领取状态
- public bool CheckSuperLevelRewardGet(int levelId)
- {
- return SuperRewards.Contains(levelId);
- }
- //获取赛季结束时间
- public long GetSeasonEndTime()
- {
- return SeasonEndTime;
- }
- //获取通行证当前等级
- public int GetBattlePassLevel()
- {
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.PassLevel);
- }
- }
- }
|