using System.Collections.Generic; namespace GFGGame { public struct FieldInfos { public int theme; public List highestLvls; public int bonusWeekly; public int bonusMaxLimit; public Dictionary taskDic; public bool hasBonus; }; public struct FieldResult { public int passLvl;//完成关数 public List bonusList; public int costNum; //体力消耗 public int hardLvl; //难度,由ConstInstanceZonesSubType定义 } public class FieldDataManager : SingletonBase { // private int _theme = 1; //当前主题 由ConstItemAttributeType定义 // /// // /// 本期主题 // /// // public int Theme // { // get { return _theme; } // set { _theme = value; } // } // private int _bonusWeekly = 0;//每周已领奖励 // /// // /// 每周已领奖励 // /// // /// // public int BonusWeekly // { // get { return _bonusWeekly; } // set { _bonusWeekly = value; } // } // private int _bonusMaxLimit = 0;//奖励上限 // /// // /// 奖励上限 // /// // /// // public int BonusMaxLimit // { // get { return _bonusMaxLimit; } // set { _bonusMaxLimit = value; } // } // private List _highestLvls = new List();//最高关卡记录列表,由简单到难 // private Dictionary _taskDic = new Dictionary();//任务奖励状态 由ConstBonusStatus定义 // private bool hasBonus = false;//仅在上线时判断是否有奖励未结算 public FieldInfos fieldInfos = new FieldInfos(); public FieldResult fieldResult = new FieldResult(); /// /// 当前难度 /// public int c_difficulty = 0; // public void UpdateHighestLvls(List highestLvls) // { // _highestLvls = highestLvls; // } public void UpdateTask(int taskId, int state) { if (!fieldInfos.taskDic.ContainsKey(taskId)) { fieldInfos.taskDic.Add(taskId, state); } else { fieldInfos.taskDic[taskId] = state; } } /// /// 根据挑战难度获取最高记录 /// /// /// public int GetHighestLvByDifficulty(int difficulty) { if (fieldInfos.highestLvls.IndexOf(difficulty) < 0) { return 0; } else { return fieldInfos.highestLvls[difficulty]; } } /// /// 根据挑战难度获取副本配置 /// /// /// public FieldCfg GetFieldCfgByDifficulty(int difficulty) { return FieldCfgArray.Instance.GetCfgs(difficulty)[0]; } /// /// 根据挑战难度获取当前战斗Id /// /// public int GetLevelIdByDifficulty(int difficulty) { FieldCfg cfg = GetFieldCfgByDifficulty(difficulty); return StoryLevelCfgArray.Instance.GetCfgs(cfg.type, cfg.subType, cfg.id)[0].id; } /// /// 获取任务列表 /// /// public List GetTaskCfgs() { List cfgs = new List(FieldTaskCfgArray.Instance.dataArray); cfgs.Sort((FieldTaskCfg a, FieldTaskCfg b) => { int stateA = GetTaskState(a.id); int stateB = GetTaskState(b.id); return stateA.CompareTo(stateB); }); return cfgs; } /// /// 根据任务ID获取任务状态0可领取1未完成2已领取 /// /// /// public int GetTaskState(int taskId) { return fieldInfos.taskDic.ContainsKey(taskId) ? fieldInfos.taskDic[taskId] : 1; } } }