private IEnumerator OnIteration(int index) { RockLog.InsertLine(); RockLog.WriteLine(this, LogTier.Info, string.Format("Starting iteration number: {0}", CurrentIteration)); InnerScope.Reset(); var iteratorVariable = Field <object> .Create(RepeatNumberName, index, false, true); // update the iterator job context InnerScope.ScopeContext.Add(iteratorVariable); // reset the inner scope and loop through the child steps yield return(EditorCoroutines.StartCoroutine(InnerScope.StartExecutingSteps(), this)); if (!IsSuppressed) { switch (InnerScope.Request) { case StepRequest.ExitScope: case StepRequest.RootScope: case StepRequest.TerminateJob: DoLoop = false; break; } } CurrentIteration++; }
/// <inheritdoc /> protected override IEnumerator OnExecute(JobContext context) { InnerScope.ScopeContext = context; yield return(EditorCoroutines.StartCoroutine(InnerScope.StartExecutingSteps(), this)); IsSuccess = true; yield return(null); }
/// <inheritdoc /> /// <summary> /// Called when this Step gets executed. /// </summary> /// <param name="context">Current job context.</param> /// <returns></returns> protected override IEnumerator OnExecute(JobContext context) { InnerScope.ScopeContext = new JobContext(context); if (InnerScope.Steps.Count == 0) { IsSuccess = true; yield break; } foreach (var item in ItemList) { if (!DoLoop) { break; } OnIterationStart(CurrentIteration); InnerScope.Reset(); var iteratorVariable = Field <object> .Create(IteratorName.Trim('%'), item, false, true); var indexCountVariable = Field <object> .Create(IndexCountName.Trim('%'), CurrentIteration, false, true); // update the iterator job context InnerScope.ScopeContext.Add(iteratorVariable); InnerScope.ScopeContext.Add(indexCountVariable); // reset the inner scope and loop through the child steps yield return(EditorCoroutines.StartCoroutine(InnerScope.StartExecutingSteps(), this)); OnIterationEnd(CurrentIteration); if (!IsSuppressed) { switch (InnerScope.Request) { case StepRequest.ExitScope: case StepRequest.RootScope: case StepRequest.TerminateJob: DoLoop = false; break; } } CurrentIteration++; } IsSuccess = true; yield return(null); }
/// <inheritdoc /> /// <summary> /// Executes this step. /// </summary> /// <param name="context">Current job context.</param> /// <returns>Returns true if execution was successful.</returns> protected override IEnumerator OnExecute(JobContext context) { var isConditionTrue = ConditionCollection.EvaluateAll(context); if (isConditionTrue) { InnerScope.ScopeContext = context; yield return(EditorCoroutines.StartCoroutine(InnerScope.StartExecutingSteps(), this)); PostExecutionRequest = StepRequest.SkipNext; } else { foreach (var child in Children) { child.Status = StepStatus.Skipped; yield return(null); } } IsSuccess = true; yield return(null); }