Пример #1
0
        private void updateScoreboard()
        {
            Action <int> add = count =>//function to get the player name and add a tuple to the scoreboard
            {
                Console.WriteLine("Enter Name:");
                string s = Console.ReadLine();
                Tuple <string, int> a = Tuple.Create <string, int>(s, count);
                scoreboard.Add(a);
            };

            if (scoreboard.Count < 5)
            {
                add(__st.cnt);
                return;
            }
            else
            {
                if (scoreboard.ElementAt <Tuple <string, int> >(4).Item2 >= __st.cnt)
                {
                    add(__st.cnt);
                    scoreboard.RemoveRange(4, 1);//if the new name replaces one of the old ones, remove the old one
                }
            }
            scoreboard.Sort(delegate(Tuple <string, int> p1, Tuple <string, int> p2)//re-sort the list
            {
                return(p1.Item2.CompareTo(p2.Item2));
            });
            __st = new baloonsState();
        }
Пример #2
0
        public GameState()
        {
            __st = new baloonsState();



            scoreboard = new List <Tuple <string, int> >();
        }
Пример #3
0
        private void updateScoreboard()
        {
            Action<int> add = count =>//function to get the player name and add a tuple to the scoreboard
            {
                Console.WriteLine("Enter Name:");
                string s = Console.ReadLine();
                Tuple<string, int> a = Tuple.Create<string, int>(s, count);
                scoreboard.Add(a);

            };
            if (scoreboard.Count < 5)
            {
                add(__st.cnt);
                return;
            }
            else
            {

                if (scoreboard.ElementAt<Tuple<string, int>>(4).Item2 >= __st.cnt)
                {
                    add(__st.cnt);
                    scoreboard.RemoveRange(4, 1);//if the new name replaces one of the old ones, remove the old one
                }
            }
            scoreboard.Sort(delegate(Tuple<string, int> p1, Tuple<string, int> p2)//re-sort the list
                      {
                          return p1.Item2.CompareTo(p2.Item2);
                      });
            __st = new baloonsState();
        }
Пример #4
0
 private void restart()
 {
     __st = new baloonsState();
 }
Пример #5
0
        public GameState()
        {
            __st = new baloonsState();

            scoreboard = new List<Tuple<string, int>>();
        }
Пример #6
0
 private void restart()
 {
     __st = new baloonsState();
 }