当前位置: 首页>>代码示例>>C#>>正文


C# Book.setPreviousPageVector2方法代码示例

本文整理汇总了C#中Book.setPreviousPageVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Book.setPreviousPageVector2方法的具体用法?C# Book.setPreviousPageVector2怎么用?C# Book.setPreviousPageVector2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


在下文中一共展示了Book.setPreviousPageVector2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: startElement

    /*
     * (non-Javadoc)
     *
     * @see es.eucm.eadventure.engine.loader.subparsers.SubParser#startElement(java.lang.string, java.lang.string,
     *      java.lang.string, org.xml.sax.Attributes)
     */
    public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs)
    {
        // If no element is being subparsed
        if (subParsing == SUBPARSING_NONE)
        {

            // If it is a book tag, store the id of the book
            if (qName.Equals("book"))
            {
                string bookId = "";
                string xPrevious = "", xNext = "", yPrevious = "", yNext = "";

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("id"))
                        bookId = entry.Value.ToString();
                    else if (entry.Key.Equals("xPreviousPage"))
                        xPrevious = entry.Value.ToString();
                    else if (entry.Key.Equals("xNextPage"))
                        xNext = entry.Value.ToString();
                    else if (entry.Key.Equals("yPreviousPage"))
                        yPrevious = entry.Value.ToString();
                    else if (entry.Key.Equals("yNextPage"))
                        yNext = entry.Value.ToString();
                }

                book = new Book(bookId);

                if (xPrevious != "" && yPrevious != "")
                {
                    try
                    {
                        int x = int.Parse(xPrevious);
                        int y = int.Parse(yPrevious);
                        book.setPreviousPageVector2(new Vector2(x, y));
                    }
                    catch (Exception e)
                    {
                        // Number in XML is wrong -> Do nothing
                    }
                }

                if (xNext != "" && yNext != "")
                {
                    try
                    {
                        int x = int.Parse(xNext);
                        int y = int.Parse(yNext);
                        book.setNextPageVector2(new Vector2(x, y));
                    }
                    catch (Exception e)
                    {
                        // Number in XML is wrong -> Do nothing
                    }
                }
            }

            // If it is a resources tag, create the new resources
            else if (qName.Equals("resources"))
            {
                currentResources = new ResourcesUni();

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("name"))
                        currentResources.setName(entry.Value.ToString());
                }

            }

            // If it is a documentation tag, hold the documentation in the book
            else if (qName.Equals("documentation"))
            {
                currentstring = string.Empty;
            }

            // If it is a condition tag, create a new subparser
            else if (qName.Equals("condition"))
            {
                currentConditions = new Conditions();
                conditionSubParser = new ConditionSubParser(currentConditions, chapter);
                subParsing = SUBPARSING_CONDITION;
            }

            // If it is an asset tag, read it and add it to the current resources
            else if (qName.Equals("asset"))
            {
                string type = "";
                string path = "";

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("type"))
                        type = entry.Value.ToString();
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:BookSubParser.cs

示例2: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            documentations = element.SelectNodes("documentations"),
            texts = element.SelectNodes("text"),
            pagess = element.SelectNodes("pages"),
            conditions,
            assets,
            pages,
            titles,
            bullets,
            imgs;

        string tmpArgVal;

        string bookId = "";
        string xPrevious = "", xNext = "", yPrevious = "", yNext = "";

        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            bookId = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("xPreviousPage");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            xPrevious = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("xNextPage");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            xNext = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("yPreviousPage");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            yPrevious = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("yNextPage");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            yNext = tmpArgVal;
        }

        book = new Book(bookId);

        if (xPrevious != "" && yPrevious != "")
        {
            try
            {
                int x = int.Parse(xPrevious);
                int y = int.Parse(yPrevious);
                book.setPreviousPageVector2(new Vector2(x, y));
            }
            catch (Exception e)
            {
                // Number in XML is wrong -> Do nothing
            }
        }
        if (xNext != "" && yNext != "")
        {
            try
            {
                int x = int.Parse(xNext);
                int y = int.Parse(yNext);
                book.setNextPageVector2(new Vector2(x, y));
            }
            catch (Exception e)
            {
                // Number in XML is wrong -> Do nothing
            }
        }

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();

            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(tmpArgVal);
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:BookSubParser_.cs


注:本文中的Book.setPreviousPageVector2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。