示例#1
0
        public static BasePort GetPortInfo(this Type type)
        {
            BasePort instance = null;

            if (!portTypeToInstance.TryGetValue(type, out instance))
            {
                instance = portTypeToInstance[type] = (BasePort)Activator.CreateInstance(type);
            }

            return(instance);
        }
示例#2
0
        protected void CreatePort(Type portType, string fieldName)
        {
            NodePort port;
            BasePort portInfo = portType.GetPortInfo();

            if (portInfo.Direction == Dir.Output)
            {
                port = target.AddDynamicOutput(portType, fieldName: fieldName);
            }
            else
            {
                port = target.AddDynamicInput(portType, fieldName: fieldName);
            }

            serializedObject.ApplyModifiedProperties();
        }