public void Draw(EntitasPreferencesConfig config) {
            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                EditorGUILayout.LabelField("VisualDebugging", EditorStyles.boldLabel);

                EditorGUI.BeginChangeCheck();
                {
                    _enableVisualDebugging = EditorGUILayout.Toggle("Enable Visual Debugging", _enableVisualDebugging);
                }
                var changed = EditorGUI.EndChangeCheck();

                if (changed) {
                    if (_enableVisualDebugging) {
                        _scriptingDefineSymbols.RemoveDefineSymbol(ENTITAS_DISABLE_VISUAL_DEBUGGING);
                    } else {
                        _scriptingDefineSymbols.AddDefineSymbol(ENTITAS_DISABLE_VISUAL_DEBUGGING);
                    }
                }

                EditorGUILayout.Space();

                _visualDebuggingConfig.defaultInstanceCreatorFolderPath =
                    EditorGUILayout.TextField("DefaultInstanceCreator Folder", _visualDebuggingConfig.defaultInstanceCreatorFolderPath);

                _visualDebuggingConfig.typeDrawerFolderPath =
                    EditorGUILayout.TextField("TypeDrawer Folder", _visualDebuggingConfig.typeDrawerFolderPath);
            }
            EditorGUILayout.EndVertical();
        }
        public void Draw(EntitasPreferencesConfig config)
        {
            EditorGUI.BeginChangeCheck();
            {
                EntitasEditorLayout.BeginVerticalBox();
                {
                    EditorGUILayout.LabelField("Entitas", EditorStyles.boldLabel);

                    _scriptCallOptimization = (ScriptCallOptimization)EditorGUILayout
                                              .EnumPopup("Optimizations", _scriptCallOptimization);
                }
                EntitasEditorLayout.EndVertical();
            }
            var changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                if (_scriptCallOptimization == ScriptCallOptimization.Disabled)
                {
                    _scriptingDefineSymbols.RemoveDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                }
                else
                {
                    _scriptingDefineSymbols.AddDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                }
            }
        }
