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); } }
public static ItemTipsEntity ExportItemTips() { var itemList = DicItemMgr.GetAll(); var playerList = DicPlayerMgr.GetAll(); var equipmentList = DicEquipmentMgr.GetAll(); var mallList = DicMallitemMgr.GetAll().FindAll(d => d.MallType != 5); var ballList = DicBallsoulMgr.GetAll(); var willList = DicManagerwillMgr.GetAll(); var starskillList = DicStarskillsMgr.GetAll(); ItemTipsEntity itemTips = new ItemTipsEntity(); itemTips.PlayerCard = new List <PlayerCardDescriptionEntity>(playerList.Count); itemTips.Equipment = new List <EquipmentDescriptionEntity>(equipmentList.Count); itemTips.Ballsoul = new List <BallsoulDescriptionEntity>(0); itemTips.MallItem = new List <MallItemDescriptionEntity>(mallList.Count); foreach (var itemEntity in itemList) { switch (itemEntity.ItemType) { case (int)EnumItemType.PlayerCard: var playerd = BuildPlayerCardDescription(itemEntity, playerList.Find(d => d.Idx == itemEntity.LinkId)); var star = starskillList.FindAll(d => d.PlayerId == playerd.PlayerId); if (star.Count > 0) { playerd.Starskill = ""; playerd.StarskillCode = ""; foreach (var entity in star) { playerd.Starskill += entity.Name + ","; playerd.StarskillCode += entity.SkillCode + ","; } playerd.Starskill = playerd.Starskill.TrimEnd(','); playerd.StarskillCode = playerd.StarskillCode.TrimEnd(','); } var wills = willList.FindAll(d => d.DriveFlag == 1 && d.PartMap.Contains(playerd.PlayerId.ToString())); if (wills != null && wills.Count > 0) { foreach (var entity in wills) { playerd.CombSkill = entity.SkillName + ","; } playerd.CombSkill = playerd.CombSkill.TrimEnd(','); } itemTips.PlayerCard.Add(playerd); break; case (int)EnumItemType.Equipment: var equipd = BuildEquipmentDescription(itemEntity, equipmentList.Find(d => d.Idx == itemEntity.LinkId)); itemTips.Equipment.Add(equipd); break; case (int)EnumItemType.MallItem: var malld = BuildMallDescription(itemEntity, mallList.Find(d => d.MallCode == itemEntity.LinkId)); itemTips.MallItem.Add(malld); break; } } return(itemTips); }