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 Draw(EntitasPreferencesConfig config) { EntitasEditorLayout.BeginVerticalBox(); { EditorGUILayout.LabelField("Visual Debugging", 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("Default Instance Creators", _visualDebuggingConfig.defaultInstanceCreatorFolderPath); _visualDebuggingConfig.typeDrawerFolderPath = EditorGUILayout.TextField("Type Drawers", _visualDebuggingConfig.typeDrawerFolderPath); } EntitasEditorLayout.EndVertical(); }
public CodeGeneratorConfig(EntitasPreferencesConfig config, string[] codeGenerators) { _config = config; _defaultEnabledCodeGenerators = joinValues(codeGenerators); // Assigning will apply default values to missing keys generatedFolderPath = generatedFolderPath; pools = pools; enabledCodeGenerators = enabledCodeGenerators; }
public CodeGeneratorConfig(EntitasPreferencesConfig config, string[] codeGenerators) { _config = config; _defaultEnabledCodeGenerators = joinValues(codeGenerators); // Assigning will apply default values to missing keys generatedFolderPath = generatedFolderPath; contexts = contexts; enabledCodeGenerators = enabledCodeGenerators; }
public void Draw(EntitasPreferencesConfig config) { EntitasEditorLayout.BeginVerticalBox(); { EditorGUILayout.LabelField("Code Generator", EditorStyles.boldLabel); drawGeneratedFolderPath(); drawContexts(); drawCodeGenerators(); } EntitasEditorLayout.EndVertical(); }
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"); }; }
public void Initialize(EntitasPreferencesConfig config) { _availableGeneratorNames = UnityCodeGenerator.GetCodeGenerators() .Select(cg => cg.Name) .OrderBy(generatorName => generatorName) .ToArray(); _codeGeneratorConfig = new CodeGeneratorConfig(config, _availableGeneratorNames); _contexts = new List<string>(_codeGeneratorConfig.contexts); _contextList = new UnityEditorInternal.ReorderableList(_contexts, typeof(string), true, true, true, true); _contextList.drawHeaderCallback = rect => EditorGUI.LabelField(rect, "Contexts"); _contextList.drawElementCallback = (rect, index, isActive, isFocused) => { rect.width -= 20; _contexts[index] = EditorGUI.TextField(rect, _contexts[index]); }; _contextList.onAddCallback = list => list.list.Add("New Context"); _contextList.onCanRemoveCallback = list => true; _contextList.onChangedCallback = list => GUI.changed = true; }
public static void SaveConfig(EntitasPreferencesConfig config) { File.WriteAllText(CONFIG_PATH, config.ToString()); }
public VisualDebuggingConfig(EntitasPreferencesConfig config) { _config = config; defaultInstanceCreatorFolderPath = defaultInstanceCreatorFolderPath; typeDrawerFolderPath = typeDrawerFolderPath; }