public override void Process(ExecutionContext context) { // Deal with new button controllers if (ButtonPort.HasData()) { // Unsubscribe from the previous button if necessary if (button != null) { button.UnsubscribeFromEvents(ButtonEventsPort); } // Get the button button = (ButtonController)ButtonPort.GetData(); // Subscribe to the new button button.SubscribeToEvents(ButtonEventsPort); } // Send a kick for each button event received for (int i = 0; i < ButtonEventsPort.GetDataCount(); i++) { Output.Send(OnPressPort, Kick.Instance, context); } ButtonEventsPort.ClearData(); }
public override void Process(ExecutionContext context) { if (DelayPort.HasData()) { string delayString = DelayPort.GetData() as string; if (delayString == null) { Output.Done(context); return; } float delay = float.Parse(delayString); // Collect data in local queue Queue data = new Queue(); HashSet <Processable> targets = new HashSet <Processable>(); while (InPort.HasData()) { data.Enqueue(InPort.GetData()); } Graph.gameObject.AddComponent <DelayedCallback>().SetTimedCallback(() => { // TODO Upon stopping a graph, remove all delayed callback components while (data.Count > 0) { Output.Send(OutPort, data.Dequeue(), Graph.CurrentExecutor.GetExecutionContext()); } Output.Done(context); Graph.CurrentExecutor.ContinueExecution(this); }, delay); } Output.Done(context); }
public override void Process(ExecutionContext context) { if (EventNamePort.HasData()) { string eventName = EventNamePort.GetData() as string; if (eventName != currentEventName) { if (currentEventName != null) { Graph.AssociatedInterlink.UnsubscribeFromEvent(currentEventName, EventPort); } currentEventName = eventName; Graph.AssociatedInterlink.SubscribeToEvent(currentEventName, EventPort); } while (EventPort.HasData()) { object data = EventPort.GetData(); OutPort.Send(data, context); } } Output.Done(context); }
public override void Process(ExecutionContext context) { InPort In = Input.GetPort("In"); if (In.HasData()) { object data = In.GetData(); Debug.Log(data.ToString()); Output.SendDone("PassOn", data, context); } }
public override void Process(ExecutionContext context) { InPort firstPort = Input.GetPort("First"); InPort secondPort = Input.GetPort("Second"); if (firstPort.HasData() && secondPort.HasData()) { object first = firstPort.GetData(); object second = secondPort.GetData(); Output.SendDone("Out", first.ToString() + second.ToString(), context); } }
public override void Process(ExecutionContext context) { if (EventNamePort.HasData()) { string eventName = EventNamePort.GetData() as string; while (DataPort.HasData()) { object data = DataPort.GetData(); Graph.AssociatedInterlink.EmitEvent(eventName, data); } } Output.Done(context); }
public override void Process(ExecutionContext context) { if (ObjectPort.HasData()) { object data = ObjectPort.GetData(); for (int i = 0; i < SendPort.GetDataCount(); i++) { OutPort.Send(data, context); } SendPort.ClearData(); } Output.Done(context); }
public override void Process(ExecutionContext context) { InPort firstPort = Input.GetPort("Delimiter"); InPort secondPort = Input.GetPort("String"); if (firstPort.HasData() && secondPort.HasData()) { string delimiter = firstPort.GetData().ToString(); string str = secondPort.GetData().ToString(); string[] strs = str.Split(new string[] { delimiter }, new StringSplitOptions()); for (int i = 0; i < strs.Length; i++) { Output.SendDone("Out", strs[i], context); } } }
public override void Process(ExecutionContext context) { // Update the door controller if (DoorPort.HasData()) { if (Door != null) { Door.UnsubscribeFromEvents(DoorEventsPort); } object data = DoorPort.GetData(); if (data is DoorController) { Door = (DoorController)data; } else { throw new Exception("TODO"); // TODO Send exception to graph for display within graph editor } Door.SubscribeToEvents(DoorEventsPort); } // Toggle the doors state once if there are any instructions to do so if (TogglePort.HasData()) { TogglePort.ClearData(); if (Door != null) { Door.Toggle(); } } // Send on any state change notifications while (DoorEventsPort.HasData()) { Output.Send(StatePort, DoorEventsPort.GetData(), context); } Output.Done(context); }