コード例 #1
0
        public List <GamePlay> loadSavedGamePlays(List <string> xs)
        {
            List <GamePlay> result = new List <GamePlay>();
            XmlSerializer   xml    = new XmlSerializer(typeof(GamePlay), new Type[] { typeof(MoveCommand), typeof(UseItemCommand), typeof(AttackCommand) });

            foreach (string s in xs)
            {
                using (Stream reader = new FileStream(ReplayDirectory.Get(s + ".rpl"), FileMode.Open))
                {
                    GamePlay gp = (GamePlay)xml.Deserialize(reader);
                    result.Add(gp);
                }
                Console.WriteLine("GAME CREATED FROM SAVEFILE ________________________");
            }
            return(result);
        }
コード例 #2
0
        public void exit_reached()
        {
            Console.WriteLine("You have reached the last node!");
            Console.ForegroundColor = ConsoleColor.Red;

            string filepath = ReplayDirectory.Get("end_ascii.txt");

            string[] end = System.IO.File.ReadAllLines(filepath, Encoding.UTF8);
            for (int i = 0; i < end.Count(); i++)
            {
                Console.WriteLine(end[i]);
            }
            Console.WriteLine("You have killed {0} monsters.", game.player.KillPoint);
            Console.ResetColor();
            Console.ReadKey();
            //game.gp.Serialize("Combat6");
            Environment.Exit(0);
        }