/// <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); }
/// <summary> /// 获取对阵 /// </summary> /// <param name="round"></param> /// <returns></returns> public List <LeagueFight> GetFightMap(int round) { if (_leagueFightMapEntity != null) { if (FightMap == null || FightMap.Count == 0) { AnalyseFightMap(); } if (FightMap == null) { return(new List <LeagueFight>()); } if (FightMap.ContainsKey(round)) { return(FightMap[round]); } } return(new List <LeagueFight>()); }
/// <summary> /// 获取我的对阵 /// </summary> /// <param name="round"></param> /// <returns></returns> public LeagueFight GetMyFightMap(int round) { if (_leagueFightMapEntity != null) { if (FightMap == null || FightMap.Count == 0) { AnalyseFightMap(); } if (FightMap == null) { return(null); } if (FightMap.ContainsKey(round)) { var allFightMap = FightMap[round]; if (allFightMap != null && allFightMap.Count > 0) { return(allFightMap.Find(r => r.H == 0 || r.A == 0)); } } } return(null); }