コード例 #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);
            }
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }
コード例 #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);
        }
コード例 #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
 }
コード例 #8
0
 public void DrawPorts(IUniNode node)
 {
     Draw(bodyDrawers);
 }
コード例 #9
0
 public PortObjectDataBridgeCommand(IUniNode node, string portName, TData defaultValue, bool distinctInput = true, bool ignoreEmpty = true) :
     base(node, portName, defaultValue, distinctInput)
 {
     this.ignoreEmpty = ignoreEmpty;
 }
コード例 #10
0
 private void UpdateActivePorts(UniNodeView view, IUniNode node)
 {
     UpdatePortView(node, view.inputPortViews, GameFlowStyleConstants.inputPortActive);
     UpdatePortView(node, view.outputPortViews, GameFlowStyleConstants.outputPortActive);
 }
コード例 #11
0
        private void UpdateActiveAction(UniNodeView view, IUniNode node)
        {
            var isActive = node.Ports.Any(x => x.Value.HasValue);

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