Exemple #1
0
        public Match_FightinfoResponse GetLeagueFightInfo(Guid matchId, Guid managerId)
        {
            LeagueEncounterEntity matchInfo = LeagueEncounterMgr.GetById(matchId);

            DicNpcEntity homeNpc = null;
            DicNpcEntity awayNpc = null;

            if (matchInfo.HomeIsNpc)
            {
                homeNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.HomeId);
            }
            if (matchInfo.AwayIsNpc)
            {
                awayNpc = CacheFactory.NpcdicCache.GetNpc(matchInfo.AwayId);
            }

            DTOBuffMemberView homeView, awayView;

            BuffDataCore.Instance().GetMembers(out homeView, out awayView,
                                               "", matchInfo.HomeId, matchInfo.HomeIsNpc, "", matchInfo.AwayId, matchInfo.AwayIsNpc, true, false);

            Match_FightManagerinfo home, away;

            if (matchInfo.HomeIsNpc)
            {
                home = MatchDataHelper.GetFightinfo(homeNpc, homeView);
            }
            else
            {
                home = MatchDataHelper.GetFightinfo(matchInfo.HomeId, false, homeView, "");
            }
            if (matchInfo.AwayIsNpc)
            {
                away = MatchDataHelper.GetFightinfo(awayNpc, awayView);
            }
            else
            {
                away = MatchDataHelper.GetFightinfo(matchInfo.AwayId, false, awayView, "");
            }
            if (home == null || away == null)
            {
                return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError));
            }

            var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>();

            response.Data      = new Match_Fightinfo();
            response.Data.Home = home;
            response.Data.Away = away;
            return(response);
        }
Exemple #2
0
        void InitCache()
        {
            try
            {
                LogHelper.Insert("npc dic cache init start", LogType.Info);
                List <DicNpcEntity> list = null;
                if (ShareUtil.IsCross)
                {
                    list = DicNpcMgr.GetAllForCross();
                }
                else
                {
                    list = DicNpcMgr.GetAll();
                }
                _dicNpc              = new Dictionary <Guid, DicNpcEntity>();
                _transferManagerDic  = new Dictionary <Guid, ManagerInput>(list.Count);
                _fightManagerinfoDic = new Dictionary <Guid, Match_FightManagerinfo>(list.Count);
                _dicBuffView         = new Dictionary <Guid, DTOBuffMemberView>(list.Count);
                foreach (var entity in list)
                {
                    var buffView = NpcDataHelper.GetMemberView(entity);
                    _dicNpc.Add(entity.Idx, entity);
                    _dicBuffView.Add(entity.Idx, buffView);
                    _transferManagerDic.Add(entity.Idx, MatchTransferUtil.BuildTransferNpc(entity, buffView));
                    _fightManagerinfoDic.Add(entity.Idx, MatchDataHelper.GetFightinfo(entity, buffView, true));
                }

                _guidePlayers = new List <PlayerInput>();
                var guideConfig = CacheFactory.AppsettingCache.GetAppSetting(EnumAppsetting.TourGuidePlayers);
                var ssss        = guideConfig.Split('|');
                foreach (var ss in ssss)
                {
                    var s = ss.Split(',');
                    _guidePlayers.Add(MatchTransferUtil.BuildPlayerInputForGuide(Convert.ToInt32(s[0]), Convert.ToInt32(s[1]), s[2]));
                }
                LogHelper.Insert("npc dic cache init end", LogType.Info);
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
            }
        }
