コード例 #1
0
        public override void OnDestroy(bool isReplace)
        {
            //if (isReplace)
            //{
            if (GetInputPort("In").isConnected&& GetOutputPort("Out").isConnected)
            {
                BinderConnection[] binderConnections = _GetInPortConnections(GetInputPort("In"));

                Port targetPort = binderConnections[0].sourcePort;
                foreach (var c in binderConnections)
                {
                    graph.RemoveConnection(c);
                }

                binderConnections = _GetOutPortConnections(GetOutputPort("Out"));
                List <object> temp = new List <object>();
                binderConnections.ForEach((x) => { temp.Add(x.targetPort); });
                graph.tempPorts = temp;

                foreach (var c in binderConnections)
                {
                    graph.RemoveConnection(c);
                }

                foreach (var p in graph.tempPorts)
                {
                    Port sourcePort = (Port)p;
                    BinderConnection.Create(targetPort, sourcePort);
                }
                graph.tempPorts = null;
            }
            //}
            base.OnDestroy(isReplace);
        }
コード例 #2
0
ファイル: SwitchEnum.cs プロジェクト: wtrd1234/GameProject3
 ////////////////////////////////////////
 ///////////GUI AND EDITOR STUFF/////////
 ////////////////////////////////////////
         #if UNITY_EDITOR
 protected override UnityEditor.GenericMenu OnDragAndDropPortContextMenu(UnityEditor.GenericMenu menu, Port port)
 {
     if (_type == null && port is ValueOutput && port.type.IsSubclassOf(typeof(System.Enum)))
     {
         menu.AddItem(new GUIContent("Set Enum From Drag"), false, () => {
             _type = port.type;
             GatherPorts();
             BinderConnection.Create(port, GetInputPort(_type.Name));
         });
     }
     return(menu);
 }
コード例 #3
0
ファイル: Macro.cs プロジェクト: Jar330/DissertationProject
 //create initial example ports in case there are none in both entry and exit
 public void AddExamplePorts()
 {
     if (inputDefinitions.Count == 0 && outputDefinitions.Count == 0)
     {
         var defIn  = new DynamicParameterDefinition("In", typeof(Flow));
         var defOut = new DynamicParameterDefinition("Out", typeof(Flow));
         var source = AddInputDefinition(defIn);
         var target = AddOutputDefinition(defOut);
         BinderConnection.Create(source, target);
         Validate();
     }
 }
コード例 #4
0
 protected override UnityEditor.GenericMenu OnDragAndDropPortContextMenu(UnityEditor.GenericMenu menu, Port port)
 {
     if (port is ValueInput || port is FlowInput)
     {
         menu.AddItem(new GUIContent(string.Format("Promote to new Input '{0}'", port.name)), false, () => {
             var def = new DynamicPortDefinition(port.name, port.type);
             if (macro.AddInputDefinition(def))
             {
                 GatherPorts();
                 BinderConnection.Create(GetOutputPort(def.ID), port);
             }
         });
     }
     return(menu);
 }
コード例 #5
0
 protected override UnityEditor.GenericMenu OnDragAndDropPortContextMenu(UnityEditor.GenericMenu menu, Port port)
 {
     if (macro == null)
     {
         return(menu);
     }
     if (port.IsInputPort())
     {
         menu.AddItem(new GUIContent(string.Format("Promote to new Input '{0}'", port.name)), false, () => {
             var def     = new DynamicPortDefinition(port.name, port.type);
             var defPort = macro.AddInputDefinition(def);
             BinderConnection.Create(defPort, port);
         });
     }
     return(menu);
 }
コード例 #6
0
 ///validates the entry and exit references
 protected override void OnGraphValidate()
 {
     base.OnGraphValidate();
     _entry = null;
     _exit  = null;
     _entry = entry;
     _exit  = exit;
     //create initial example ports in case there are none in both entry and exit
     if (inputDefinitions.Count == 0 && outputDefinitions.Count == 0)
     {
         var defIn  = new DynamicPortDefinition("In", typeof(Flow));
         var defOut = new DynamicPortDefinition("Out", typeof(Flow));
         var source = AddInputDefinition(defIn);
         var target = AddOutputDefinition(defOut);
         BinderConnection.Create(source, target);
     }
 }
コード例 #7
0
 ///validates the entry & exit references
 protected override void OnGraphValidate()
 {
     base.OnGraphValidate();
     _entry = null;
     _exit  = null;
     _entry = entry;
     _exit  = exit;
     //create initial ports in case there are none in both entry and exit
     if (inputDefinitions.Count == 0 && outputDefinitions.Count == 0)
     {
         var defIn  = new MacroPortDefinition("In", typeof(Flow));
         var defOut = new MacroPortDefinition("Out", typeof(Flow));
         inputDefinitions.Add(defIn);
         outputDefinitions.Add(defOut);
         entry.GatherPorts();
         exit.GatherPorts();
         var source = entry.GetOutputPort(defIn.ID);
         var target = exit.GetInputPort(defOut.ID);
         BinderConnection.Create(source, target);
     }
 }