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


C# Conditions.add方法代码示例

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


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

示例1: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            eithers = element.SelectNodes("either"),
            actives = element.SelectNodes("active"),
            inactives = element.SelectNodes("inactive"),
            greatersthan = element.SelectNodes("greater-than"),
            greatersequalssthan = element.SelectNodes("greater-equals-than"),
            lesssthan = element.SelectNodes("less-than"),
            lesssequalssthan = element.SelectNodes("less-equals-than"),
            equalss = element.SelectNodes("equals"),
            notsequals = element.SelectNodes("not-equals"),
            globalsstatesref = element.SelectNodes("global-state-ref");

        string tmpArgVal;

        foreach (XmlElement el in eithers)
        {
            currentEitherCondition = new Conditions();

            //Embeded inside eithers
            XmlNodeList
                actives_e = el.SelectNodes("active"),
                inactives_e = el.SelectNodes("inactive"),
                greatersthan_e = el.SelectNodes("greater-than"),
                greatersequalssthan_e = el.SelectNodes("greater-equals-than"),
                lesssthan_e = el.SelectNodes("less-than"),
                lesssequalssthan_e = el.SelectNodes("less-equals-than"),
                equalss_e = el.SelectNodes("equals"),
                notsequals_e = el.SelectNodes("not-equals"),
                globalsstatesref_e = el.SelectNodes("global-state-ref");

            foreach (XmlElement ell in actives_e)
            {
                tmpArgVal = ell.GetAttribute("flag");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    currentEitherCondition.add(new FlagCondition(tmpArgVal, FlagCondition.FLAG_ACTIVE));
                    chapter.addFlag(tmpArgVal);
                }
            }

            foreach (XmlElement ell in inactives_e)
            {
                tmpArgVal = ell.GetAttribute("flag");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    currentEitherCondition.add(new FlagCondition(tmpArgVal, FlagCondition.FLAG_INACTIVE));
                    chapter.addFlag(tmpArgVal);
                }
            }

            foreach (XmlElement ell in greatersthan_e)
            {
                // The var
                string var = null;
                // The value
                int value = 0;

                tmpArgVal = ell.GetAttribute("var");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    var = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("value");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    value = int.Parse(tmpArgVal);
                }
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_THAN, value));
                chapter.addVar(var);
            }

            foreach (XmlElement ell in greatersequalssthan_e)
            {
                // The var
                string var = null;
                // The value
                int value = 0;

                tmpArgVal = ell.GetAttribute("var");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    var = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("value");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    value = int.Parse(tmpArgVal);
                }
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_EQUALS_THAN, value));
                chapter.addVar(var);
            }

            foreach (XmlElement ell in lesssthan_e)
            {
                // The var
                string var = null;
                // The value
                int value = 0;
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:ConditionSubParser_.cs

示例2: getEitherConditions

 /**
  * Returns a list with all the either condition blocks. This method is only
  * held for past compatibility
  *
  * @return List of conditions
  */
 private List<Conditions> getEitherConditions()
 {
     List<Conditions> conditions = new List<Conditions>();
     foreach (List<Condition> wrapper in conditionsList)
     {
         if (wrapper.Count > 1)
         {
             Conditions eitherBlock = new Conditions();
             foreach (Condition condition in wrapper)
             {
                 eitherBlock.add(condition);
             }
             conditions.Add(eitherBlock);
         }
     }
     return conditions;
 }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:23,代码来源:Conditions.cs


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