예제 #3
0
        protected override void drawContent(EntitasPreferencesConfig config)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("Optimizations");
                var buttonStyle = new GUIStyle(EditorStyles.miniButtonLeft);
                if (_scriptCallOptimization == ScriptCallOptimization.Disabled)
                {
                    buttonStyle.normal = buttonStyle.active;
                }
                if (GUILayout.Button("Disabled", buttonStyle))
                {
                    _scriptCallOptimization = ScriptCallOptimization.Disabled;
                    _scriptingDefineSymbols.RemoveDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                }

                buttonStyle = new GUIStyle(EditorStyles.miniButtonRight);
                if (_scriptCallOptimization == ScriptCallOptimization.FastAndUnsafe)
                {
                    buttonStyle.normal = buttonStyle.active;
                }
                if (GUILayout.Button("Fast And Unsafe", buttonStyle))
                {
                    _scriptCallOptimization = ScriptCallOptimization.FastAndUnsafe;
                    _scriptingDefineSymbols.AddDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
예제 #4
0
 public void Initialize(EntitasPreferencesConfig config) {
     _scriptingDefineSymbols = new ScriptingDefineSymbols();
     _scriptCallOptimization = _scriptingDefineSymbols.buildTargetToDefSymbol.Values
                                     .All<string>(defs => defs.Contains(ENTITAS_FAST_AND_UNSAFE))
                                         ? ScriptCallOptimization.FastAndUnsafe
                                         : ScriptCallOptimization.Disabled;
 }
 public void Initialize(EntitasPreferencesConfig config)
 {
     _visualDebuggingConfig = new VisualDebuggingConfig(config);
     _scriptingDefineSymbols = new ScriptingDefineSymbols();
     _enableVisualDebugging = !_scriptingDefineSymbols.buildTargetToDefSymbol.Values
         .All<string>(defs => defs.Contains(ENTITAS_DISABLE_VISUAL_DEBUGGING));
 }
 public void Initialize(EntitasPreferencesConfig config)
 {
     _scriptingDefineSymbols = new ScriptingDefineSymbols();
     _scriptCallOptimization = _scriptingDefineSymbols.buildTargetToDefSymbol.Values
                               .All <string>(defs => defs.Contains(ENTITAS_FAST_AND_UNSAFE))
                                         ? ScriptCallOptimization.FastAndUnsafe
                                         : ScriptCallOptimization.Disabled;
 }
        public void Draw(EntitasPreferencesConfig config) {
            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                EditorGUILayout.LabelField("CodeGenerator", EditorStyles.boldLabel);

                drawGeneratedFolderPath();
                drawPools();
                drawCodeGenerators();
            }
            EditorGUILayout.EndVertical();
        }
        public void Draw(EntitasPreferencesConfig config) {
            var visualDebuggingConfig = new VisualDebuggingConfig(config);

            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                EditorGUILayout.LabelField("VisualDebugging", EditorStyles.boldLabel);

                visualDebuggingConfig.defaultInstanceCreatorFolderPath = EditorGUILayout.TextField("DefaultInstanceCreator Folder", visualDebuggingConfig.defaultInstanceCreatorFolderPath);
                visualDebuggingConfig.typeDrawerFolderPath = EditorGUILayout.TextField("TypeDrawer Folder", visualDebuggingConfig.typeDrawerFolderPath);
            }
            EditorGUILayout.EndVertical();
        }
        public void Draw(EntitasPreferencesConfig config) {
            var visualDebuggingConfig = new VisualDebuggingConfig(config);

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField("VisualDebugging", EditorStyles.boldLabel);

            visualDebuggingConfig.defaultInstanceCreatorFolderPath = EditorGUILayout.TextField("DefaultInstanceCreator Folder", visualDebuggingConfig.defaultInstanceCreatorFolderPath);
            visualDebuggingConfig.typeDrawerFolderPath = EditorGUILayout.TextField("TypeDrawer Folder", visualDebuggingConfig.typeDrawerFolderPath);

            EditorGUILayout.HelpBox("Specify the folder where to save generated templates.", MessageType.Info);

            EditorGUILayout.EndVertical();
        }
        public void Draw(EntitasPreferencesConfig config) {
            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField("CodeGenerator", EditorStyles.boldLabel);

            var codeGenerators = CodeGenerator.GetCodeGenerators();
            var codeGeneratorNames = codeGenerators.Select(cg => cg.Name).ToArray();
            var codeGeneratorConfig = new CodeGeneratorConfig(config, codeGeneratorNames);
            drawGeneratedFolderPath(codeGeneratorConfig);
            drawPools(codeGeneratorConfig);
            drawCodeGenerators(codeGeneratorConfig, codeGenerators);
            drawGenerateButton();

            EditorGUILayout.EndVertical();
        }
        void OnEnable()
        {
            _headerTexture = EntitasEditorLayout.LoadTexture("l:Entitas-Header");
            _localVersion = EntitasCheckForUpdates.GetLocalVersion();
            _config = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                .Where(type => type.ImplementsInterface<IEntitasPreferencesDrawer>())
                .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                .OrderBy(drawer => drawer.priority)
                .ToArray();

            foreach (var drawer in _preferencesDrawers) {
                drawer.Initialize(_config);
            }
        }
        void OnEnable()
        {
            _headerTexture      = EntitasEditorLayout.LoadTexture("l:EntitasHeader");
            _localVersion       = EntitasCheckForUpdates.GetLocalVersion();
            _config             = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                                  .Where(type => type.ImplementsInterface <IEntitasPreferencesDrawer>())
                                  .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                                  .OrderBy(drawer => drawer.priority)
                                  .ToArray();

            foreach (var drawer in _preferencesDrawers)
            {
                drawer.Initialize(_config);
            }
        }
        public void Draw(EntitasPreferencesConfig config)
        {
            var codeGeneratorConfig = new CodeGeneratorConfig(config);

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField("CodeGenerator", EditorStyles.boldLabel);

            // Generated Folder
            codeGeneratorConfig.generatedFolderPath = EditorGUILayout.TextField("Generated Folder", codeGeneratorConfig.generatedFolderPath);

            // Pools
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Pools");
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.TextField("DefaultPool");
            EditorGUI.EndDisabledGroup();

            var pools = new List<string>(codeGeneratorConfig.pools);
            for (int i = 0; i < pools.Count; i++) {
                EditorGUILayout.BeginHorizontal();
                pools[i] = EditorGUILayout.TextField(pools[i]);
                if (GUILayout.Button("-", GUILayout.Width(19), GUILayout.Height(14))) {
                    pools[i] = string.Empty;
                }
                EditorGUILayout.EndHorizontal();
            }

            if (GUILayout.Button("Add pool")) {
                pools.Add("PoolName");
            }

            if (pools.Count == 0) {
                EditorGUILayout.HelpBox("You can optimize the memory footprint of entities by creating multiple pools. " +
                "The code generator generates subclasses of PoolAttribute for each pool name. " +
                "You can assign components to a specific pool with the generated attribute, e.g. [UI] or [MetaGame], " +
                "otherwise they are assigned to the default pool.", MessageType.Info);
            }

            codeGeneratorConfig.pools = pools.ToArray();

            EditorGUILayout.Space();
            if (GUILayout.Button("Generate")) {
                CodeGeneratorEditor.Generate();
            }

            EditorGUILayout.EndVertical();
        }
        public void Initialize(EntitasPreferencesConfig config) {
            _codeGenerators = UnityCodeGenerator.GetCodeGenerators();
            var codeGeneratorNames = _codeGenerators.Select(cg => cg.Name).ToArray();
            _codeGeneratorConfig = new CodeGeneratorConfig(config, codeGeneratorNames);

            _pools = new List<string>(_codeGeneratorConfig.pools);

            _poolList = new UnityEditorInternal.ReorderableList(_pools, typeof(string), true, true, true, true);
            _poolList.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Custom Pools");;
            _poolList.drawElementCallback = (rect, index, isActive, isFocused) => {
                rect.width -= 20;
                _pools[index] = EditorGUI.TextField(rect, _pools[index]);
            };
            _poolList.onAddCallback = list => list.list.Add("New Pool");
            _poolList.onCanRemoveCallback = list => true;
            _poolList.onChangedCallback = list => GUI.changed = true;
        }
    void when_config()
    {
        EntitasPreferencesConfig config = null;
        before = () => {
            config = new EntitasPreferencesConfig(string.Empty);
        };

        it["gets string from empty config"] = () => config.ToString().should_be(string.Empty);
        it["gets default value from empty config and sets value for trimmed key"] = () => {
            config.GetValueOrDefault(" testKey ", " testValue ").should_be("testValue ");
            config.ToString().should_be("testKey = testValue \n");
        };

        it["sets value for trimmed key"] = () => {
            config[" test key "] = "test value";
            config["test key"].should_be("test value");
            config.ToString().should_be("test key = test value\n");
        };
    }
        void OnEnable() {
            var guid = AssetDatabase.FindAssets("l:Entitas-Header")[0];
            if (guid != null) {
                var path = AssetDatabase.GUIDToAssetPath(guid);
                _headerTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
            }

            _localVersion = EntitasCheckForUpdates.GetLocalVersion();

            _config = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                .Where(type => type.GetInterfaces().Contains(typeof(IEntitasPreferencesDrawer)))
                .OrderBy(type => type.FullName)
                .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                .ToArray();

            foreach (var drawer in _preferencesDrawers) {
                drawer.Initialize(_config);
            }
        }
