예제 #1
0
 internal UnityTypeReference(string builtInType, EnumDefinitionRaw enumDefinition,
                             UnityTypeDefinition typeDefinition)
 {
     this.builtInType    = builtInType;
     this.enumDefinition = enumDefinition;
     this.typeDefinition = typeDefinition;
 }
예제 #2
0
 public string Generate(UnityTypeDefinition typeDefinition, string package, HashSet <string> enumSet)
 {
     qualifiedNamespace  = UnityTypeMappings.PackagePrefix + package;
     this.typeDefinition = typeDefinition;
     this.enumSet        = enumSet;
     return(TransformText());
 }
예제 #3
0
 public string Generate(UnityTypeDefinition typeDefinition, HashSet <string> enumSet)
 {
     this.typeDefinition = typeDefinition;
     this.enumSet        = enumSet;
     this.nestedTypes    = typeDefinition.TypeDefinitions;
     this.nestedEnums    = typeDefinition.EnumDefinitions.ToList();
     return(TransformText());
 }
예제 #4
0
 public UnityTypeDetails(UnityTypeDefinition typeDefinition)
 {
     CapitalisedName = Formatting.SnakeCaseToCapitalisedCamelCase(typeDefinition.Name);
     CamelCaseName   = Formatting.SnakeCaseToCamelCase(typeDefinition.Name);
     FullyQualifiedSpatialTypeName =
         "global::" + Formatting.CapitaliseQualifiedNameParts(typeDefinition.QualifiedName);
     FullyQualifiedTypeName = "global::" + Formatting.CapitaliseQualifiedNameParts(typeDefinition.QualifiedName);
 }
예제 #5
0
        private void ExtractEnums(UnityTypeDefinition typeDefinition, HashSet <string> enumSet)
        {
            foreach (var enumDefinition in typeDefinition.EnumDefinitions)
            {
                enumSet.Add(enumDefinition.qualifiedName);
            }

            foreach (var nestedTypeDefinition in typeDefinition.TypeDefinitions)
            {
                ExtractEnums(nestedTypeDefinition, enumSet);
            }
        }
예제 #6
0
        private static bool ApplyBlittableMarkerToTypeRecursively(UnityTypeDefinition typeDefinition,
                                                                  Dictionary <string, bool> blittableTypeMap, Dictionary <string, UnityTypeDefinition> unvisited)
        {
            var isBlittable = typeDefinition.FieldDefinitions.All(fieldDefinition =>
                                                                  CanBlitFieldOfTypeRecursively(fieldDefinition, blittableTypeMap, unvisited));

            typeDefinition.IsBlittable = isBlittable;
            blittableTypeMap[typeDefinition.QualifiedName] = isBlittable;
            unvisited.Remove(typeDefinition.QualifiedName);

            return(isBlittable);
        }
예제 #7
0
        private static void PopulateTypeDefinitionsRecursively(Dictionary <string, UnityTypeDefinition> typeMap,
                                                               HashSet <string> enumSet, UnityTypeDefinition typeDefinition)
        {
            foreach (var nestedTypeDefinition in typeDefinition.TypeDefinitions)
            {
                typeMap.Add(nestedTypeDefinition.QualifiedName, nestedTypeDefinition);
                PopulateTypeDefinitionsRecursively(typeMap, enumSet, nestedTypeDefinition);
            }

            foreach (var nestedEnumDefinition in typeDefinition.EnumDefinitions)
            {
                enumSet.Add(nestedEnumDefinition.qualifiedName);
            }
        }