public void UnsubscribeFromEvents(InPort InPort) { if (Subscribers.Contains(InPort)) { Subscribers.Remove(InPort); } if (SubscribedComponents.Contains(InPort.Component)) { SubscribedComponents.Remove(InPort.Component); } }
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 Action DisconnectInPort(string portName, Edge edge) { InPort port = Input.GetPort(portName); port.RemoveConnection(edge); return(() => { if (port.ProcessDisconnection != null) { port.ProcessDisconnection.Invoke(edge.Source); } }); }
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 void RemoveDefaultValue(string NodeName, string PortName) { Component Component; if (!NodesByName.TryGetValue(NodeName, out Component)) { throw new Exception(""); } InPort Port = Component.Input.GetPort(PortName); RemoveDefaultValue(Port); }
public Action ConnectToInPort(string portName, Edge edge) { InPort port = Input.GetPort(portName); port.AddConnection(edge); edge.Target = port; return(() => { if (port.ProcessConnection != null) { port.ProcessConnection.Invoke(edge.Source); } }); }
public void AddDefaultValue(object Data, string NodeName, string PortName) { Component Component; if (!NodesByName.TryGetValue(NodeName, out Component)) { throw new Exception("Could not find node: " + NodeName); } InPort Port = Component.Input.GetPort(PortName); AddDefaultValue(Data, Port); }
public void SubscribeToEvents(InPort InPort) { if (Subscribers.Contains(InPort)) { throw new Exception("TODO"); } Subscribers.Add(InPort); if (!SubscribedComponents.Contains(InPort.Component)) // TODO take advantage of list indexing. Add the corresponding component at the same index as the port in it's own list { SubscribedComponents.Add(InPort.Component); } }
public void RemoveDefaultValue(InPort Port) { DefaultValue defaultValue; if (!DefaultValuesByInPort.TryGetValue(Port, out defaultValue)) { throw new Exception("TODO"); } DefaultValuesByInPort.Remove(Port); if (GraphEditor != null) { GraphEditor.EventOptions.DefaultValueRemoved.Invoke(defaultValue); } }
public void SetDefaultValue(object Data, InPort Port) { DefaultValue defaultValue; if (DefaultValuesByInPort.TryGetValue(Port, out defaultValue)) { DefaultValuesByInPort.Remove(Port); if (GraphEditor != null) { GraphEditor.EventOptions.DefaultValueRemoved.Invoke(defaultValue); } } AddDefaultValue(Data, Port); }
protected override void SetupInterfaces() { DoorPort = Input.AddPort(new InPort() { Name = "Door", Description = "The controller of the door to be used", Types = new string[] { "Door Controller" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, }); TogglePort = Input.AddPort(new InPort() { Name = "Toggle", Description = "On receiving any input to this port, the door's state will be toggled", Types = new string[] { "All" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, }); DoorEventsPort = Input.AddPort(new InPort() { Name = "DoorEventsPort", Description = "On receiving any input to this port, the door's state will be toggled", Types = new string[] { "All" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, Hidden = true, }); StatePort = Output.AddPort(new OutPort() { Name = "State", Description = "The state of the door is sent on when changed as Opened or Closed", Types = new string[] { "Text" }, ProcessConnection = (InPort otherPort) => { }, ProcessDisconnection = (InPort otherPort) => { }, }); }
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 void EnqueueNextInitialisingTask() { InPort port = DefaultPortQueue.Dequeue(); if (Graph.InDebugMode()) { port.DebugHighlight(); } Graph.AddData(port, Graph.DefaultValuesByInPort[port].Data); if (Graph.InDebugMode()) { port.DebugUnhighlight(); } context.QueueTask(port.Component); context.SwitchToNewlyEnqueuedTasks(); }
public void AddDefaultValue(object Data, InPort Port) { DefaultValue defaultValue = new DefaultValue() { Data = Data, Component = Port.Component, Port = Port }; if (DefaultValuesByInPort.ContainsKey(Port)) { throw new Exception(""); } DefaultValuesByInPort.Add(Port, defaultValue); if (GraphEditor != null) { GraphEditor.EventOptions.DefaultValueAdded.Invoke(defaultValue); } }
protected override void SetupInterfaces() { EventNamePort = Input.AddPort(new InPort() { Name = "EventName", Description = "The name of the event", Types = new string[] { "Text" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, RememberOnlyLatest = true }); DataPort = Input.AddPort(new InPort() { Name = "Data", Description = "The data to send with the event", Types = new string[] { "All" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, }); }
protected override void SetupInterfaces() { DelayPort = Input.AddPort(new InPort() { Name = "Delay", Description = "The period to wait before sending messages on", Types = new string[] { "Number" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, RememberOnlyLatest = true }); InPort = Input.AddPort(new InPort() { Name = "In", Description = "The data that will be sent on", Types = new string[] { "All" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { } }); OutPort = Output.AddPort(new OutPort() { Name = "Out", Description = "The delayed data", Types = new string[] { "All" }, ProcessConnection = (InPort otherPort) => { }, ProcessDisconnection = (InPort otherPort) => { }, }); }
protected override void SetupInterfaces() { EventNamePort = Input.AddPort(new InPort() { Name = "EventName", Description = "The name of the event to listen for", Types = new string[] { "Text" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, RememberOnlyLatest = true }); EventPort = Input.AddPort(new InPort() { Name = "Event", Description = "The data that was sent with the event", Types = new string[] { "All" }, ProcessConnection = (OutPort otherPort) => { }, ProcessDisconnection = (OutPort otherPort) => { }, Hidden = true }); OutPort = Output.AddPort(new OutPort() { Name = "Out", Description = "Sends event data when an event of the given name is received", Types = new string[] { "Text" }, ProcessConnection = (InPort otherPort) => { }, ProcessDisconnection = (InPort otherPort) => { }, }); }
public void AcceptDataOnPort(string portName, object data, HashSet <Component> Targets) { InPort port = Input.GetPort(portName); port.Accept(data); }
public void AddData(InPort port, object data) { port.Accept(data); }
public InPort AddPort(InPort port) { port.Component = Component; Ports.Add(port.Name, port); return(port); }