예제 #17
0
        public void Draw(EntitasPreferencesConfig config) {
            EditorGUI.BeginChangeCheck();
            {
                EditorGUILayout.BeginVertical(GUI.skin.box);
                {
                    EditorGUILayout.LabelField("Entitas", EditorStyles.boldLabel);

                    _scriptCallOptimization = (ScriptCallOptimization)EditorGUILayout
                        .EnumPopup("Script Call Optimization", _scriptCallOptimization);
                }
                EditorGUILayout.EndVertical();
            }
            var changed = EditorGUI.EndChangeCheck();

            if (changed) {
                if (_scriptCallOptimization == ScriptCallOptimization.Disabled) {
                    _scriptingDefineSymbols.RemoveDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                } else {
                    _scriptingDefineSymbols.AddDefineSymbol(ENTITAS_FAST_AND_UNSAFE);
                }
            }
        }
예제 #18
0
        void OnEnable()
        {
            var guid = AssetDatabase.FindAssets("l:Entitas-Header")[0];

            if (guid != null)
            {
                var path = AssetDatabase.GUIDToAssetPath(guid);
                _headerTexture = AssetDatabase.LoadAssetAtPath <Texture2D>(path);
            }

            _localVersion = EntitasCheckForUpdates.GetLocalVersion();

            _config             = EntitasPreferences.LoadConfig();
            _preferencesDrawers = Assembly.GetAssembly(typeof(IEntitasPreferencesDrawer)).GetTypes()
                                  .Where(type => type.GetInterfaces().Contains(typeof(IEntitasPreferencesDrawer)))
                                  .OrderBy(type => type.FullName)
                                  .Select(type => (IEntitasPreferencesDrawer)Activator.CreateInstance(type))
                                  .ToArray();

            foreach (var drawer in _preferencesDrawers)
            {
                drawer.Initialize(_config);
            }
        }
 public void Initialize(EntitasPreferencesConfig config) {
     _visualDebuggingConfig = new VisualDebuggingConfig(config);
 }
 public static void SaveConfig(EntitasPreferencesConfig config)
 {
     File.WriteAllText(configPath, config.ToString());
 }
 public static void SaveConfig(EntitasPreferencesConfig config)
 {
     File.WriteAllText(CONFIG_PATH, config.ToString());
 }
 public void Draw(EntitasPreferencesConfig config)
 {
     EditorGUILayout.LabelField("Other Test " + _someObject.GetHashCode());
     GUILayout.Space(500);
 }
예제 #23
0
 public static void SaveConfig(EntitasPreferencesConfig config)
 {
     File.WriteAllText(CONFIG_PATH, config.ToString());
 }
 public void Initialize(EntitasPreferencesConfig config)
 {
     _someObject = new object();
 }
 public void Draw(EntitasPreferencesConfig config) {
     EditorGUILayout.LabelField("Test");
 }
 public static void SaveConfig(EntitasPreferencesConfig config)
 {
     File.WriteAllText(configPath, config.ToString());
 }