예제 #1
0
        private static void CachePorts(System.Type nodeType)
        {
            List <System.Reflection.FieldInfo> fieldInfo = GetNodeFields(nodeType);

            for (int i = 0; i < fieldInfo.Count; i++)
            {
                //Get InputAttribute and OutputAttribute
                object[]             attribs      = fieldInfo[i].GetCustomAttributes(true);
                Node.InputAttribute  inputAttrib  = attribs.FirstOrDefault(x => x is Node.InputAttribute) as Node.InputAttribute;
                Node.OutputAttribute outputAttrib = attribs.FirstOrDefault(x => x is Node.OutputAttribute) as Node.OutputAttribute;
                UnityEngine.Serialization.FormerlySerializedAsAttribute formerlySerializedAsAttribute = attribs.FirstOrDefault(x => x is UnityEngine.Serialization.FormerlySerializedAsAttribute) as UnityEngine.Serialization.FormerlySerializedAsAttribute;

                if (inputAttrib == null && outputAttrib == null)
                {
                    continue;
                }

                if (inputAttrib != null && outputAttrib != null)
                {
                    Debug.LogError("Field " + fieldInfo[i].Name + " of type " + nodeType.FullName + " cannot be both input and output.");
                }
                else
                {
                    if (!portDataCache.ContainsKey(nodeType))
                    {
                        portDataCache.Add(nodeType, new List <NodePort>());
                    }
                    portDataCache[nodeType].Add(new NodePort(fieldInfo[i]));
                }

                if (formerlySerializedAsAttribute != null)
                {
                    if (formerlySerializedAsCache == null)
                    {
                        formerlySerializedAsCache = new Dictionary <System.Type, Dictionary <string, string> >();
                    }
                    if (!formerlySerializedAsCache.ContainsKey(nodeType))
                    {
                        formerlySerializedAsCache.Add(nodeType, new Dictionary <string, string>());
                    }

                    if (formerlySerializedAsCache[nodeType].ContainsKey(formerlySerializedAsAttribute.oldName))
                    {
                        Debug.LogError("Another FormerlySerializedAs with value '" + formerlySerializedAsAttribute.oldName + "' already exist on this node.");
                    }
                    else
                    {
                        formerlySerializedAsCache[nodeType].Add(formerlySerializedAsAttribute.oldName, fieldInfo[i].Name);
                    }
                }
            }
        }
        static StackObject *get_oldName_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Serialization.FormerlySerializedAsAttribute instance_of_this_method = (UnityEngine.Serialization.FormerlySerializedAsAttribute) typeof(UnityEngine.Serialization.FormerlySerializedAsAttribute).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.oldName;

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }