Esempio n. 1
0
 public static Highscores Load(string file)
 {
     if (File.Exists(file))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Highscores));
         StreamReader  reader     = new StreamReader(file);
         Highscores    scores     = (Highscores)serializer.Deserialize(reader);
         reader.Close();
         return(scores);
     }
     else
     {
         Highscores scores = new Internals.Highscores();
         scores.Clean();
         return(scores);
     }
 }
Esempio n. 2
0
        public void Update()
        {
            if (Program.Game.Return != -1)
            {
                slot = scores.TryPut(Program.Game.ReturnInf, "");
                Program.Game.Return = -1;
                scores.Put(Program.Game.ReturnInf, "");
                Renderer.DrawBegin();
                Draw();
                Renderer.DrawEnd();
                Renderer.StopDrawing = true;
                while (!Renderer.DrawEnded)
                {
                    ;
                }
                Console.CursorLeft      = 14;
                Console.CursorTop       = 3 + (slot * 2);
                Console.BackgroundColor = ConsoleColor.Green;
                Console.ForegroundColor = ConsoleColor.Blue;
                string nm = Console.ReadLine();
                Renderer.StopDrawing = false;
                scores = Internals.Highscores.Load("Scores.hsc");
                scores.Put(Program.Game.ReturnInf, nm);
                Internals.Highscores.Save("Scores.hsc", scores);
            }

            if (ConsoleKeyboard.KeyAvailable)
            {
                switch (ConsoleKeyboard.PressedKey)
                {
                case ConsoleKey.Enter:
                case ConsoleKey.Escape:
                    Program.Game.SwitchScene(Game.SceneNames.MENU);
                    break;
                }
            }
        }
Esempio n. 3
0
 public void Init()
 {
     slot   = -1;
     scores = Internals.Highscores.Load("Scores.hsc");
 }