コード例 #1
0
        public UnrealComponentJob(UnrealComponentDetails unrealComponent, string outputDirectory, IFileSystem fileSystem)
            : base(outputDirectory, fileSystem)
        {
            InputFiles = new List <string>()
            {
                unrealComponent.UnderlyingPackageDetails.SourceSchema
            };

            var componentHeaderFileName       = unrealComponent.CapitalisedName + componentHeaderSuffix;
            var componentImplFileName         = unrealComponent.CapitalisedName + componentImplSuffix;
            var componentUpdateHeaderFileName = unrealComponent.CapitalisedName + componentUpdatedHeaderSuffix;
            var componentUpdateImplFileName   = unrealComponent.CapitalisedName + componentUpdateImplSuffix;
            var opWrapperHeaderFileName       = unrealComponent.CapitalisedName + addComponentHeaderSuffix;

            OutputFiles = new List <string>()
            {
                componentHeaderFileName,
                componentImplFileName,
                componentUpdateHeaderFileName,
                componentUpdateImplFileName,
                opWrapperHeaderFileName
            };

            this.unrealComponent = unrealComponent;
        }
コード例 #2
0
ファイル: JobRunnerTest.cs プロジェクト: m10ev/UnrealGDK
        public static void run_executes_the_expected_file_operations_when_running_an_unrealentitytemplatejob()
        {
            var mockFileSystem = GenerateMockFileSystem();

            mockFileSystem.GetFileInfoMock = (path) =>
            {
                var file = new MockFileWrapper(path, Path.GetDirectoryName(path), new DateTime(1, 1, 1));
                file.ExistsMock = () => { return(false); };
                return(file);
            };
            mockFileSystem.GetFilesInDirectoryMock = (path, searchpattern, recursive) => { return(new List <IFile>()); };

            var unrealPackageDetails   = new UnrealPackageDetails("improbable.codegen.TestComponent", TestSchemaPath, "improbable.codegen");
            var unrealComponentDetails = new UnrealComponentDetails(GenerateComponentDefinition(), "TestComponent", new List <UnrealFieldDetails>(), new List <UnrealEventDetails>(), new List <UnrealCommandDetails>(), unrealPackageDetails);
            var entityTemplateJob      = new UnrealEntityTemplateJob(new List <UnrealComponentDetails> {
                unrealComponentDetails
            }, new HashSet <string>(), Path.Combine("OutputDir", "test"), mockFileSystem);

            var jobRunner = new JobRunner(mockFileSystem);

            jobRunner.Run(new List <ICodegenJob>()
            {
                entityTemplateJob
            }, new List <string>()
            {
                OutputDirectory
            });

            Assert.That(mockFileSystem.DirectoryExistsCallCount == 2);
            Assert.That(mockFileSystem.WriteToFileCallCount == 2);
            Assert.That(mockFileSystem.WrittenFiles.Count == 2);
            Assert.That(mockFileSystem.WrittenFiles.Contains(Path.Combine(OutputDirectory, "EntityTemplate.h")));
            Assert.That(mockFileSystem.WrittenFiles.Contains(Path.Combine(OutputDirectory, "EntityTemplate.cpp")));
        }
コード例 #3
0
        private List <UnrealComponentDetails> ProcessComponents(ICollection <SchemaFileRaw> schemaFiles)
        {
            var unrealComponents = new List <UnrealComponentDetails>();

            foreach (var schemaFile in schemaFiles)
            {
                var packageDetails = unrealPackageDetails[schemaFile.canonicalName];
                foreach (var componentDefinition in schemaFile.componentDefinitions)
                {
                    var capitalisedComponentName = resolvedComponentToCapitalisedNames[componentDefinition];

                    var commandTypeDefinition = qualifiedNameToTypeDefinition[componentDefinition.dataDefinition.TypeName];
                    var fieldDetails          = typeDefinitionToUnrealType[commandTypeDefinition].FieldDetailsList;
                    var eventDetailsList      = componentDefinition.eventDefinitions.Select(eventDefinition =>
                    {
                        var typeReference = GenerateUnrealTypeReference(eventDefinition.type);
                        return(new UnrealEventDetails(eventDefinition, typeReference));
                    })
                                                .ToList();

                    eventDetailsList.ForEach(individualEventDetails =>
                    {
                        var eventUserTypeReference =
                            individualEventDetails.EventTypeReference as UnrealUserTypeReference;
                        if (eventUserTypeReference != null)
                        {
                            eventUserTypeReference.TypeDetails.SetIsUsedForEvent();
                        }
                    });

                    // Extract the commands defined in the current component.
                    var commandDetails = unrealCommandDetails.Where(command => capitalisedComponentName == command.CapitalisedOwnerName).ToList();

                    var unrealComponent = new UnrealComponentDetails(componentDefinition, capitalisedComponentName, fieldDetails, eventDetailsList, commandDetails, packageDetails);

                    unrealComponents.Add(unrealComponent);
                }
            }

            return(unrealComponents);
        }
コード例 #4
0
 public UnrealComponentImplementationGenerator(UnrealComponentDetails unrealComponent)
 {
     this.unrealComponent = unrealComponent;
 }
コード例 #5
0
 public UnrealComponentUpdateHeaderGenerator(UnrealComponentDetails unrealComponent)
 {
     this.unrealComponent = unrealComponent;
 }
コード例 #6
0
 public UnrealAddEntityOpWrapperHeaderGenerator(UnrealComponentDetails unrealComponent)
 {
     this.unrealComponent = unrealComponent;
 }