示例#1
0
        private void AddWinnerToRankList(Winner winner)
        {
            if (this.rankList.Count < RankListCapacity)
            {
                this.rankList.Add(winner);
            }
            else
            {
                for (int i = 0; i < this.rankList.Count; i++)
                {
                    if (this.rankList[i].Points < winner.Points)
                    {
                        this.rankList.Insert(i, winner);
                        this.rankList.RemoveAt(this.rankList.Count - 1);
                        break;
                    }
                }
            }

            this.rankList.Sort((Winner w1, Winner w2) => w2.Name.CompareTo(w1.Name));
            this.rankList.Sort((Winner w1, Winner w2) => w2.Points.CompareTo(w1.Points));
        }
示例#2
0
        private void AddWinnerToRankList(Winner winner)
        {
            if (this.rankList.Count < RankListCapacity)
            {
                this.rankList.Add(winner);
            }
            else
            {
                for (int i = 0; i < this.rankList.Count; i++)
                {
                    if (this.rankList[i].Points < winner.Points)
                    {
                        this.rankList.Insert(i, winner);
                        this.rankList.RemoveAt(this.rankList.Count - 1);
                        break;
                    }
                }
            }

            this.rankList.Sort((Winner w1, Winner w2) => w2.Name.CompareTo(w1.Name));
            this.rankList.Sort((Winner w1, Winner w2) => w2.Points.CompareTo(w1.Points));
        }
示例#3
0
        private void GetWinnerInformation(int pointsCount)
        {
            this.consoleWriter.ShowMessage("Enter your nickname: ");
            string nickname = this.consoleReader.ReadCommand();

            Winner winner = new Winner(nickname, pointsCount);
            this.AddWinnerToRankList(winner);
        }