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


C# Timer.setUsesEndCondition方法代码示例

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


在下文中一共展示了Timer.setUsesEndCondition方法的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 timer tag, create a new timer with its time
            if (qName.Equals("timer"))
            {
                string time = "";
                bool usesEndCondition = true;
                bool runsInLoop = true;
                bool multipleStarts = true;
                bool countDown = false, showWhenStopped = false, showTime = false;
                string displayName = "timer";

                foreach (KeyValuePair<string, string> entry in attrs)
                {
                    if (entry.Key.Equals("time"))
                        time = entry.Value.ToString();
                    if (entry.Key.Equals("usesEndCondition"))
                        usesEndCondition = entry.Value.ToString().Equals("yes");
                    if (entry.Key.Equals("runsInLoop"))
                        runsInLoop = entry.Value.ToString().Equals("yes");
                    if (entry.Key.Equals("multipleStarts"))
                        multipleStarts = entry.Value.ToString().Equals("yes");
                    if (entry.Key.Equals("showTime"))
                        showTime = entry.Value.ToString().Equals("yes");
                    if (entry.Key.Equals("displayName"))
                        displayName = entry.Value.ToString();
                    if (entry.Key.Equals("countDown"))
                        countDown = entry.Value.ToString().Equals("yes");
                    if (entry.Key.Equals("showWhenStopped"))
                        showWhenStopped = entry.Value.ToString().Equals("yes");
                }

                timer = new Timer(long.Parse(time));
                timer.setRunsInLoop(runsInLoop);
                timer.setUsesEndCondition(usesEndCondition);
                timer.setMultipleStarts(multipleStarts);
                timer.setShowTime(showTime);
                timer.setDisplayName(displayName);
                timer.setCountDown(countDown);
                timer.setShowWhenStopped(showWhenStopped);
            }

            // If it is a condition tag, create the new condition, the subparser and switch the state
            else if (qName.Equals("init-condition") || qName.Equals("end-condition"))
            {
                currentConditions = new Conditions();
                subParser = new ConditionSubParser(currentConditions, chapter);
                subParsing = SUBPARSING_CONDITION;
            }

            // If it is a effect tag, create the new effect, the subparser and switch the state
            else if (qName.Equals("effect") || qName.Equals("post-effect"))
            {
                currentEffects = new Effects();
                subParser = new EffectSubParser(currentEffects, chapter);
                subParsing = SUBPARSING_EFFECT;
            }

        }

        // If it is reading an effect or a condition, spread the call
        if (subParsing != SUBPARSING_NONE)
        {
            subParser.startElement(namespaceURI, sName, qName, attrs);
        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:76,代码来源:TimerSubParser.cs

示例2: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            initscondition = element.SelectNodes("init-condition"),
            endscondition = element.SelectNodes("end-condition"),
            effects = element.SelectNodes("effect"),
            postseffect = element.SelectNodes("post-effect");

        string tmpArgVal;

        string time = "";
        bool usesEndCondition = true;
        bool runsInLoop = true;
        bool multipleStarts = true;
        bool countDown = false, showWhenStopped = false, showTime = false;
        string displayName = "timer";

        tmpArgVal = element.GetAttribute("time");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            time = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("usesEndCondition");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            usesEndCondition = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("runsInLoop");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            runsInLoop = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("multipleStarts");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            multipleStarts = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showTime");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showTime = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("displayName");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            displayName = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("countDown");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            countDown = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showWhenStopped");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showWhenStopped = tmpArgVal.Equals("yes");
        }

        timer = new Timer(long.Parse(time));
        timer.setRunsInLoop(runsInLoop);
        timer.setUsesEndCondition(usesEndCondition);
        timer.setMultipleStarts(multipleStarts);
        timer.setShowTime(showTime);
        timer.setDisplayName(displayName);
        timer.setCountDown(countDown);
        timer.setShowWhenStopped(showWhenStopped);

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

        foreach (XmlElement el in initscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setInitCond(currentConditions);
        }

        foreach (XmlElement el in endscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setEndCond(currentConditions);
        }

        foreach (XmlElement el in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setEffects(currentEffects);
        }

        foreach (XmlElement el in postseffect)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setPostEffects(currentEffects);
        }

        chapter.addTimer(timer);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:100,代码来源:TimerSubParser_.cs


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