示例#1
0
        private void InitCache()
        {
            _markDic        = new Dictionary <int, List <ConfigLeaguemarkEntity> >();
            _npcDic         = new Dictionary <int, List <int> >();
            _npcGuidDic     = new Dictionary <int, Guid>();
            _leaguePrizeDic = new Dictionary <string, List <ConfigLeagueprizeEntity> >();
            _leagueDic      = new Dictionary <int, ConfigLeagueEntity>();
            var allMark = ConfigLeaguemarkMgr.GetAll();

            _leagueTeamCount = new Dictionary <int, int>();
            _leagueStarDic   = new Dictionary <int, List <ConfigLeaguestarEntity> >();
            foreach (var item in allMark)
            {
                if (!_markDic.ContainsKey(item.LeagueId))
                {
                    _markDic.Add(item.LeagueId, new List <ConfigLeaguemarkEntity>());
                }
                _markDic[item.LeagueId].Add(item);
                if (!_npcDic.ContainsKey(item.LeagueId))
                {
                    _npcDic.Add(item.LeagueId, new List <int>());
                }
                _npcDic[item.LeagueId].Add(item.TeamId);

                var key = NpcKey(item.LeagueId, item.TeamId);
                if (!_npcGuidDic.ContainsKey(key))
                {
                    _npcGuidDic.Add(key, item.Idx);
                }
                else
                {
                    _npcGuidDic[key] = item.Idx;
                }
            }
            foreach (var dicItem in _markDic)
            {
                _leagueTeamCount.Add(dicItem.Key, dicItem.Value.Count);
            }

            var allPrize = ConfigLeagueprizeMgr.GetAll();

            foreach (var prize in allPrize)
            {
                string key = BuildPrizeKey(prize.LeagueID, prize.ResultType);
                if (!_leaguePrizeDic.ContainsKey(key))
                {
                    _leaguePrizeDic.Add(key, new List <ConfigLeagueprizeEntity>());
                }
                _leaguePrizeDic[key].Add(prize);
            }

            var leagueConfig = ConfigLeagueMgr.GetAll();

            _leagueDic = leagueConfig.ToDictionary(d => d.LeagueID, d => d);

            var list = DicLeagueexchangeMgr.GetAll();

            _exchangeTypeDic = new Dictionary <int, List <string> >();
            _exchangeDic     = new Dictionary <string, DicLeagueexchangeEntity>();
            foreach (var entity in list)
            {
                if (!_exchangeTypeDic.ContainsKey(entity.Type))
                {
                    _exchangeTypeDic.Add(entity.Type, new List <string>());
                }

                var exkeylist = BuildExchangeKey(entity);
                _exchangeTypeDic[entity.Type].AddRange(exkeylist);
                foreach (var exkey in exkeylist)
                {
                    _exchangeDic.Add(exkey, entity);
                }
            }

            _leagueWincountPrizeDic = new Dictionary <string, ConfigLeaguewincountprizeEntity>();
            _leagueWincounDic       = new Dictionary <int, List <int> >();
            var listWinCount = ConfigLeaguewincountprizeMgr.GetAll();

            foreach (var winEntity in listWinCount)
            {
                if (!_leagueWincounDic.ContainsKey(winEntity.LeagueId))
                {
                    _leagueWincounDic.Add(winEntity.LeagueId, new List <int>());
                }
                _leagueWincounDic[winEntity.LeagueId].Add(winEntity.WinCount);

                var key = BuildWincountPrizeKey(winEntity.LeagueId, winEntity.WinCount);
                if (!_leagueWincountPrizeDic.ContainsKey(key))
                {
                    _leagueWincountPrizeDic.Add(key, winEntity);
                }
                else
                {
                    _leagueWincountPrizeDic[key] = winEntity;
                }
            }
            //_leagueFightMapDic= ConfigLeaguefightmapMgr.GetAllForCache();
            _leagueFightMapDic          = new Dictionary <int, List <ConfigLeaguefightmapEntity> >();
            _leagueFightMapTeamplateDic = new Dictionary <int, List <ConfigLeaguefightmapEntity> >();
            var allfightMap = ConfigLeaguefightmapMgr.GetAll();

            foreach (var item in allfightMap)
            {
                if (!_leagueFightMapDic.ContainsKey(item.TeamCount))
                {
                    _leagueFightMapDic.Add(item.TeamCount, new List <ConfigLeaguefightmapEntity>());
                }
                _leagueFightMapDic[item.TeamCount].Add(item);
                var key = TemplateKey(item.TemplateId, item.RoundIndex);
                if (!_leagueFightMapTeamplateDic.ContainsKey(key))
                {
                    _leagueFightMapTeamplateDic.Add(key, new List <ConfigLeaguefightmapEntity>());
                }
                _leagueFightMapTeamplateDic[key].Add(item);
            }

            var allStar = ConfigLeaguestarMgr.GetAll();

            foreach (var item in allStar)
            {
                if (!_leagueStarDic.ContainsKey(item.LeagueId))
                {
                    _leagueStarDic.Add(item.LeagueId, new List <ConfigLeaguestarEntity>());
                }
                _leagueStarDic[item.LeagueId].Add(item);
            }

            var allGoalsMap = ConfigLeaguegoalsMgr.GetAll();

            _leagueGoalsMap = new Dictionary <int, List <ConfigLeaguegoalsEntity> >();
            foreach (var item in allGoalsMap)
            {
                if (!_leagueGoalsMap.ContainsKey(item.TemplateId))
                {
                    _leagueGoalsMap.Add(item.TemplateId, new List <ConfigLeaguegoalsEntity>());
                }
                _leagueGoalsMap[item.TemplateId].Add(item);
            }
        }
