Beispiel #1
0
        /// <summary>
        /// Runs the arena match.
        /// </summary>
        void RunMatch()
        {
            if (_fightDic == null)
            {
                return;
            }
            foreach (var item in _fightDic.Values)
            {
                var matchHome = new MatchManagerInfo(item.HomeId, item.HomeSiteId, false, item.HomeIsBot);
                var matchAway = new MatchManagerInfo(item.AwayId, item.AwaySiteId, false, item.AwayIsBot);
                var matchData = new BaseMatchData((int)EnumMatchType.CrossLadder, item.Idx, matchHome, matchAway);
                matchData.ErrorCode = (int)MessageCode.MatchWait;

                MemcachedFactory.MatchClient.Set(matchData.MatchId, matchData);

                //使用多线程
                _nbThreadPool.Add(() => Fight(matchData, item));
            }

            _nbThreadPool.WaitAll();
            _ladderInfo.Groups  = _fightDic.Count;
            _ladderInfo.RowTime = DateTime.Now;

            _ladderInfo.Season     = CacheFactory.CrossLadderCache.GetCurrentSeasonIndex();
            _ladderInfo.Status     = 2;
            _ladderInfo.UpdateTime = DateTime.Now;

            _ladderInfo.FightList = null;
            _fightDic             = null;

            CrossladderInfoMgr.Insert(_ladderInfo);
            _ladderInfo = null;
        }
Beispiel #2
0
        /// <summary>
        /// Runs the arena match.
        /// </summary>
        void RunMatch()
        {
            if (_fightDic == null)
            {
                return;
            }
            foreach (var item in _fightDic.Values)
            {
                var matchHome = new MatchManagerInfo(item.HomeId, false, item.HomeIsBot);
                var matchAway = new MatchManagerInfo(item.AwayId, false, item.AwayIsBot);
                if (isGuide)//引导。 必胜
                {
                    matchHome.BuffScale = 200;
                    matchAway.BuffScale = 50;
                }
                var matchData = new BaseMatchData((int)EnumMatchType.Ladder, item.Idx, matchHome, matchAway);
                matchData.ErrorCode = (int)MessageCode.MatchWait;

                MemcachedFactory.MatchClient.Set(matchData.MatchId, matchData);

                //使用多线程
                _nbThreadPool.Add(() => Fight(matchData, item));
            }

            _nbThreadPool.WaitAll();
            _ladderInfo.Groups  = _fightDic.Count;
            _ladderInfo.RowTime = DateTime.Now;

            _ladderInfo.Season     = 1;
            _ladderInfo.Status     = 2;
            _ladderInfo.UpdateTime = DateTime.Now;

            _ladderInfo.FightList = null;
            _fightDic             = null;

            LadderInfoMgr.Insert(_ladderInfo);
            _ladderInfo = null;
        }