Inheritance: System.Attribute
Example #1
0
        public void FireExposed(Expose exposed, params object[] args)
        {
            if (exposed.exposedType == ExposedType.METHOD)
            {
                exposed.methodInfo.Invoke(this, args);

                foreach (Anchor anchor in anchors)
                {
                    if (anchor.type == AnchorType.VARIABLE)
                    {
                        anchor.OnPrepareVariableForExport();
                        anchor.ExportVariableToConnections();
                    }
                }

                foreach (Anchor anchor in anchors)
                {
                    if (anchor.displayName == exposed.exposedName)
                    {
                        anchor.ExecuteConnectedNodes();
                    }
                }
            }

            if (exposed.exposedType == ExposedType.FIELD || exposed.exposedType == ExposedType.PROPERTY)
            {
                foreach (Anchor anchor in anchors)
                {
                    if (anchor.type == AnchorType.VARIABLE && anchor.displayName == exposed.exposedName)
                    {
                        anchor.ExecuteConnectedNodes();
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Returns a List of all exposables owned
        /// by this node.
        /// </summary>
        /// <returns></returns>
        public List <Expose> GetExposed()
        {
            if (m_exposed == null)
            {
                m_exposed = new List <Expose>();

                foreach (MethodInfo info in GetType().GetMethods(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance))
                {
                    if (info.GetCustomAttributes(typeof(Expose), true).Length > 0)
                    {
                        Expose expose = (Expose)info.GetCustomAttributes(typeof(Expose), true)[0];
                        expose.exposedType = ExposedType.METHOD;
                        expose.methodInfo  = info;
                        expose.exposedName = info.Name;

                        m_exposed.Add(expose);
                    }
                }

                foreach (FieldInfo info in GetType().GetFields(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance))
                {
                    if (info.GetCustomAttributes(typeof(Expose), true).Length > 0)
                    {
                        Expose expose = (Expose)info.GetCustomAttributes(typeof(Expose), true)[0];
                        expose.exposedType = ExposedType.FIELD;
                        expose.fieldInfo   = info;
                        expose.exposedName = info.Name;

                        m_exposed.Add(expose);
                    }
                }

                foreach (PropertyInfo info in GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance))
                {
                    if (info.GetCustomAttributes(typeof(Expose), true).Length > 0)
                    {
                        Expose expose = (Expose)info.GetCustomAttributes(typeof(Expose), true)[0];
                        expose.exposedType  = ExposedType.PROPERTY;
                        expose.propertyInfo = info;
                        expose.exposedName  = info.Name;

                        m_exposed.Add(expose);
                    }
                }
            }

            return(m_exposed);
        }
Example #3
0
        public Anchor CreateExposedAnchor(Expose expose, AnchorType type)
        {
            GameObject exposedG = new GameObject(expose.exposedName);

            exposedG.hideFlags = HideFlags.HideInHierarchy;

            Anchor anchor = exposedG.AddComponent <Anchor>();

            anchor.displayName      = expose.exposedName;
            anchor.editorPosition.y = -25;
            anchor.type             = type;

            anchor.transform.SetParent(transform);

            return(anchor);
        }
Example #4
0
        public void FireExposed(Expose exposed, params object[] args)
        {
            if(exposed.exposedType == ExposedType.METHOD)
            {
                exposed.methodInfo.Invoke(this, args);

                foreach(Anchor anchor in anchors)
                {
                    if(anchor.type == AnchorType.VARIABLE)
                    {
                        anchor.OnPrepareVariableForExport();
                        anchor.ExportVariableToConnections();
                    }
                }

                foreach(Anchor anchor in anchors)
                {
                    if(anchor.displayName == exposed.exposedName)
                    {
                        anchor.ExecuteConnectedNodes();
                    }
                }
            }

            if(exposed.exposedType == ExposedType.FIELD || exposed.exposedType == ExposedType.PROPERTY)
            {
                foreach(Anchor anchor in anchors)
                {
                    if(anchor.type == AnchorType.VARIABLE && anchor.displayName == exposed.exposedName)
                    {
                        anchor.ExecuteConnectedNodes();
                    }
                }
            }
        }