Пример #1
0
        public static void Main(string[] args)
        {
            adventure = Adventure.Load(args[0]);
            player = new Player(adventure);

            if (player.HasSave) {
                if (AskYN("Do you want to load your save game?", true)) {
                    player.LoadSave();
                } else {
                    player.NewGame();
                }
            } else {
                player.NewGame();
            }

            player.Save();

            while (true) {
                Console.Clear();
                Console.Write(player.Page.Body.RenderConsole(player));

                Pause();
            }

            //Pause();
        }
Пример #2
0
        public static Adventure Load(string file)
        {
            XDocument doc = XDocument.Load(file);

            if (doc.Root.Name != XName.Get("cyoa", NS)) {
                throw new ApplicationException("That document is not an adventure document");
            }

            Adventure ret = new Adventure();

            ret.Name = System.IO.Path.GetFileNameWithoutExtension(file);

            ret.Load(doc.Root);

            return ret;
        }
Пример #3
0
 public Player(Adventure adventure)
 {
     this.Adventure = adventure;
     Flags = new HashSet<string>();
 }
Пример #4
0
 public Player(Adventure adventure)
 {
     this.Adventure = adventure;
     Flags          = new HashSet <string>();
 }