void InitCache() { LogHelper.Insert("Task cache init start", LogType.Info); var list = ConfigTaskMgr.GetAllForCache(); var requireList = ConfigTaskrequireMgr.GetAll(); _taskDic = list.ToDictionary(d => d.Idx, d => d); _taskParentDic = new Dictionary <int, List <ConfigTaskEntity> >(); _taskAchievement = new Dictionary <int, List <ConfigTaskrequireEntity> >(); _taskRequire = new Dictionary <int, ConfigTaskrequireEntity>(); _managerlevelDic = new Dictionary <int, List <ConfigTaskEntity> >(); int dailytaskType = (int)EnumTaskType.Daily; _dailyTaskDic = new Dictionary <int, ConfigTaskEntity>(); _dailyRandomTaskDic = new Dictionary <int, ConfigTaskEntity>(); //_dailytaskList2 = list.FindAll(d => d.TaskType == dailytaskType); foreach (var entity in _taskDic.Values) { entity.RequireList = new List <ConfigTaskrequireEntity>(); entity.RequireFuncDic = new Dictionary <int, int>(); if (entity.TaskType != dailytaskType && entity.TaskType != (int)EnumTaskType.DailyRandom) { if (entity.ParentId != 0) { if (!_taskParentDic.ContainsKey(entity.ParentId)) { _taskParentDic.Add(entity.ParentId, new List <ConfigTaskEntity>()); } _taskParentDic[entity.ParentId].Add(entity); } else { if (!_managerlevelDic.ContainsKey(entity.ManagerLevel)) { _managerlevelDic.Add(entity.ManagerLevel, new List <ConfigTaskEntity>()); } _managerlevelDic[entity.ManagerLevel].Add(entity); } if (entity.TaskType == (int)EnumTaskType.Achievement) { if (!_taskAchievement.ContainsKey(entity.Idx)) { var task = requireList.Find(r => r.TaskId == entity.Idx); if (task != null) { var key = CreateKey(task.RequireType, task.RequireSub, task.RequireThird, task.OverState); if (!_taskAchievement.ContainsKey(key)) { _taskAchievement.Add(key, new List <ConfigTaskrequireEntity>()); } _taskAchievement[key].Add(task); } } } } else if (entity.TaskType == dailytaskType) { if (!_dailyTaskDic.ContainsKey(entity.Idx)) { _dailyTaskDic.Add(entity.Idx, entity); } } else if (entity.TaskType == (int)EnumTaskType.DailyRandom) { if (!_dailyRandomTaskDic.ContainsKey(entity.Idx)) { _dailyRandomTaskDic.Add(entity.Idx, entity); } } } foreach (var item in requireList) { if (!_taskRequire.ContainsKey(item.TaskId)) { _taskRequire.Add(item.TaskId, item); } } var list2 = ConfigTaskrequireMgr.GetAll(); foreach (var entity in list2) { var task = _taskDic[entity.TaskId]; if (!string.IsNullOrEmpty(task.RequireFuncs)) { task.RequireFuncs += ","; } task.RequireFuncs += entity.RequireType; task.RequireList.Add(entity); if (!task.RequireFuncDic.ContainsKey(entity.RequireType)) { task.RequireFuncDic.Add(entity.RequireType, 0); } } LogHelper.Insert("Task cache init end", LogType.Info); }
public static DescriptionConfigEntity ExportDescriptionDic() { var config = new DescriptionConfigEntity(); var list = DicGrowMgr.GetAll(); config.GrowDic = new List <LDescriptionEntity>(list.Count); foreach (var dicGrowEntity in list) { config.GrowDic.Add(new LDescriptionEntity() { Description = dicGrowEntity.Name, Idx = dicGrowEntity.Idx, GrowTip = dicGrowEntity.GrowTip }); } var suitList = DicEquipmentsuitMgr.GetAll(); config.EquipmentSuit = new List <EquipmentsuitEntity>(suitList.Count); foreach (var entity in suitList) { config.EquipmentSuit.Add(new EquipmentsuitEntity() { Idx = entity.Idx, Memo1 = entity.Memo1, Memo2 = entity.Memo2, Memo3 = entity.Memo3, Name = entity.Name, SuitType = entity.SuitType }); } var appsettings = ConfigAppsettingMgr.GetAllForCache(); config.WChallengeNameTemplate = GetAppSettingName("WChallengeStageNameTemplate", appsettings); config.HighBallsoulName = GetAppSettingName("HighBallsoulName", appsettings); config.NormalBallsoulName = GetAppSettingName("NormalBallsoulName", appsettings); var funcs = ConfigFunctionopenMgr.GetAll(); config.Functionopens = new List <WpfConfigFunctionopenEntity>(); foreach (var entity in funcs) { if (entity.FunctionId > 0) { config.Functionopens.Add(new WpfConfigFunctionopenEntity() { Idx = entity.FunctionId, LockMemo = entity.LockMemo, Name = entity.Name, ManagerLevel = entity.ManagerLevel }); } } config.BuffTips = new List <BuffTipsEntity>(); foreach (var item in DicBuffMgr.GetAll()) { if (item.BuffType == 2) { config.BuffTips.Add(new BuffTipsEntity(item)); } } config.BuffSrcTips = new List <BuffSrcTipsEntity>(); foreach (var item in DicSkillMgr.GetAll()) { if (item.BuffSrcType == 1) { config.BuffSrcTips.Add(new BuffSrcTipsEntity(item)); } } config.PlayerCardStrengthPlus = GetAppSettingName("PlayerCardStrengthPlus", appsettings); config.Equipmentplus = ConfigEquipmentplusMgr.GetAll(); config.Mails = DicMailMgr.GetAll(); var ladderExchanges = DicLadderexchangeMgr.GetAll(); config.LadderExchanges = new List <LadderExchangeEntity>(); foreach (var entity in ladderExchanges) { var exchange = new LadderExchangeEntity() { Idx = entity.Type, CostHonor = entity.CostHonor, LadderCoin = entity.LadderCoin }; config.LadderExchanges.Add(exchange); } var leagueExchanges = DicLeagueexchangeMgr.GetAll(); config.LeagueExchanges = new List <LeagueExchangeEntity>(); foreach (var entity in leagueExchanges) { var exchange = new LeagueExchangeEntity() { Idx = entity.Idx, CostScore = entity.CostScore }; config.LeagueExchanges.Add(exchange); } var taskList = ConfigTaskMgr.GetAll(); var taskList2 = ConfigTaskrequireMgr.GetAll(); var giftItems = DicGiftpackprizeMgr.GetAll(); foreach (var entity in taskList2) { var task = taskList.Find(d => d.Idx == entity.TaskId); if (!string.IsNullOrEmpty(task.RequireFuncs)) { task.RequireFuncs += ","; } task.RequireFuncs += entity.RequireType; } config.Tasks = new List <TaskDescriptionEntity>(taskList.Count); foreach (var entity in taskList) { config.Tasks.Add(new TaskDescriptionEntity() { Idx = entity.Idx, Name = entity.Name, Level = entity.ManagerLevel, Description = entity.Tip, PrizeCoin = entity.PrizeCoin, PrizeExp = entity.PrizeExp, PrizeItemCode = entity.PrizeItemCode, PrizeItems = GetGiftItems(giftItems, entity.PrizeItemCode), RequireFuncs = entity.RequireFuncs, TaskType = entity.TaskType, Times = entity.Times, NpcIdx = entity.NpcIdx }); } config.Turntable = new List <ConfigTurntableprizeEntity>(); var allturntable = ConfigTurntableprizeMgr.GetAll(); config.Turntable = allturntable; return(config); }