public override IEnumerator ExecuteNode(NodeExecutionContext context) { if (context.inputPort.fieldName == nameof(breakFlow)) { Debug.LogWarning("Canceled wait node!"); shouldBreakFlow = true; } else { int sec = GetInputValue <int>(nameof(this.seconds), this.seconds); float timeout = (float)sec; while (!shouldBreakFlow) { yield return(null); timeout -= Time.deltaTime; if (timeout <= 0) { break; } } } }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { string message = GetInputValue <string>(nameof(this.message), this.message); MessageSystem.SendMessage(message); yield return(null); }
public override NodeExecutionContext NextNode(NodeExecutionContext context) { NTNode node = GetNode(nameof(flowOut)); NodePort port = GetPort(nameof(flowOut)); return(new NodeExecutionContext { node = node, inputPort = port?.Connection, outputPort = port }); }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { GameObject hintGameObject = GameObject.Find("Session Hints/Panel/Hint Text"); TextMeshPro textComponent = hintGameObject.GetComponent <TextMeshPro>(); string hint = GetInputValue <string>(nameof(this.hintText), this.hintText); textComponent.text = hint; yield return(null); }
public override NodeExecutionContext NextNode(NodeExecutionContext context) { if (shouldBreakFlow) { return(new NodeExecutionContext() { node = null, inputPort = null, outputPort = GetPort(nameof(flowOut)) }); } else { return(base.NextNode(context)); } }
public async System.Threading.Tasks.Task StringFormatFromNodesTest() { var node = new StringFormatNode(); node.Pattern = @"Hello {{name_1}}, from {{name_3}} {{value_2}}"; node.FromOtherNodes = true; node.MetaDate = new NodeMetaData() { NodeData = new NodeMetaDataAttribute() { NodeClass = typeof(StringFormatNode) }, FieldsMetaData = new List <FieldMetaDataAttribute>() { new FieldMetaDataAttribute() { MappedNodeId = 1, MappedFieldName = "name" }, new FieldMetaDataAttribute() { MappedNodeId = 2, MappedFieldName = "value" }, new FieldMetaDataAttribute() { MappedNodeId = 3, MappedFieldName = "name" }, } }; var context = new NodeExecutionContext() { Pad = new Pad(ExecutionMode.Validation) { Nodes = new List <INode>() } }; await node.Init(context); await node.Execute(context); Assert.DoesNotContain("{", node.Context.Result.ToString()); }
public override NodeExecutionContext NextNode(NodeExecutionContext context) { Debug.Log("Next node from branch??"); bool condition = GetInputValue <bool>(nameof(condition), this.condition); string nemeOfPort = condition ? nameof(trueBranch) : nameof(falseBranch); Debug.Log(nemeOfPort); NTNode node = GetNode(nemeOfPort); NodePort port = GetPort(nemeOfPort); return(new NodeExecutionContext { node = node, inputPort = port?.Connection, outputPort = port }); }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { NTGraph g = graph as NTGraph; NodePort port = GetPort(variablePath); object portValue = port.GetInputValue(); if (!port.IsConnected) { portValue = backingValue; } object value = null; if (portValue != null) { if (!string.IsNullOrEmpty(variablePath)) { value = g.variableDelegate.GetValue(dataKey); if (value == null) { yield break; } ReflectionUtilities.SetValueOf(ref value, portValue, variablePath.Split('/').ToList()); g.variableDelegate.SetValue(dataKey, value); } else { value = portValue; } } else { } yield return(null); }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { GameObject messageGameObject = GameObject.Find("ShowMessage/Bocadillo/MessageText"); GameObject parentMessageGameObject = getGameObjectParent(getGameObjectParent(messageGameObject)); // Check if message is empty string message = GetInputValue <string>(nameof(this.messageText), this.messageText); bool visible = !string.IsNullOrEmpty(message); // Modify visibility by changing scale Vector3 scale = visible ? Vector3.one : Vector3.zero; parentMessageGameObject.transform.localScale = scale; if (visible) { TextMeshPro textComponent = messageGameObject.GetComponent <TextMeshPro>(); textComponent.text = message; // Place message outside the object's bounding box, towards the scene center (to avoid walls collision) GameObject positionGameObject = GetInputValue <SceneGameObject>(nameof(objectPosition), null).gameObject; BoxCollider collider = positionGameObject.gameObject.GetComponentInChildren <BoxCollider>(); if (collider != null) { Vector3 colliderCenter = collider.transform.TransformPoint(collider.center); colliderCenter.y = 0; parentMessageGameObject.transform.position = colliderCenter; Vector3 offset = collider.size; offset.x += 0.5f; // Message size fixed offset offset.z = 0; parentMessageGameObject.transform.Translate(offset); } else { parentMessageGameObject.transform.position = positionGameObject.transform.position; parentMessageGameObject.transform.Translate(new Vector3(1, 1, 0)); } // Rotación de seguimiento alrededor del objeto de posición?? } yield return(null); }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { NTGraph g = graph as NTGraph; NodePort port = GetPort(dataKey); object portValue = port.GetInputValue(); if (!port.IsConnected) { portValue = backingValue; } if (portValue != null) { g.variableDelegate.SetUserVariable(dataKey, portValue); } yield return(null); }
public async System.Threading.Tasks.Task StringFormatTest() { var node = new StringFormatNode(); node.Pattern = @"Hello {{name}}, from {{name}} {{value}}"; node.Data = @"{'name':'James', 'value':'ddddd'}"; var context = new NodeExecutionContext() { Pad = new Pad(ExecutionMode.Validation) { Nodes = new List <INode>() } }; await node.Init(context); await node.Execute(context); Assert.DoesNotContain("{", node.Context.Result.ToString()); }
public async System.Threading.Tasks.Task RegexNodeMatchTestAsync() { var node = new RegexNode(); node.Pattern = @"(\d{3})-(\d{3}-\d{4})"; node.Value = "212-555-6666 906-932-1111 415-222-3333 425-888-9999"; node.EnableGroup = true; var context = new NodeExecutionContext() { Pad = new Pad(ExecutionMode.Validation) { Nodes = new List <INode>() } }; await node.Init(context); await node.Execute(context); Assert.Equal(true, node.Context.Result); Assert.Equal(4, node.Matches.Count); }
public IEnumerator StartExecutionFlow(CallbackNode callbackNode) { NodeExecutionContext nodeExecutionContext = new NodeExecutionContext { node = callbackNode }; while (nodeExecutionContext.node != null) { Debug.Log("<color=green> Execute node: " + nodeExecutionContext.node + " ... GRAPH: " + name + "</color>"); nodeExecutionContext.node.Enter(); yield return(new YieldNode(nodeExecutionContext)); Debug.Log("<color=red> Finished node: " + nodeExecutionContext.node + "</color>"); yield return(new WaitForSeconds(0.25f)); nodeExecutionContext.node.Exit(); nodeExecutionContext = nodeExecutionContext.node.NextNode(nodeExecutionContext); } yield return(null); }
public ParameterResolverContext(NodeExecutionContext nodectx) : base(nodectx) { }
public override IEnumerator ExecuteNode(NodeExecutionContext context) { MessageSystem.SendMessage("Fail Session /" + (GetValue() != null ? GetValue() : grade)); yield return(null); }
public NodeExecutionContextProxy(NodeExecutionContext ctx) { Context = ctx; }
public LoaderPluginWriteContext(NodeExecutionContext nodectx) : base(nodectx) { }
public CustomPluginWriteContext(NodeExecutionContext nodectx) : base(nodectx) { }
public CaseNode(TestCaseInfo unit, CompositeNode parent) : base(unit, new DefaultTestContext(parent.InitContext, unit)) { _parent = parent; _execution = new NodeExecutionContext(this, InitContext, Case, Case.CreateTestObject()); }