protected override void RunImpl() { var typeGenerator = new UnityTypeGenerator(); var enumGenerator = new UnityEnumGenerator(); var eventGenerator = new UnityEventGenerator(); var commandPayloadGenerator = new UnityCommandPayloadGenerator(); var blittableComponentGenerator = new UnityComponentDataGenerator(); var nonBlittableComponentGenerator = new UnityComponentGenerator(); var componentConversionGenerator = new UnityComponentConversionGenerator(); foreach (var enumType in enumsToGenerate) { var fileName = Path.ChangeExtension(enumType.name, fileExtension); var enumCode = enumGenerator.Generate(enumType, package); Content.Add(Path.Combine(relativeOutputPath, fileName), enumCode); } foreach (var type in typesToGenerate) { var fileName = Path.ChangeExtension(type.Name, fileExtension); var typeCode = typeGenerator.Generate(type, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, fileName), typeCode); } foreach (var component in componentsToGenerate) { var componentFileName = Path.ChangeExtension(component.Name, fileExtension); var componentCode = component.IsBlittable ? blittableComponentGenerator.Generate(component, package) : nonBlittableComponentGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, componentFileName), componentCode); if (component.CommandDefinitions.Count > 0) { var commandPayloadsFileName = Path.ChangeExtension($"{component.Name}CommandPayloads", fileExtension); var commandPayloadCode = commandPayloadGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, commandPayloadsFileName), commandPayloadCode); } if (component.EventDefinitions.Count > 0) { var eventsFileName = Path.ChangeExtension($"{component.Name}Events", fileExtension); var eventsCode = eventGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, eventsFileName), eventsCode); } var conversionFileName = Path.ChangeExtension($"{component.Name}Translation", fileExtension); var componentTranslationCode = componentConversionGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, conversionFileName), componentTranslationCode); } }
protected override void RunImpl() { var typeGenerator = new UnityTypeGenerator(); var enumGenerator = new UnityEnumGenerator(); var eventGenerator = new UnityEventGenerator(); var commandPayloadGenerator = new UnityCommandPayloadGenerator(); var commandComponentsGenerator = new UnityCommandComponentsGenerator(); var blittableComponentGenerator = new UnityComponentDataGenerator(); var componentConversionGenerator = new UnityComponentConversionGenerator(); var referenceTypeProviderGenerator = new UnityReferenceTypeProviderGenerator(); var commandStorageGenerator = new UnityCommandStorageGenerator(); var gameObjectComponentDispatcherGenerator = new UnityGameObjectComponentDispatcherGenerator(); var gameObjectCommandHandlersGenerator = new UnityGameObjectCommandHandlersGenerator(); var readerWriterGenerator = new UnityReaderWriterGenerator(); foreach (var enumType in enumsToGenerate) { var fileName = Path.ChangeExtension(enumType.name, fileExtension); var enumCode = enumGenerator.Generate(enumType, package); Content.Add(Path.Combine(relativeOutputPath, fileName), enumCode); } foreach (var type in typesToGenerate) { var fileName = Path.ChangeExtension(type.Name, fileExtension); var typeCode = typeGenerator.Generate(type, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, fileName), typeCode); } foreach (var component in componentsToGenerate) { var componentFileName = Path.ChangeExtension(component.Name, fileExtension); var componentCode = blittableComponentGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, componentFileName), componentCode); if (component.CommandDefinitions.Count > 0) { var commandPayloadsFileName = Path.ChangeExtension($"{component.Name}CommandPayloads", fileExtension); var commandPayloadCode = commandPayloadGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, commandPayloadsFileName), commandPayloadCode); var commandComponentsFileName = Path.ChangeExtension($"{component.Name}CommandComponents", fileExtension); var commandComponentsCode = commandComponentsGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, commandComponentsFileName), commandComponentsCode); var commandStorageFileName = Path.ChangeExtension($"{component.Name}CommandStorage", fileExtension); var commandStorageCode = commandStorageGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, commandStorageFileName), commandStorageCode); } if (component.EventDefinitions.Count > 0) { var eventsFileName = Path.ChangeExtension($"{component.Name}Events", fileExtension); var eventsCode = eventGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, eventsFileName), eventsCode); } var conversionFileName = Path.ChangeExtension($"{component.Name}Translation", fileExtension); var componentTranslationCode = componentConversionGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, conversionFileName), componentTranslationCode); var referenceProviderFileName = Path.ChangeExtension($"{component.Name}Providers", fileExtension); var referenceProviderTranslationCode = referenceTypeProviderGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, referenceProviderFileName), referenceProviderTranslationCode); var gameObjectComponentDispatcherFileName = Path.ChangeExtension($"{component.Name}GameObjectComponentDispatcher", fileExtension); var gameObjectComponentDispatcherCode = gameObjectComponentDispatcherGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, gameObjectComponentDispatcherFileName), gameObjectComponentDispatcherCode); var readerWriterFileName = Path.ChangeExtension($"{component.Name}ReaderWriter", fileExtension); var readerWriterCode = readerWriterGenerator.Generate(component, package, enumSet); Content.Add(Path.Combine(relativeOutputPath, readerWriterFileName), readerWriterCode); if (component.CommandDefinitions.Count > 0) { var monobehaviourCommandHandlerFileName = Path.ChangeExtension($"{component.Name}MonoBehaviourCommandHandlers", fileExtension); var monobehaviourCommandHandlerCode = gameObjectCommandHandlersGenerator.Generate(component, package); Content.Add(Path.Combine(relativeOutputPath, monobehaviourCommandHandlerFileName), monobehaviourCommandHandlerCode); } } }
protected override void RunImpl() { var typeGenerator = new UnityTypeGenerator(); var enumGenerator = new UnityEnumGenerator(); var eventGenerator = new UnityEventGenerator(); var commandPayloadGenerator = new UnityCommandPayloadGenerator(); var commandComponentsGenerator = new UnityCommandComponentsGenerator(); var blittableComponentGenerator = new UnityComponentDataGenerator(); var componentReactiveHandlersGenerator = new UnityReactiveComponentHandlersGenerator(); var componentSenderGenerator = new UnityComponentSenderGenerator(); var ecsViewManagerGenerator = new UnityEcsViewManagerGenerator(); var referenceTypeProviderGenerator = new UnityReferenceTypeProviderGenerator(); var componentReaderWriterGenerator = new UnityComponentReaderWriterGenerator(); var commandSenderReceiverGenerator = new UnityCommandSenderReceiverGenerator(); var reactiveComponentGenerator = new ReactiveComponentGenerator(); var reactiveCommandComponentGenerator = new ReactiveCommandComponentGenerator(); var componentDiffStorageGenerator = new ComponentDiffStorageGenerator(); var componentDiffDeserializerGenerator = new ComponentDiffDeserializerGenerator(); var commandDiffDeserializerGenerator = new CommandDiffDeserializerGenerator(); var commandDiffStorageGenerator = new CommandDiffStorageGenerator(); var viewStorageGenerator = new ViewStorageGenerator(); var commandMetaDataStorageGenerator = new CommandMetaDataStorageGenerator(); foreach (var enumTarget in enumsToGenerate) { var fileName = Path.ChangeExtension(enumTarget.Content.TypeName, FileExtension); var enumCode = enumGenerator.Generate(enumTarget.Content, enumTarget.Package); Content.Add(Path.Combine(enumTarget.OutputPath, fileName), enumCode); } foreach (var typeTarget in typesToGenerate) { var fileName = Path.ChangeExtension(typeTarget.Content.CapitalisedName, FileExtension); var typeCode = typeGenerator.Generate(typeTarget.Content, typeTarget.Package); Content.Add(Path.Combine(typeTarget.OutputPath, fileName), typeCode); } foreach (var componentTarget in componentsToGenerate) { var relativeOutputPath = componentTarget.OutputPath; var componentName = componentTarget.Content.ComponentName; var package = componentTarget.Package; var componentFileName = Path.ChangeExtension(componentName, FileExtension); var componentCode = blittableComponentGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, componentFileName), componentCode); if (componentTarget.Content.CommandDetails.Count > 0) { var commandPayloadsFileName = Path.ChangeExtension($"{componentName}CommandPayloads", FileExtension); var commandPayloadCode = commandPayloadGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandPayloadsFileName), commandPayloadCode); var commandComponentsFileName = Path.ChangeExtension($"{componentName}CommandComponents", FileExtension); var commandComponentsCode = commandComponentsGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandComponentsFileName), commandComponentsCode); var commandSenderReceiverFileName = Path.ChangeExtension($"{componentName}CommandSenderReceiver", FileExtension); var commandSenderReceiverCode = commandSenderReceiverGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandSenderReceiverFileName), commandSenderReceiverCode); var reactiveCommandComponentsFileName = Path.ChangeExtension($"{componentName}ReactiveCommandComponents", FileExtension); var reactiveCommandComponentsCode = reactiveCommandComponentGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, reactiveCommandComponentsFileName), reactiveCommandComponentsCode); var commandDiffDeserializerFileName = Path.ChangeExtension($"{componentName}CommandDiffDeserializer", FileExtension); var commandDiffDeserializerCode = commandDiffDeserializerGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandDiffDeserializerFileName), commandDiffDeserializerCode); var commandDiffStorageFileName = Path.ChangeExtension($"{componentName}CommandDiffStorage", FileExtension); var commandDiffStorageCode = commandDiffStorageGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandDiffStorageFileName), commandDiffStorageCode); var commandMetaDataStorageFileName = Path.ChangeExtension($"{componentName}CommandMetaDataStorage", FileExtension); var commandMetaDataStorageCode = commandMetaDataStorageGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandMetaDataStorageFileName), commandMetaDataStorageCode); } if (componentTarget.Content.EventDetails.Count > 0) { var eventsFileName = Path.ChangeExtension($"{componentName}Events", FileExtension); var eventsCode = eventGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, eventsFileName), eventsCode); } var updateSenderFileName = Path.ChangeExtension($"{componentName}UpdateSender", FileExtension); var updateSenderCode = componentSenderGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, updateSenderFileName), updateSenderCode); var reactiveComponentHandlersFileName = Path.ChangeExtension($"{componentName}ReactiveHandlers", FileExtension); var reactiveComponentHandlersCode = componentReactiveHandlersGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, reactiveComponentHandlersFileName), reactiveComponentHandlersCode); var ecsViewManagerFileName = Path.ChangeExtension($"{componentName}EcsViewManager", FileExtension); var ecsViewManagerCode = ecsViewManagerGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, ecsViewManagerFileName), ecsViewManagerCode); var componentDiffStorageFileName = Path.ChangeExtension($"{componentName}ComponentDiffStorage", FileExtension); var componentDiffStorageCode = componentDiffStorageGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, componentDiffStorageFileName), componentDiffStorageCode); var componentDiffDeserializerFileName = Path.ChangeExtension($"{componentName}ComponentDiffDeserializer", FileExtension); var componentDiffDeserializerCode = componentDiffDeserializerGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, componentDiffDeserializerFileName), componentDiffDeserializerCode); var reactiveComponentsFileName = Path.ChangeExtension($"{componentName}ReactiveComponents", FileExtension); var reactiveComponentsCode = reactiveComponentGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, reactiveComponentsFileName), reactiveComponentsCode); var referenceProviderFileName = Path.ChangeExtension($"{componentName}Providers", FileExtension); var referenceProviderTranslationCode = referenceTypeProviderGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, referenceProviderFileName), referenceProviderTranslationCode); var componentReaderWriterFileName = Path.ChangeExtension($"{componentName}ComponentReaderWriter", FileExtension); var componentReaderWriterCode = componentReaderWriterGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, componentReaderWriterFileName), componentReaderWriterCode); var viewStorageFileName = Path.ChangeExtension($"{componentName}ViewStorage", FileExtension); var viewStorageCode = viewStorageGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, viewStorageFileName), viewStorageCode); } }