public MessageCode GetMatchMarqueeJob()
 {
     try
     {
         _matchMarqueeResponse = ResponseHelper.CreateSuccess<LadderMatchMarqueeResponse>();
         _matchMarqueeResponse.Data = new LadderMatchMarqueeData();
         _matchMarqueeResponse.Data.Matchs = CrossladderMatchMgr.GetMatchTop10(_domainId);
         return MessageCode.Success;
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("GetMatchMarqueeJob", ex);
         return MessageCode.Exception;
     }
 }
Exemplo n.º 2
0
        public CrossladderMatchResponse GetMatch(Guid managerId, Guid matchId)
        {
            var match = MemcachedFactory.LadderMatchClient.Get <CrossladderMatchEntity>(matchId);

            if (match == null)
            {
                match = CrossladderMatchMgr.GetById(matchId);
                if (match == null)
                {
                    return(ResponseHelper.InvalidParameter <CrossladderMatchResponse>());
                }
            }
            var response = ResponseHelper.CreateSuccess <CrossladderMatchResponse>();

            response.Data = match;
            return(response);
        }
Exemplo n.º 3
0
        public LadderMatchEntityListResponse GetMatchList(Guid managerId)
        {
            var response = ResponseHelper.CreateSuccess <LadderMatchEntityListResponse>();

            response.Data = new LadderMatchEntityList();
            var list = CrossladderMatchMgr.GetFiveMatch(managerId);

            if (list != null)
            {
                response.Data.Matchs = new List <LadderMatchEntityView>(list.Count);
                foreach (var match in list)
                {
                    string      awayName = "";
                    EnumWinType winType;    //0:负; 1:胜;2:平
                    int         prizeScore;
                    string      score = ""; //比分 2:3
                    if (managerId == match.HomeId && match.HomeIsBot == false)
                    {
                        awayName   = match.AwayName;
                        prizeScore = match.PrizeHomeScore;
                        score      = string.Format("{0}:{1}", match.HomeScore, match.AwayScore);
                        winType    = ShareUtil.CalWinType(match.HomeScore, match.AwayScore);
                    }
                    else
                    {
                        if (match.AwayIsBot)
                        {
                            continue;
                        }
                        awayName   = match.HomeName;
                        prizeScore = match.PrizeAwayScore;
                        score      = string.Format("{0}:{1}", match.AwayScore, match.HomeScore);
                        winType    = ShareUtil.CalWinType(match.AwayScore, match.HomeScore);
                    }
                    response.Data.Matchs.Add(BuildMatchView(match.Idx, awayName, prizeScore, score, winType));
                }
            }
            return(response);
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="matchData"></param>
        /// <param name="laddermatch"></param>
        void Fight(BaseMatchData matchData, CrossladderMatchEntity laddermatch)
        {
            if (laddermatch.HomeIsBot && laddermatch.AwayIsBot)
            {
                laddermatch.HomeScore = 0;
                laddermatch.AwayScore = 0;
                laddermatch.Status    = (int)EnumLadderStatus.End;

                //保存比赛
                CrossladderMatchMgr.Insert(laddermatch);
                return;
            }
            else
            {
                try
                {
                    MatchCore.CreateMatch(matchData);

                    if (matchData.ErrorCode == (int)MessageCode.Success)
                    {
                        laddermatch.HomeScore = matchData.Home.Score;
                        laddermatch.AwayScore = matchData.Away.Score;
                        laddermatch.Status    = (int)EnumLadderStatus.End;
                        CalPrizePoint(laddermatch);

                        int returnCode = -1;
                        //保存比赛
                        CrossladderMatchMgr.SaveMatch(laddermatch.DomainId, laddermatch.LadderId, laddermatch.HomeId, laddermatch.AwayId, laddermatch.HomeName, laddermatch.AwayName,
                                                      laddermatch.HomeLogo, laddermatch.AwayLogo,
                                                      laddermatch.HomeSiteId, laddermatch.AwaySiteId,
                                                      laddermatch.HomeLadderScore, laddermatch.AwayLadderScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeCoin, laddermatch.AwayCoin, laddermatch.HomeExp, laddermatch.AwayExp,
                                                      laddermatch.HomeIsBot, laddermatch.AwayIsBot, laddermatch.GroupIndex, laddermatch.PrizeHomeScore, laddermatch.PrizeAwayScore,
                                                      laddermatch.RowTime, laddermatch.Idx, ref returnCode);

                        if (!laddermatch.HomeIsBot)
                        {
                            WebServerHandler.AddManagerData(laddermatch.HomeId, laddermatch.HomeExp, laddermatch.HomeCoin, 0, laddermatch.HomeSiteId);
                            MatchCore.SaveMatchStat(laddermatch.HomeId, EnumMatchType.CrossLadder, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.HomeSiteId);
                            if (laddermatch.HomeIsHook)
                            {
                                CrossLadderManager.Instance.UpdateHookScore(laddermatch.HomeSiteId, laddermatch.HomeId, laddermatch.PrizeHomeScore,
                                                                            laddermatch.HomeScore > laddermatch.AwayScore, laddermatch.HomeScore,
                                                                            laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName,
                                                                            laddermatch.HomeCoin);
                            }
                        }
                        if (!laddermatch.AwayIsBot)
                        {
                            WebServerHandler.AddManagerData(laddermatch.AwayId, laddermatch.AwayExp, laddermatch.AwayCoin, 0, laddermatch.AwaySiteId);
                            MatchCore.SaveMatchStat(laddermatch.AwayId, EnumMatchType.CrossLadder, laddermatch.AwayScore, laddermatch.HomeScore, laddermatch.AwayScore, laddermatch.AwaySiteId);
                            if (laddermatch.AwayIsHook)
                            {
                                CrossLadderManager.Instance.UpdateHookScore(laddermatch.AwaySiteId, laddermatch.AwayId, laddermatch.PrizeAwayScore,
                                                                            laddermatch.AwayScore < laddermatch.HomeScore, laddermatch.HomeScore,
                                                                            laddermatch.AwayScore, laddermatch.HomeName, laddermatch.AwayName,
                                                                            laddermatch.AwayCoin);
                            }
                        }
                    }
                    MemcachedFactory.LadderMatchClient.Set(laddermatch.Idx, laddermatch);
                }
                catch (Exception ex)
                {
                    SystemlogMgr.Error("CrossLadderProcess-Fight", ex);
                }
            }
            matchData   = null;
            laddermatch = null;
        }