ParseCondition() 공개 정적인 메소드

public static ParseCondition ( string conditionString ) : System.Condition
conditionString string
리턴 System.Condition
예제 #1
0
        private Trigger ParseTrigger(XElement triggerNode)
        {
            try
            {
                string conditionString;
                if (triggerNode.Attribute("condition") != null)
                {
                    conditionString = triggerNode.RequireAttribute("condition").Value;
                }
                else
                {
                    conditionString = triggerNode.Element("Condition").Value;
                }

                Condition condition = EffectParser.ParseCondition(conditionString);

                Effect effect = EffectParser.LoadTriggerEffect(triggerNode.Element("Effect"));

                return(new Trigger {
                    Condition = condition, Effect = effect
                });
            }
            catch (Exception e)
            {
                throw new GameXmlException(triggerNode, "There was an error parsing a trigger. There may be a syntax error in your condition expression.\n\nThe error message was:\n\n\t" + e.Message);
            }
        }
예제 #2
0
        private void ConditionCommand(SceneConditionCommandInfo command)
        {
            var condition = EffectParser.ParseCondition(command.ConditionExpression);
            var entity    = Entities.GetAll().FirstOrDefault(e => e.Name == command.ConditionEntity);

            if (condition(entity))
            {
                RunCommands(command.Commands);
            }
        }
예제 #3
0
 private Trigger ParseTrigger(TriggerInfo info)
 {
     try
     {
         var condition  = EffectParser.ParseCondition(info.Condition);
         var effect     = EffectParser.LoadTriggerEffect(info.Effect);
         var elseEffect = (info.Else != null) ? EffectParser.LoadTriggerEffect(info.Else) : null;
         return(new Trigger {
             Condition = condition, Effect = effect, Else = elseEffect, ConditionString = info.Condition, Priority = info.Priority ?? 0
         });
     }
     catch (Exception e)
     {
         throw new GameRunException("There was an error parsing a trigger. There may be a syntax error in your condition expression.\n\nThe error message was:\n\n\t" + e.Message);
     }
 }