コード例 #1
0
    private int ProcessForEachNode(UTNode node, int currentRow, int currentColumn)
    {
        AddToColumn(node, currentColumn);
        AddToRow(node, currentRow);

        var entry = node.Data;
        UTAutomationPlanEntry subTree = null;

        if (entry is UTAutomationPlanForEachEntry)
        {
            subTree = ((UTAutomationPlanForEachEntry)entry).startOfSubtree;
        }
        if (entry is UTAutomationPlanForEachFileEntry)
        {
            subTree = ((UTAutomationPlanForEachFileEntry)entry).startOfSubtree;
        }
        if (entry is UTMyForEachForBuildEntry)
        {
            subTree = ((UTMyForEachForBuildEntry)entry).startOfSubtree;
        }
        if (subTree != null)
        {
            var subTreeNode = graph.GetNodeFor(subTree);
            EnsureEmptyColumn(currentColumn + 1);
            currentRow = ProcessNode(subTreeNode, currentRow, currentColumn + 1);
        }

        var nextEntry = entry.NextEntry;

        if (nextEntry != null)
        {
            return(ProcessNode(graph.GetNodeFor(nextEntry), currentRow + 1, currentColumn));
        }
        return(currentRow);
    }
コード例 #2
0
    /// <summary>
    /// Executes the given entry and it's followers (hence 'ExecutePath'). Automatically breaks execution if
    /// the context's CancelRequested flag is set. All UTAutomationPlanEntries should use this function if they
    /// have to execute subtrees.
    /// </summary>
    public static IEnumerator ExecutePath(UTAutomationPlanEntry entry, UTContext context)
    {
        while (entry != null)
        {
            if (context.CancelRequested)
            {
                yield break;
            }
            // can be overwritten by the entry or it's substructures.
            context.LocalProgress = -1;
            context.CurrentEntry  = entry;
            context.Me            = entry.Me;
            var enumerator = entry.Execute(context);
            yield return("");

            while (enumerator.MoveNext())
            {
                yield return("");
            }
            if (context.CancelRequested)
            {
                yield break;
            }
            entry = entry.NextEntry;
        }
    }
コード例 #3
0
    private int ProcessSimpleEntry(UTNode node, int currentRow, int currentColumn)
    {
        AddToColumn(node, currentColumn);
        AddToRow(node, currentRow);

        UTAutomationPlanEntry entry = node.Data;
        var nextEntry = entry.NextEntry;

        if (nextEntry != null)
        {
            return(ProcessNode(graph.GetNodeFor(nextEntry), currentRow + 1, currentColumn));
        }
        return(currentRow);
    }
 public override IEnumerator Execute(UTContext context)
 {
     if (decision.EvaluateIn(context)) {
         if(UTPreferences.DebugMode) {
             Debug.Log("Decision yielded true", this);
         }
         result = entryIfTrue;
     }
     else {
         if (UTPreferences.DebugMode) {
             Debug.Log("Decision yielded false", this);
         }
         result = entryIfFalse;
     }
     yield return "";
 }
    public void Connect(UTAutomationPlanEntry firstEntry, UTAutomationPlanEntry secondEntry)
    {
        var firstNode = Graph.GetNodeFor(firstEntry);
        var secondNode = Graph.GetNodeFor(secondEntry);

        // find the "nextEntry" connector of the first node
        UTNode.Connector nextEntryConnector = null;
        foreach(var connector in firstNode.Connectors) {
            if (connector.property == "nextEntry") {
                nextEntryConnector = connector;
                break;
            }
        }
        if (nextEntryConnector != null) {
            AddConnection(nextEntryConnector, secondNode);
        }
    }
    public void Connect(UTAutomationPlanEntry firstEntry, UTAutomationPlanEntry secondEntry)
    {
        var firstNode  = Graph.GetNodeFor(firstEntry);
        var secondNode = Graph.GetNodeFor(secondEntry);

        // find the "nextEntry" connector of the first node
        UTNode.Connector nextEntryConnector = null;
        foreach (var connector in firstNode.Connectors)
        {
            if (connector.property == "nextEntry")
            {
                nextEntryConnector = connector;
                break;
            }
        }
        if (nextEntryConnector != null)
        {
            AddConnection(nextEntryConnector, secondNode);
        }
    }
コード例 #7
0
 public override IEnumerator Execute(UTContext context)
 {
     if (decision.EvaluateIn(context))
     {
         if (UTPreferences.DebugMode)
         {
             Debug.Log("Decision yielded true", this);
         }
         result = entryIfTrue;
     }
     else
     {
         if (UTPreferences.DebugMode)
         {
             Debug.Log("Decision yielded false", this);
         }
         result = entryIfFalse;
     }
     yield return("");
 }
