예제 #1
0
        public static CodeGenFile[] Generate(ICodeGeneratorDataProvider provider, string directory, ICodeGenerator[] codeGenerators)
        {
            directory = GetSafeDir(directory);
            CleanDir(directory);

            var generatedFiles = new List<CodeGenFile>();

            foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
                var files = generator.Generate(provider.poolNames);
                generatedFiles.AddRange(files);
                writeFiles(directory, files);
            }

            foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
                var files = generator.Generate(provider.componentInfos);
                generatedFiles.AddRange(files);
                writeFiles(directory, files);
            }

            foreach (var generator in codeGenerators.OfType<IBlueprintsCodeGenerator>()) {
                var files = generator.Generate(provider.blueprintNames);
                generatedFiles.AddRange(files);
                writeFiles(directory, files);
            }

            return generatedFiles.ToArray();
        }
예제 #2
0
        public static void Generate(ICodeGeneratorDataProvider provider, string directory, ICodeGenerator[] codeGenerators) {
            directory = GetSafeDir(directory);
            CleanDir(directory);
            
            foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
                writeFiles(directory, generator.Generate(provider.poolNames));
            }

            foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
                writeFiles(directory, generator.Generate(provider.componentInfos));
            }
        }
        public static void Generate(Type[] types, string[] poolNames, string dir, ICodeGenerator[] codeGenerators) {
            dir = GetSafeDir(dir);
            CleanDir(dir);
            
            foreach (var generator in codeGenerators.OfType<IPoolCodeGenerator>()) {
                writeFiles(dir, generator.Generate(poolNames));
            }

            var components = GetComponents(types);
            foreach (var generator in codeGenerators.OfType<IComponentCodeGenerator>()) {
                writeFiles(dir, generator.Generate(components));
            }

            var systems = GetSystems(types);
            foreach (var generator in codeGenerators.OfType<ISystemCodeGenerator>()) {
                writeFiles(dir, generator.Generate(systems));
            }
        }