Exemple #3
0
        public Match_FightinfoResponse GetFightInfoWithoutNpc(Guid managerId, Guid awayId, bool isHomeBot, bool isAwayBot, bool syncAwayFlag = false, string homeSiteId = "", string awaySiteId = "")
        {
            DTOBuffMemberView homeView, awayView;

            BuffDataCore.Instance().GetMembers(out homeView, out awayView,
                                               homeSiteId, managerId, false, awaySiteId, awayId, false, true, syncAwayFlag);
            Match_FightManagerinfo home = MatchDataHelper.GetFightinfo(managerId, isHomeBot, homeView, homeSiteId);
            Match_FightManagerinfo away = MatchDataHelper.GetFightinfo(awayId, isAwayBot, awayView, awaySiteId);

            if (home == null || away == null)
            {
                return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError));
            }

            var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>();

            response.Data      = new Match_Fightinfo();
            response.Data.Home = home;
            response.Data.Away = away;
            return(response);
        }
Exemple #4
0
        //public Match_FightinfoResponse GetCrowdFightInfo(Guid matchId, Guid managerId)
        //{
        //    var match = MemcachedFactory.CrowdMatchClient.Get<CrowdMatchEntity>(matchId);
        //    if (match == null)
        //        return ResponseHelper.InvalidParameter<Match_FightinfoResponse>();
        //    if (managerId == match.HomeId)
        //    {
        //        return GetFightInfo(managerId, match.AwayId);
        //    }
        //    else if (managerId == match.AwayId)
        //    {
        //        return GetFightInfo(managerId, match.HomeId);
        //    }
        //    else
        //    {
        //        return ResponseHelper.InvalidParameter<Match_FightinfoResponse>();
        //    }
        //}

        /// <summary>
        /// 获取竞技场对阵
        /// </summary>
        /// <param name="matchId"></param>
        /// <returns></returns>
        public Match_FightinfoResponse GetArenaFightInfo(Guid matchId)
        {
            var matchData = MemcachedFactory.ArenaMatchClient.Get <BaseMatchData>(matchId);

            if (matchData == null)
            {
                return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError));
            }
            DicNpcEntity         homeNpc   = null;
            DicNpcEntity         awayNpc   = null;
            ArenaTeammemberFrame homeFrame = null;
            ArenaTeammemberFrame awayFrame = null;

            if (matchData.Home.IsNpc)
            {
                homeNpc = CacheFactory.NpcdicCache.GetNpc(matchData.Home.ManagerId);
            }
            else
            {
                homeFrame = new ArenaTeammemberFrame(matchData.Home.ManagerId, (EnumArenaType)matchData.Home.ArenaType, matchData.Home.ZoneName);
            }
            if (matchData.Away.IsNpc)
            {
                awayNpc = CacheFactory.NpcdicCache.GetNpc(matchData.Away.ManagerId);
            }
            else
            {
                awayFrame = new ArenaTeammemberFrame(matchData.Away.ManagerId, (EnumArenaType)matchData.Away.ArenaType, matchData.Away.ZoneName);
            }

            DTOBuffMemberView homeView, awayView;

            ArenaBuffDataCore.Instance().GetMembers(out homeView, out awayView, matchData.Home.ZoneName, matchData.Home.ManagerId,
                                                    matchData.Home.IsNpc, matchData.Away.ZoneName, matchData.Away.ManagerId, homeFrame, awayFrame,
                                                    matchData.Away.IsNpc, true, false);

            Match_FightManagerinfo home, away;

            if (matchData.Home.IsNpc)
            {
                home = MatchDataHelper.GetFightinfo(homeNpc, homeView);
            }
            else
            {
                home = MatchDataHelper.GetFightinfoArena(homeFrame, false, homeView, matchData.Home.ZoneName);
            }
            if (matchData.Away.IsNpc)
            {
                away = MatchDataHelper.GetFightinfo(awayNpc, awayView);
            }
            else
            {
                away = MatchDataHelper.GetFightinfoArena(awayFrame, false, awayView, matchData.Away.ZoneName);
            }
            if (home == null || away == null)
            {
                return(ResponseHelper.Create <Match_FightinfoResponse>(MessageCode.NbParameterError));
            }
            var response = ResponseHelper.CreateSuccess <Match_FightinfoResponse>();

            response.Data      = new Match_Fightinfo();
            response.Data.Home = home;
            response.Data.Away = away;
            return(response);
        }