コード例 #8
0
    public override IEnumerator Execute(UTContext context)
    {
        string res = context ["lowQuality"].ToString();

        if (res.Equals("True"))
        {
            if (UTPreferences.DebugMode)
            {
                Debug.Log("Decision yielded true", this);
            }
            result = entryIfTrue;
        }
        else
        {
            if (UTPreferences.DebugMode)
            {
                Debug.Log("Decision yielded false", this);
            }
            result = entryIfFalse;
        }
        yield return("");
    }
コード例 #9
0
	/// <summary>
	/// Gets the node representing a given automation plan entry.
	/// </summary>
	/// <returns>
	/// The node representing the given entry or null if no such node exists.
	/// </returns>
	/// <param name='entry'>
	/// The entry to look up.
	/// </param>
	public UTNode GetNodeFor(UTAutomationPlanEntry entry) {
		if (nodes == null) {
			nodes = new List<UTNode>();
		}
		return nodes.Find(node => node.Data == entry);
	}
 public UTNode GetNodeForEntry(UTAutomationPlanEntry entry)
 {
     return Graph.GetNodeFor(entry);
 }
コード例 #11
0
 /// <summary>
 /// Gets all references which are pointing to the given entry.
 /// </summary>
 public IList<UTReference> GetTargetReferences(UTAutomationPlanEntry entry)
 {
     if (references == null) {
         references = new List<UTReference>();
     }
     return references.FindAll(reference => reference.Target == entry);
 }
コード例 #12
0
 /// <summary>
 /// Gets the node representing a given automation plan entry.
 /// </summary>
 /// <returns>
 /// The node representing the given entry or null if no such node exists.
 /// </returns>
 /// <param name='entry'>
 /// The entry to look up.
 /// </param>
 public UTNode GetNodeFor(UTAutomationPlanEntry entry)
 {
     if (nodes == null) {
         nodes = new List<UTNode>();
     }
     return nodes.Find(node => node.Data == entry);
 }
 public UTNode GetNodeForEntry(UTAutomationPlanEntry entry)
 {
     return(Graph.GetNodeFor(entry));
 }
コード例 #14
0
	/// <summary>
	/// Gets all references which are pointing to the given entry.
	/// </summary>
	public IList<UTReference> GetTargetReferences(UTAutomationPlanEntry entry) {
		if (references == null) {
			references = new List<UTReference>();
		}
		return references.FindAll(reference => reference.Target == entry);
	}
コード例 #15
0
 /// <summary>
 /// Gets the reference which represents the given property of the given automation plan entry.
 /// </summary>
 /// <returns>
 /// The reference or null if no such reference exists.
 /// </returns>
 /// <param name='entry'>
 /// The automation plan entry to look the reference up for.
 /// </param>
 /// <param name='property'>
 /// The property of the automation plan entry which is represented by the reference.
 /// </param>
 public UTReference GetReference(UTAutomationPlanEntry entry, string property)
 {
     if (references == null) {
         references = new List<UTReference>();
     }
     return references.Find(reference => reference.Source == entry && reference.SourceProperty == property);
 }
コード例 #16
0
	/// <summary>
	/// Gets the reference which represents the given property of the given automation plan entry.
	/// </summary>
	/// <returns>
	/// The reference or null if no such reference exists.
	/// </returns>
	/// <param name='entry'>
	/// The automation plan entry to look the reference up for.
	/// </param>
	/// <param name='property'>
	/// The property of the automation plan entry which is represented by the reference.
	/// </param>
	public UTReference GetReference(UTAutomationPlanEntry entry, string property) {
		if (references == null) {
			references = new List<UTReference>();
		}
		return references.Find(reference => reference.Source == entry && reference.SourceProperty == property);
	}
コード例 #17
0
 /// <summary>
 /// Executes the given entry and it's followers (hence 'ExecutePath'). Automatically breaks execution if
 /// the context's CancelRequested flag is set. All UTAutomationPlanEntries should use this function if they
 /// have to execute subtrees.
 /// </summary>
 public static IEnumerator ExecutePath(UTAutomationPlanEntry entry, UTContext context)
 {
     while (entry != null) {
         if (context.CancelRequested) {
             yield break;
         }
         // can be overwritten by the entry or it's substructures.
         context.LocalProgress = -1;
         context.CurrentEntry = entry;
         context.Me = entry.Me;
         var enumerator = entry.Execute (context);
         yield return "";
         while (enumerator.MoveNext()) {
             yield return "";
         }
         if (context.CancelRequested) {
             yield break;
         }
         entry = entry.NextEntry;
     }
 }