Exemple #1
0
            internal UnityEventDefinition(ComponentDefinitionRaw.EventDefinitionRaw rawEventDefinition)
            {
                Name    = rawEventDefinition.name;
                RawType = rawEventDefinition.type;

                if (RawType.IsBuiltInType)
                {
                    Type = new UnityTypeReference(RawType.TypeName, null, null);
                }
            }
Exemple #2
0
            internal UnityCommandDefinition(ComponentDefinitionRaw.CommandDefinitionRaw rawCommandDefinition)
            {
                Name            = rawCommandDefinition.name;
                RawRequestType  = rawCommandDefinition.requestType;
                RawResponseType = rawCommandDefinition.responseType;

                if (RawRequestType != null && RawRequestType.IsBuiltInType)
                {
                    RequestType = new UnityTypeReference(RawRequestType.TypeName, null, null);
                }

                if (RawResponseType != null && RawResponseType.IsBuiltInType)
                {
                    ResponseType = new UnityTypeReference(RawResponseType.TypeName, null, null);
                }
            }
        internal UnityComponentDefinition(ComponentDefinitionRaw rawComponentDefinition)
        {
            Name              = rawComponentDefinition.name;
            QualifiedName     = rawComponentDefinition.qualifiedName;
            Id                = rawComponentDefinition.Id;
            RawDataDefinition = rawComponentDefinition.dataDefinition;
            if (RawDataDefinition != null && RawDataDefinition.IsBuiltInType)
            {
                DataDefinition = new UnityTypeReference(RawDataDefinition.TypeName, null, null);
            }

            EventDefinitions = rawComponentDefinition.eventDefinitions != null
                ? rawComponentDefinition.eventDefinitions
                               .Select(rawEventDefinition => new UnityEventDefinition(rawEventDefinition)).ToList()
                : new List <UnityEventDefinition>();

            CommandDefinitions = rawComponentDefinition.commandDefinitions != null
                ? rawComponentDefinition.commandDefinitions
                                 .Select(rawCommandDefinition => new UnityCommandDefinition(rawCommandDefinition)).ToList()
                : new List <UnityCommandDefinition>();
        }
        internal UnityFieldDefinition(FieldDefinitionRaw rawFieldDefinition)
        {
            this.RawFieldDefinition = rawFieldDefinition;
            Name   = rawFieldDefinition.name;
            Number = rawFieldDefinition.Number;
            if (rawFieldDefinition.IsOption())
            {
                RawValueType = rawFieldDefinition.optionType.valueType;
                IsOption     = true;
            }
            else if (rawFieldDefinition.IsList())
            {
                RawValueType = rawFieldDefinition.listType.valueType;
                IsList       = true;
            }
            else if (rawFieldDefinition.IsMap())
            {
                RawKeyType   = rawFieldDefinition.mapType.keyType;
                RawValueType = rawFieldDefinition.mapType.valueType;
                IsMap        = true;
            }
            else
            {
                RawValueType = rawFieldDefinition.singularType;
            }

            if (RawKeyType != null && RawKeyType.IsBuiltInType)
            {
                KeyType = new UnityTypeReference(RawKeyType.TypeName, null, null);
            }

            if (RawValueType != null && RawValueType.IsBuiltInType)
            {
                ValueType = new UnityTypeReference(RawValueType.TypeName, null, null);
            }
        }