using System.Collections.Generic; using System.Linq; using ET; namespace GFGGame { public class DailyTaskDataManager : SingletonBase { private Dictionary _livenessBoxInfos = new Dictionary(); public void Clear() { _livenessBoxInfos.Clear(); } public void UpdateLivenessBoxInfo(int boxId, int state) { if (!_livenessBoxInfos.ContainsKey(boxId)) { _livenessBoxInfos.Add(boxId, state); } else { _livenessBoxInfos[boxId] = state; } } /// /// 根据宝箱id获取宝箱状态 /// 0不可领取,1可领取,2已领取 /// /// public int GetBoxStateById(int boxId) { _livenessBoxInfos.TryGetValue(boxId, out var state); return state; } /// /// 获取下一个奖励宝箱的活跃度 /// /// public int GetShowLivenessBoxNum(int taskFuncType) { var cfgs = TaskActiveRewardCfgArray.Instance.GetCfgsByfuncType(taskFuncType); foreach (var t in cfgs) { if (!_livenessBoxInfos.ContainsKey(t.id) || _livenessBoxInfos[t.id] != ConstBonusStatus.GOT) { return t.count; } } var index = cfgs.Count - 1; return cfgs[index].count; } public bool GetHadGetRewardNum(int taskFuncType) { foreach(var t in _livenessBoxInfos) { if(t.Value == ConstBonusStatus.CAN_GET) { var cfg = TaskActiveRewardCfgArray.Instance.GetCfg(t.Key); if (cfg == null) continue; if (taskFuncType != 0 && cfg.funcType != taskFuncType) continue; return true; } } return false; } } }