コード例 #1
0
 /// <summary>
 /// Gets the type data for the specified type or, if not declared and checked, creates a new one for that type
 /// </summary>
 public static TypeData GetTypeData(Type type, bool createIfNotDeclared)
 {
     if (types == null || types.Count == 0)
         NodeEditor.ReInit (false);
     TypeData typeData = types.Values.First ((TypeData tData) => tData.Type == type);
     if (typeData == null)
     {
         if (createIfNotDeclared)
         {
             typeData = new TypeData (type);
             types.Add (type.FullName, typeData);
         }
         else
         {
             typeData = types.First ().Value;
             Debug.LogError ("No TypeData defined for: " + type.FullName + "!");
         }
     }
     return typeData;
 }
コード例 #2
0
 /// <summary>
 /// Gets the type data with the specified identifier or, if not declared and checked, creates a new one when a valid type name with namespace is passed
 /// </summary>
 public static TypeData GetTypeData(string typeName, bool createIfNotDeclared)
 {
     if (types == null || types.Count == 0)
         NodeEditor.ReInit (false);
     TypeData typeData;
     if (!types.TryGetValue (typeName, out typeData))
     {
         if (createIfNotDeclared)
         {
             Type type = Type.GetType (typeName);
             if (type == null)
             {
                 typeData = types.First ().Value;
                 Debug.LogError ("No TypeData defined for: " + typeName + " and type could not be found either!");
             }
             else
             {
                 typeData = new TypeData (type);
                 types.Add (typeName, typeData);
             }
         }
         else
         {
             typeData = types.First ().Value;
             Debug.LogError ("No TypeData defined for: " + typeName + "!");
         }
     }
     return typeData;
 }
コード例 #3
0
        /// <summary>
        /// Gets the Type the specified identifier representates or, if not declared and checked, creates a new type data for the passed type
        /// </summary>
        public static Type GetType(string typeName, bool createIfNotDeclared)
        {
            TypeData data = GetTypeData(typeName, createIfNotDeclared);

            return(data != null? data.Type : NullType);
        }