private ManagerSkillCache() { try { s_dicTalent.Clear(); s_dicTalentStep.Clear(); s_dicTalentPoint.Clear(); s_dicWill.Clear(); s_dicCombIndex.Clear(); s_dicClubSkill.Clear(); s_dicAntiTalents.Clear(); s_dicAntiTalents[204] = "MT204"; s_dicAntiTalents[302] = "MT302"; s_dicAntiTalents[403] = "MT403"; var talents = DicManagertalentMgr.GetAllForCache(); var wills = DicManagerwillMgr.GetAllForCache(); foreach (var item in talents) { s_dicTalent[item.SkillCode] = item; if (!s_dicTalentStep.ContainsKey(item.StepNo)) { s_dicTalentStep[item.StepNo] = new List <string>(); } s_dicTalentStep[item.StepNo].Add(item.SkillCode); if (!s_dicTalentPoint.ContainsKey(item.ReqManagerLevel)) { s_dicTalentPoint[item.ReqManagerLevel] = s_dicTalentPoint.Count + 1; } } string[] arr; Dictionary <int, int> dic = null; int cnt = 0; int pid = 0; int cntLow = 0; int cntHigh = 0; foreach (var item in wills) { dic = new Dictionary <int, int>(); arr = item.PartMap.Trim(SPLITWillPid).Split(SPLITWillPid, SPLITWillStrength); for (int i = 0; i < arr.Length / 2; i++) { dic[Convert.ToInt32(arr[2 * i])] = Convert.ToInt32(arr[2 * i + 1]); } item.DicPid = dic; s_dicWill[item.SkillCode] = item; if (item.WillRank > 1) { cntHigh++; } else { cntLow++; } if (string.IsNullOrEmpty(item.CombSkillCode)) { continue; } cnt = dic.Count; foreach (var kvp in dic) { pid = CastPlayerId(kvp.Key); if (!s_dicCombIndex.ContainsKey(pid)) { s_dicCombIndex[pid] = new Dictionary <string, int>(); } s_dicCombIndex[pid][item.CombSkillCode] = cnt; } } _willItemcodes.Clear(); var list = DicManagerwillparttipsMgr.GetWillItemcodes(); foreach (var data in list) { if (!_willItemcodes.ContainsKey(data.ItemCode)) { _willItemcodes.Add(data.ItemCode, 1); _willCodeList.Add(data.ItemCode); } } this.CountHighWill = cntHigh; this.CountLowWill = cntLow; var clubSkills = DicClubskillMgr.GetAll(); foreach (var item in clubSkills) { s_dicClubSkill[item.SkillKey] = item; } this.InitFlag = true; } catch (Exception ex) { LogHelper.Insert(ex, "ManagerSkillCache:Init"); this.InitFlag = false; } }
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); }