Beispiel #1
0
        private void BindConnections(IUniNode node, INodePort sourcePort, IContext publisher)
        {
            //data source connections allowed only for input ports
            if (sourcePort.Direction != PortIO.Input)
            {
                return;
            }

            var connections = sourcePort.Connections;

            for (var i = 0; i < connections.Count; i++)
            {
                var connection = connections[i];
                var port       = connection.Port;
                if (port == null || port.Direction == PortIO.Input || port.NodeId == Id)
                {
                    continue;
                }

                var disposable = port.Broadcast(publisher).
                                 AddTo(LifeTime);

                LifeTime.AddDispose(disposable);
            }
        }
Beispiel #2
0
        public void Initialize(IUniNode node,
                               string input,
                               string output,
                               bool connect = true)
        {
            var ports = node.CreatePortPair(input, output, connect);

            inputPort  = ports.inputValue;
            outputPort = ports.outputValue;
        }
Beispiel #3
0
        public NodeActionCommand(
            Action <T> action,
            IUniNode node,
            string name,
            PortIO direction = PortIO.Input)
        {
            var portInfo = node.UpdatePortValue(name, direction);

            portAction = new PortActionCommand <T>(action, portInfo);
        }
        public ConnectedFormatedPairCommand(
            IUniNode node,
            string input,
            bool connect = true)
        {
            var inputName  = input.GetFormatedPortName(PortIO.Input);
            var outputName = input.GetFormatedPortName(PortIO.Output);
            var ports      = node.CreatePortPair(inputName, outputName, connect);

            InputPort  = ports.inputValue;
            OutputPort = ports.outputValue;
        }
        public PortTypeDataBridgeCommand(
            IUniNode node,
            string portName,
            TData defaultValue,
            bool distinctInput = true)
        {
            this.defaultValue    = defaultValue;
            this.valueData.Value = defaultValue;
            this.distinctInput   = distinctInput;

            //create port pairs
            portPair = new ConnectedFormatedPairCommand(node, portName, false);
        }
Beispiel #6
0
        CreatePortPair(this IUniNode node, string inputPortName, string outputPortName, bool connectInOut = false)
        {
            var outputPort = node.UpdatePortValue(outputPortName, PortIO.Output, false);
            var inputPort  = node.UpdatePortValue(inputPortName, PortIO.Input, false);

            var inputValue  = inputPort;
            var outputValue = outputPort;

            if (connectInOut)
            {
                inputValue.Broadcast(outputValue);
            }

            return(inputValue, outputValue);
        }
Beispiel #7
0
 public static void RegisterPortHandler <TValue>(
     this IUniNode node,
     IPortValue portValue,
     IObserver <TValue> observer,
     bool oneShot = false)
 {
     //subscribe to port value observable
     portValue.Receive <TValue>().
     Finally(() => {
         //if node stoped or
         if (!oneShot || !node.IsActive)
         {
             return;
         }
         //resubscribe to port values
         node.RegisterPortHandler(portValue, observer, true);
     }).
     Subscribe(observer).     //subscribe to port value changes
     AddTo(node.LifeTime);    //stop all subscriptions when node deactivated
 }
Beispiel #8
0
 public void DrawPorts(IUniNode node)
 {
     Draw(bodyDrawers);
 }
 public PortObjectDataBridgeCommand(IUniNode node, string portName, TData defaultValue, bool distinctInput = true, bool ignoreEmpty = true) :
     base(node, portName, defaultValue, distinctInput)
 {
     this.ignoreEmpty = ignoreEmpty;
 }
 private void UpdateActivePorts(UniNodeView view, IUniNode node)
 {
     UpdatePortView(node, view.inputPortViews, GameFlowStyleConstants.inputPortActive);
     UpdatePortView(node, view.outputPortViews, GameFlowStyleConstants.outputPortActive);
 }
        private void UpdateActiveAction(UniNodeView view, IUniNode node)
        {
            var isActive = node.Ports.Any(x => x.Value.HasValue);

            view.EnableInClassList(GameFlowStyleConstants.nodeActive, isActive);
        }
 public override ILifeTimeCommand Create(IUniNode node)
 {
     UpdateDynamicPorts(node);
     return(emptyCommand);
 }
Beispiel #13
0
 public virtual ILifeTimeCommand Create(IUniNode node) => null;