示例#2
0
        public static DescriptionConfigEntity1 ExportDescriptionDic1()
        {
            var config       = new DescriptionConfigEntity1();
            var allLeagueNpc = ConfigLeaguemarkMgr.GetAll();

            config.LeagueNpc = new Dictionary <int, List <LeagueNpc> >();
            foreach (var item in allLeagueNpc)
            {
                LeagueNpc entity = new LeagueNpc();
                if (!config.LeagueNpc.ContainsKey(item.LeagueId))
                {
                    config.LeagueNpc.Add(item.LeagueId, new List <LeagueNpc>());
                }
                entity.LeagueId = item.LeagueId;
                entity.Logo     = item.TeamId + "";
                entity.Name     = item.TeamName;
                entity.TeamId   = item.TeamId;
                config.LeagueNpc[item.LeagueId].Add(entity);
            }

            config.LeagueStar = new Dictionary <int, List <ConfigLeaguestarEntity> >();
            var allStarPrize = ConfigLeaguestarMgr.GetAll();

            foreach (var item in allStarPrize)
            {
                if (!config.LeagueStar.ContainsKey(item.LeagueId))
                {
                    config.LeagueStar.Add(item.LeagueId, new List <ConfigLeaguestarEntity>());
                }
                config.LeagueStar[item.LeagueId].Add(item);
            }

            config.LeagueFightMap = new Dictionary <int, List <ConfigLeaguefightmapEntity> >();
            var allFightMap = ConfigLeaguefightmapMgr.GetAll();

            foreach (var item in allFightMap)
            {
                if (!config.LeagueFightMap.ContainsKey(item.TemplateId))
                {
                    config.LeagueFightMap.Add(item.TemplateId, new List <ConfigLeaguefightmapEntity>());
                }
                config.LeagueFightMap[item.TemplateId].Add(item);
            }
            config.RevelationList = new List <RevelationMarkEntity>();
            var allRevelation = ConfigRevelationMgr.GetAll();

            foreach (var item in allRevelation)
            {
                RevelationMarkEntity entity = new RevelationMarkEntity();
                entity.Describe          = item.Describe;
                entity.FirstPassItem     = item.FirstPassItem;
                entity.Formation         = item.Formation;
                entity.MarkId            = item.MarkId;
                entity.MarkPlayer        = item.MarkPlayer;
                entity.OpponentFormation = item.OpponentFormation;
                entity.OpponentTeamName  = item.OpponentTeamName;
                entity.PassPrizeItems    = item.PassPrizeItem;
                entity.Schedule          = item.Schedule;
                entity.Story             = item.Story;
                entity.TeamName          = item.TeamName;
                config.RevelationList.Add(entity);
            }

            var allCoach      = ConfigCoachinfoMgr.GetAll();
            var allCoachSkill = ConfigCoachskillMgr.GetAll();
            var allupgrade    = ConfigCoachupgradeMgr.GetAll();
            var allStar       = ConfigCoachstarMgr.GetAll();
            List <CoachInfoEntity> coachinfoList = new List <CoachInfoEntity>();

            foreach (var item in allCoach)
            {
                var             coachSkill = allCoachSkill.Find(r => r.CoachId == item.Idx);
                CoachInfoEntity info       = new CoachInfoEntity();
                info.Base0              = coachSkill.Base0.ToString();
                info.Base1              = coachSkill.Base1.ToString();
                info.BodyAttr           = item.BodyAttr;
                info.Cd                 = coachSkill.CD.ToString();
                info.CoachId            = item.Idx;
                info.DebrisCode         = item.DebrisCode;
                info.Defense            = item.Defense;
                info.Description        = coachSkill.Description;
                info.Goalkeeping        = item.Goalkeeping;
                info.IsSkill            = item.IsSkill;
                info.Name               = item.Name;
                info.Offensive          = item.Offensive;
                info.Organizational     = item.Organizational;
                info.Plus0              = coachSkill.Plus0.ToString();
                info.Plus1              = coachSkill.Plus1.ToString();
                info.PlusDescription    = coachSkill.PlusDescription;
                info.SkillId            = item.SkillId;
                info.SkillName          = coachSkill.SkillName;
                info.TimeOfDuration     = coachSkill.TimeOfDuration;
                info.TriggerCondition   = coachSkill.TriggerCondition;
                info.TriggerProbability = coachSkill.TriggerProbability;
                coachinfoList.Add(info);
            }
            config.CoachInfo = coachinfoList;

            List <CoachUpgradeEntity> coachUpgradeList = new List <CoachUpgradeEntity>();

            foreach (var item in allupgrade)
            {
                CoachUpgradeEntity entity = new CoachUpgradeEntity();
                entity.Level            = item.Level;
                entity.UpgradeExp       = item.UpgradeExp;
                entity.UpgradeSkillCoin = item.UpgradeSkillCoin;
                coachUpgradeList.Add(entity);
            }
            config.CoachUpgrade = coachUpgradeList;

            List <CoachStarEntity> coachStarList = new List <CoachStarEntity>();

            foreach (var item in allStar)
            {
                CoachStarEntity entity = new CoachStarEntity();
                entity.CoachId       = item.CoachId;
                entity.ConsumeDebris = item.ConsumeDebris;
                var info = allCoach.Find(r => r.Idx == item.CoachId);
                entity.CosumeDebrisCode = info.DebrisCode;
                entity.MaxSkillLevel    = item.MaxLevel;
                entity.StarLevel        = item.StarLevel;
                coachStarList.Add(entity);
            }
            config.CoachStar = coachStarList;

            return(config);
        }