Example #1
0
        /// <summary>
        /// 设置对阵信息
        /// </summary>
        /// <param name="round"></param>
        /// <param name="homeId"></param>
        /// <param name="awayId"></param>
        /// <param name="homeGoals"></param>
        /// <param name="awayGoals"></param>
        /// <returns></returns>
        public MessageCode SetFightMap(int round, int homeId, int awayId, int homeGoals, int awayGoals)
        {
            if (_leagueFightMapEntity == null)
            {
                return(MessageCode.NbParameterError);
            }
            if (FightMap == null || FightMap.Count == 0)
            {
                AnalyseFightMap();
            }
            if (FightMap == null)
            {
                FightMap = new Dictionary <int, List <LeagueFight> >();
            }
            if (!FightMap.ContainsKey(round))
            {
                FightMap.Add(round, new List <LeagueFight>());
            }
            var entity = new LeagueFight();

            entity.H  = homeId;
            entity.A  = awayId;
            entity.AG = awayGoals;
            entity.HG = homeGoals;
            entity.R  = round;
            if (!FightMap[round].Exists(r => r.H == homeId))
            {
                FightMap[round].Add(entity);
            }
            return(MessageCode.Success);
        }