Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        public GameState()
        {
            __st = new baloonsState();



            scoreboard = new List <Tuple <string, int> >();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 4
0
 private void restart()
 {
     __st = new baloonsState();
 }
Ejemplo n.º 5
0
        public GameState()
        {
            __st = new baloonsState();

            scoreboard = new List<Tuple<string, int>>();
        }
Ejemplo n.º 6
0
 private void restart()
 {
     __st = new baloonsState();
 }