void InitCache() { LogHelper.Insert("Equipment cache init start", LogType.Info); var list = DicEquipmentMgr.GetAllForCache(); var list2 = ConfigEquipmentplusMgr.GetAll(); //var list3 = ConfigEquipmentsynthesizeMgr.GetAll(); //var list4 = DicEquipmentsuitMgr.GetAllForCache(); _equipmentDic = list.ToDictionary(d => d.Idx, d => d); _equipmentQuarityDic = new Dictionary <int, List <DicEquipmentEntity> >(list2.Count); foreach (var entity in list) { if (!_equipmentQuarityDic.ContainsKey(entity.Quality)) { _equipmentQuarityDic.Add(entity.Quality, new List <DicEquipmentEntity>()); } _equipmentQuarityDic[entity.Quality].Add(entity); } _equipmentPlusDic = list2.ToDictionary(d => d.Quality, d => d); //_equipmentSynthesizeDic = list3.ToDictionary(d => d.Quarity, d => d); //_equipmentsuitDic = list4.ToDictionary(d => d.Idx, d => d); var propertyType = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.EquipmentPropertyTypeRange); var ss = propertyType.Split(','); _propertyTypeMin = ConvertHelper.ConvertToInt(ss[0]); _propertyTypeMax = ConvertHelper.ConvertToInt(ss[1]); LogHelper.Insert("Equipment cache init end", LogType.Info); }
void BuildCache() { if (_init) { return; } _connection = ConfigurationManager.ConnectionStrings["Games.NBall.Dal.Properties.Settings.NB_ConfigConnectionString"].ConnectionString; _formationList = CacheFactory.FormationCache.GetFormationList(); _playerList = DicPlayerMgr.GetAllForCache(); _equipmentList = DicEquipmentMgr.GetAllForCache(); var suitList = DicEquipmentsuitMgr.GetAllForCache(); // _skillList = DicSkillcardMgr.GetAll(); var willList = DicManagerwillMgr.GetAll(); _willPlayerDic = new Dictionary <string, List <int> >(); _willStrengthDic = new Dictionary <string, int>(); foreach (var entity in willList) { if (entity.DriveFlag == (int)EnumSkillDriveType.Active) { var ss = entity.PartMap.TrimEnd(',').Split(','); _willStrengthDic.Add(entity.SkillCode, 0); _willPlayerDic.Add(entity.SkillCode, new List <int>()); foreach (var s in ss) { var pp = s.Split('+'); var pid = Convert.ToInt32(pp[0]); var stren = Convert.ToInt32(pp[1]); if (_willStrengthDic[entity.SkillCode] < stren) { _willStrengthDic[entity.SkillCode] = stren; } _willPlayerDic[entity.SkillCode].Add(pid); } } } _suitDic = new Dictionary <int, List <int> >(); foreach (var entity in suitList) { if (!_suitDic.ContainsKey(entity.SuitType)) { _suitDic.Add(entity.SuitType, new List <int>()); } _suitDic[entity.SuitType].Add(entity.Idx); } //_positionPropertyDic = new Dictionary<int, List<int>>(); //_positionPropertyDic.Add((int)EnumPosition.Forward,new List<int>(){(int)EnumProperty.Speed,(int)EnumProperty.Shoot,(int)EnumProperty.FreeKick}); //_positionPropertyDic.Add((int)EnumPosition.Midfielder, new List<int>() { (int)EnumProperty.Dribble, (int)EnumProperty.Pass, (int)EnumProperty.Mentality }); //_positionPropertyDic.Add((int)EnumPosition.Fullback, new List<int>() { (int)EnumProperty.Aggression, (int)EnumProperty.Disturb, (int)EnumProperty.Interception }); //_positionPropertyDic.Add((int)EnumPosition.Goalkeeper, new List<int>() { (int)EnumProperty.HandControl, (int)EnumProperty.Response, (int)EnumProperty.Positioning }); _positionSkillDic = new Dictionary <int, List <int> >(); _positionSkillDic.Add((int)EnumPosition.Forward, new List <int>() { (int)EnumSKillActType.Shoot }); _positionSkillDic.Add((int)EnumPosition.Midfielder, new List <int>() { (int)EnumSKillActType.Through, (int)EnumSKillActType.Organize }); _positionSkillDic.Add((int)EnumPosition.Fullback, new List <int>() { (int)EnumSKillActType.Defence }); _positionSkillDic.Add((int)EnumPosition.Goalkeeper, new List <int>() { (int)EnumSKillActType.GoalKeep }); _init = true; var allPlayer = DicPlayerMgr.GetAllForCache(); _playerDic = new Dictionary <string, List <int> >(); foreach (var item in allPlayer) { if (item.CardLevel == 6 || item.CardLevel == 5) { continue; } if (!_playerDic.ContainsKey(item.PositionDesc)) { _playerDic.Add(item.PositionDesc, new List <int>()); } _playerDic[item.PositionDesc].Add(item.Idx); } }