示例#1
0
 public ScriptExecutionSession(EventScript script, EventExecutionContext context, Action onFinished, EventRuntimeReferenceHost resolver, IVariableStore temporaryVariables, IVariableStore eventVariables)
 {
     Commands           = new List <EventCommand>(script.CommandList.Commands);
     WaitForAllCommands = script.WaitForAllCommands;
     OnFinished         = onFinished;
     CurrentContext     = context;
     ReferenceResolver  = resolver;
     TemporaryVariables = temporaryVariables;
     EventVariables     = eventVariables;
 }
示例#2
0
 private void UpdateLoop(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (condition.Evaluate(context))
     {
         var script = new EventScript();
         script.CommandList        = routine;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, () => UpdateLoop(context, handle));
     }
     else
     {
         handle.Complete();
     }
 }
示例#3
0
        private void UpdateLoop(EventExecutionContext context, CommandExecutionHandle handle)
        {
            counter++;
            if (count.Evaluate(context, out object result))
            {
                if (result is IComparable resultComparable && counter.CompareTo(resultComparable) < 0)
                {
                    var script = new EventScript();
                    script.CommandList        = routine;
                    script.WaitForAllCommands = waitForAllCommand;
                    context.InsertInherit(script, () => UpdateLoop(context, handle));
                    return;
                }
            }

            handle.Complete();
        }
示例#4
0
 public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
 {
     if (condition.Evaluate(context, onFailed))
     {
         var script = new EventScript();
         script.CommandList        = ifTrue;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, handle.Complete);
     }
     else
     {
         var script = new EventScript();
         script.CommandList        = ifFalse;
         script.WaitForAllCommands = waitForAllCommand;
         context.InsertInherit(script, handle.Complete);
     }
 }