Пример #1
0
        /*
         * Get the information from the page definition node.
         * the page node contains story content and linkage to
         * actions,etc.
         */
        public void AccessPageDefinitionNode(XmlNode node)
        {
            Page page = new Page();

            if (node.Attributes != null)
            {
                for (int i = 0; i < node.Attributes.Count; i++)
                {
                    if (node.Attributes.Item(i).Name.CompareTo("number") == 0)
                    {
                        page.SetPageNumber(Convert.ToInt32(node.Attributes.Item(i).Value));
                    }
                    if (node.Attributes.Item(i).Name.CompareTo("bg_sound") == 0)
                    {
                        page.SetBackgroundNoise(node.Attributes.Item(i).Value);
                    }
                }
            }
            //get the paragraph nodes
            if (node.HasChildNodes)
            {
                foreach (XmlNode cNode in node.ChildNodes)
                {
                    if (cNode.Name.CompareTo("paragraph") == 0)
                    {
                        Paragraph paragraph = new Paragraph();
                        if (cNode.HasChildNodes)
                        {
                            foreach (XmlNode aNode in cNode.ChildNodes)
                            {
                                if (aNode.Name.CompareTo("actionText") == 0)
                                {
                                    ActionText actionText = new ActionText();
                                    if (aNode.HasChildNodes)
                                    {
                                        foreach (XmlNode annNode in aNode.ChildNodes)
                                        {
                                            Group group = new Group(annNode.InnerText);
                                            if (annNode.Name.CompareTo("annotate") == 0)
                                            {
                                                if (annNode.Attributes != null)
                                                {
                                                    for (int j = 0; j < annNode.Attributes.Count; j++)
                                                    {
                                                        group.AddAnnotation(annNode.Attributes.Item(j).Name,
                                                                            annNode.Attributes.Item(j).Value);
                                                    }
                                                }
                                            }
                                            actionText.AddGroup(group);
                                        }
                                    }
                                    else
                                    {
                                        Group group = new Group(aNode.InnerText);
                                        actionText.AddGroup(group);
                                    }
                                    paragraph.AddActionText(actionText);
                                }
                            }
                        }
                        page.AddParagraph(paragraph);
                    }
                }
            }
            pages.Add(page);
        }
Пример #2
0
 public void AddActionText(ActionText at)
 {
     actionTexts.Add(at);
 }