示例#1
0
        private void GameOver(object sender, GameOverEventArgs e)
        {
            if (scoresList.Count == 0 || e.Scores > scoresList[scoresList.Count - 1].Item2 || scoresList.Count < 10)
            {
                Action <string, int> addPoints = new Action <string, int>(AddPointsToList);

                int position = 1;
                foreach (var item in scoresList)
                {
                    if (e.Scores >= item.Item2)
                    {
                        break;
                    }
                    else
                    {
                        position++;
                    }
                }

                addScores = new AddNamePanel(addPoints, e.Scores, position);
                this.Controls.Add(addScores);
                addScores.BringToFront();
                this.Refresh();
            }
        }
示例#2
0
        private void AddPointsToList(string name, int points)
        {
            scoresList.Add(new Tuple <string, int>(name, points));
            scoresList.OrderBy(a => a.Item2);
            if (scoresList.Count > 10)
            {
                scoresList.RemoveAt(10);
            }

            SavePoints();
            Controls.Remove(addScores);
            addScores = null;
        }