public List <PlayerJingJiMiniData> getChallengeData(int[] challengeRankings) { List <PlayerJingJiMiniData> miniDataList = new List <PlayerJingJiMiniData>(); lock (this.changeRankingLock) { if (challengeRankings.Length > 1 && challengeRankings[0] < 0) { int delta = Math.Min(this.rankingDatas.Count / 6, -challengeRankings[0]); if (delta <= 2) { return(miniDataList); } challengeRankings[0] = this.rankingDatas.Count - 1 - delta; challengeRankings[1] = this.rankingDatas.Count - 1 - delta * 2; challengeRankings[2] = this.rankingDatas.Count - 1 - delta * 3; } int nCheckCount = 0; while (nCheckCount++ < 6) { bool bErrorRank = false; foreach (int challengeRanking in challengeRankings) { PlayerJingJiData robotData = null; if (challengeRanking <= this.rankingDatas.Count) { PlayerJingJiRankingData rankingData = this.rankingDatas[challengeRanking - 1]; if (rankingData.ranking < 0) { bErrorRank = true; this.rankingDatas.Remove(rankingData); break; } } } if (!bErrorRank) { break; } this.rankingDatas.Sort(); } foreach (int challengeRanking in challengeRankings) { PlayerJingJiData robotData = null; if (challengeRanking <= this.rankingDatas.Count) { PlayerJingJiRankingData rankingData = this.rankingDatas[challengeRanking - 1]; if (this.playerJingJiDatas.TryGetValue(rankingData.roleId, out robotData)) { miniDataList.Add(robotData.getPlayerJingJiMiniData()); } } } } return(miniDataList); }
/// <summary> /// 获取被挑战者mini数据用于面板展示 /// </summary> /// <param name="challengeIds"></param> /// <returns></returns> public List <PlayerJingJiMiniData> getChallengeData(int[] challengeRankings) { List <PlayerJingJiMiniData> miniDataList = new List <PlayerJingJiMiniData>(); lock (changeRankingLock) { // 防止出现错误的排名 int nCheckCount = 0; while (nCheckCount++ < 6) { bool bErrorRank = false; foreach (int challengeRanking in challengeRankings) { PlayerJingJiData robotData = null; if (challengeRanking > rankingDatas.Count) { continue; } PlayerJingJiRankingData rankingData; rankingData = rankingDatas[challengeRanking - 1]; if (rankingData.ranking < 0) { bErrorRank = true; rankingDatas.Remove(rankingData); break; } } if (bErrorRank) { rankingDatas.Sort(); } else { break; } } foreach (int challengeRanking in challengeRankings) { PlayerJingJiData robotData = null; if (challengeRanking > rankingDatas.Count) { continue; } PlayerJingJiRankingData rankingData; rankingData = rankingDatas[challengeRanking - 1]; if (!playerJingJiDatas.TryGetValue(rankingData.roleId, out robotData)) { continue; } miniDataList.Add(robotData.getPlayerJingJiMiniData()); } } return(miniDataList); }