using System.Collections.Generic; namespace GFGGame { public struct FieldInfos { /// /// 当前主题 由ConstItemAttributeType定义 /// public int theme; /// /// 最高关卡记录列表,由简单到难 /// public Dictionary highestLvls; /// /// 每周已领奖励 /// public int bonusWeekly; /// /// 奖励上限 /// public int bonusMaxLimit; /// /// 任务奖励状态 由ConstBonusStatus定义 /// public Dictionary taskDic; /// /// 仅在上线时判断是否有奖励未结算 /// public bool hasBonus; }; public struct FieldResult { /// /// 完成关数 /// public int passLvl; /// /// 奖励列表 /// public List bonusList; /// /// 体力消耗 /// public int costNum; /// /// 章节id /// public int chapterId; } public class FieldDataManager : SingletonBase { public FieldInfos fieldInfos = new FieldInfos(); public FieldResult fieldResult = new FieldResult(); //用于记录进入主界面后打开界面 public bool waitToShowFieldFightEndView = false; /// ///当前难度的副本Id /// public int chapterId; /// /// 当前关卡挑战进度,起始为1 /// public int currFightLv = 1; /// /// 当前难度 /// public int difficulty = 0; /// /// 根据副本Id获取最高记录 /// /// /// public int GetHighestLvByChapterId(int chapterId) { if (!fieldInfos.highestLvls.ContainsKey(chapterId)) { return 0; } else { return fieldInfos.highestLvls[chapterId]; } } /// /// 获取任务列表 /// /// public List GetTaskCfgs() { List cfgs = new List(FieldTaskCfgArray.Instance.dataArray); cfgs.Sort((FieldTaskCfg a, FieldTaskCfg b) => { int stateA = GetTaskState(a.id) == 1 ? 1 : -1; int stateB = GetTaskState(b.id) == 1 ? 1 : -1; if (stateA > stateB) return -1; if (stateB > stateA) return 1; return GetTaskState(a.id).CompareTo(GetTaskState(b.id)); }); return cfgs; } /// /// 根据任务ID获取任务状态0未完成1可领取2已领取 /// /// /// public int GetTaskState(int taskId) { if (fieldInfos.taskDic == null) return 0; return fieldInfos.taskDic.ContainsKey(taskId) ? fieldInfos.taskDic[taskId] : 0; } } }