예제 #1
0
        static Dictionary <string, string> getSourceFiles(string path)
        {
            var config = new CodeGeneratorConfig(EntitasPreferencesEditor.LoadConfig());

            return(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories)
                   .Where(p => !p.Contains(config.generatedFolderPath))
                   .ToDictionary(p => p, p => File.ReadAllText(p)));
        }
        static void generateITypeDrawer(string typeName)
        {
            var config   = new VisualDebuggingConfig(EntitasPreferencesEditor.LoadConfig());
            var folder   = config.typeDrawerFolderPath;
            var filePath = folder + "Type_TypeDrawer.cs";
            var template = string.Format(typeDrawerTemplateFormat, typeName);

            generateTemplate(folder, filePath, template);
        }
        static void generateIDefaultInstanceCreator(string typeName)
        {
            var config   = new VisualDebuggingConfig(EntitasPreferencesEditor.LoadConfig());
            var folder   = config.defaultInstanceCreatorFolderPath;
            var filePath = folder + "Default_type_InstanceCreator.cs";
            var template = string.Format(defaultInstanceCreatorTemplateFormat, typeName);

            generateTemplate(folder, filePath, template);
        }
예제 #4
0
        public static void Generate()
        {
            var types  = Assembly.GetAssembly(typeof(Entity)).GetTypes();
            var config = new CodeGeneratorConfig(EntitasPreferencesEditor.LoadConfig());

            var disabledCodeGenerators = config.disabledCodeGenerators;
            var codeGenerators         = GetCodeGenerators()
                                         .Where(type => !disabledCodeGenerators.Contains(type.Name))
                                         .Select(type => (ICodeGenerator)Activator.CreateInstance(type))
                                         .ToArray();

            Entitas.CodeGenerator.CodeGenerator.Generate(types, config.pools, config.generatedFolderPath, codeGenerators);

            AssetDatabase.Refresh();
        }
예제 #5
0
        public static void Generate()
        {
            var types  = Assembly.GetAssembly(typeof(Entity)).GetTypes();
            var config = new CodeGeneratorConfig(EntitasPreferencesEditor.LoadConfig());

            var codeGenerators = new ICodeGenerator[] {
                new ComponentExtensionsGenerator(),
                new IndicesLookupGenerator(),
                new PoolAttributeGenerator(),
                new PoolsGenerator(),
                new SystemExtensionsGenerator()
            };

            Entitas.CodeGenerator.CodeGenerator.Generate(types, config.pools, config.generatedFolderPath, codeGenerators);

            AssetDatabase.Refresh();
        }