Esempio n. 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();
        }
Esempio n. 2
0
        public string Render(Player p, TMLDoc d)
        {
            StringBuilder ret = new StringBuilder();

            var doc = d.Doc;

            foreach (var tag in doc.Elements()) {
                if (tag.Name == XName.Get("p", TMLDoc.NS)) {
                    RenderP(p, ret, tag);
                }
            }

            return ret.ToString();
        }
Esempio n. 3
0
        private void RenderP(Player p, StringBuilder ret, XElement ptag)
        {
            foreach (var t in ptag.Nodes()) {
                if (t.NodeType == System.Xml.XmlNodeType.Element) {
                    var tag = (XElement)t;
                    if (tag.Name == XName.Get("p", TMLDoc.NS)) {
                        throw new ApplicationException("Cannot nest p tags");
                    }

                    if (tag.Name == XName.Get("br", TMLDoc.NS)) {
                        RenderBR(p, ret, tag);
                    }
                }

                if (t.NodeType == System.Xml.XmlNodeType.Text) {
                    ret.Append(((XText)t).Value);
                }
            }

            ret.AppendLine();
            ret.AppendLine();
        }
Esempio n. 4
0
        public string RenderConsole(Player p)
        {
            ITMLRenderer r = new TMLConsoleRenderer();

            return r.Render(p, this);
        }
Esempio n. 5
0
 private void RenderBR(Player p, StringBuilder ret, XElement t)
 {
     ret.AppendLine();
 }