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


C# Animation.getTransitions方法代码示例

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


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

示例1: Parse

    public void Parse(string path_)
    {
        XmlDocument xmld = new XmlDocument();
        xmld.Load(path_);

        XmlElement element = xmld.DocumentElement;

        XmlNodeList
            frames = element.SelectNodes("/animation/frame"),
            transitions = element.SelectNodes("/animation/transition"),
            resources = element.SelectNodes("/animation/resources"),
            assets;

        string tmpArgVal;

        XmlNode animationNode = element.SelectSingleNode("/animation");

        tmpArgVal = animationNode.Attributes["id"].Value;
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            animation = new Animation(tmpArgVal, factory);
            animation.getFrames().Clear();
            animation.getTransitions().Clear();
        }

        tmpArgVal = animationNode.Attributes["slides"].Value;
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal.Equals("yes"))
                animation.setSlides(true);
            else
                animation.setSlides(false);
        }

        tmpArgVal = animationNode.Attributes["usetransitions"].Value;
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal.Equals("yes"))
                animation.setUseTransitions(true);
            else
                animation.setUseTransitions(false);
        }

        if (element.SelectSingleNode("documentation") != null)
            animation.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in frames)
        {
            new FrameSubParser_(animation).ParseElement(el);
        }
        foreach (XmlElement el in transitions)
        {
            new TransitionSubParser_(animation).ParseElement(el);
        }

        foreach (XmlElement el in resources)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(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;
                }
                currentResources.addAsset(type, path);
            }

            animation.addResources(currentResources);
        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:86,代码来源:AnimationHandler_.cs

示例2: startElement

    public override void startElement(string namespaceURI, string sName, string qName, Dictionary<string, string> attrs)
    {
        if (this.reading == READING_NONE)
        {

            if (qName.Equals("animation"))
            {
                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("id"))
                    {
                        animation = new Animation(entry.Value.ToString(), factory);
                        animation.getFrames().Clear();
                        animation.getTransitions().Clear();
                    }

                    if (entry.Key.Equals("slides"))
                    {
                        if (entry.Value.ToString().Equals("yes"))
                            animation.setSlides(true);
                        else
                            animation.setSlides(false);
                    }

                    if (entry.Key.Equals("usetransitions"))
                    {
                        if (entry.Value.ToString().Equals("yes"))
                            animation.setUseTransitions(true);
                        else
                            animation.setUseTransitions(false);
                    }
                }
            }

            if (qName.Equals("documentation"))
            {
                currentstring = string.Empty;
            }

            if (qName.Equals("resources"))
            {
                currentResources = new ResourcesUni();

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

            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();
                    if (entry.Key.Equals("uri"))
                        path = entry.Value.ToString();
                }

                currentResources.addAsset(type, path);
            }

            if (qName.Equals("frame"))
            {
                subParser = new FrameSubParser(animation);
                reading = READING_FRAME;
            }

            if (qName.Equals("transition"))
            {
                subParser = new TransitionSubParser(animation);
                reading = READING_TRANSITION;
            }
        }
        if (reading != READING_NONE)
        {
            subParser.startElement(namespaceURI, sName, qName, attrs);
        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:83,代码来源:AnimationHandler.cs


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