Ejemplo n.º 1
0
        public void Generate()
        {
            var type = Type.GetType($"{FullQualifiedName}");

            if (type == null)
            {
                throw new TypeLoadException($"Type could not be found ({FullQualifiedName})");
            }
            var isValueTypeEquatable = type.GetInterfaces().Contains(typeof(IEquatable <>));

            var templateVariables    = Generator.CreateTemplateVariablesMap(BaseType, Namespace, "BaseAtoms");
            var capitalizedValueType = BaseType.Capitalize();
            var templates            = Generator.GetTemplatePaths();
            var templateConditions   =
                Generator.CreateTemplateConditions(isValueTypeEquatable, Namespace, "BaseAtoms", BaseType);
            var baseWritePath =
                Path.Combine((Path.GetDirectoryName(AssetDatabase.GetAssetPath(this.GetInstanceID()))) ?? "Assets/",
                             "Generated");

            Directory.CreateDirectory(baseWritePath);

            Scripts.Clear();
            var t   = GenerationOptions;
            var idx = 0;

            while (t > 0)
            {
                if (t % 2 == 1)
                {
                    var atomType = AtomTypes.ALL_ATOM_TYPES[idx];

                    templateVariables["VALUE_TYPE_NAME"] =
                        atomType.IsValuePair ? $"{capitalizedValueType}Pair" : capitalizedValueType;
                    var valueType = atomType.IsValuePair ? $"{capitalizedValueType}Pair" : BaseType;
                    templateVariables["VALUE_TYPE"] = valueType;

                    var resolvedRelativeFilePath = Templating.ResolveVariables(templateVariables: templateVariables,
                                                                               toResolve: atomType.RelativeFileNameAndPath);
                    var targetPath = Path.Combine(baseWritePath, resolvedRelativeFilePath);

                    var newCreated = !File.Exists(targetPath);

                    Generator.Generate(new AtomReceipe(atomType, valueType), baseWritePath, templates,
                                       templateConditions, templateVariables);

                    if (newCreated)
                    {
                        AssetDatabase.ImportAsset(targetPath);
                    }
                    var ms = AssetDatabase.LoadAssetAtPath <MonoScript>(targetPath);
                    Scripts.Add(ms);
                }
                else
                {
                    Scripts.Add(null);
                }

                idx++;
                t >>= 1;
            }
        }
Ejemplo n.º 2
0
        static void Regenereate()
        {
            if (!Runtime.IsUnityAtomsRepo)
            {
                Debug.LogWarning("This is currently only available working in the Unity Atoms project...");
            }

            string path = EditorUtility.OpenFolderPanel("Select the 'Packages' folder (containing Core)", ".", "");

            if (string.IsNullOrEmpty(path))
            {
                Debug.LogWarning("Empty path. Abort.");
                return;
            }
            path = new Uri(Application.dataPath).MakeRelativeUri(new Uri(path)).ToString();

            var i = EditorUtility.DisplayDialogComplex("Regenerate Atoms",
                                                       $"Do you want to regenerate all Atoms and write them to '{path}'?\n",
                                                       "Yes, I know what I'm doing!", "Cancel", "");

            if (i == 1)
            {
                Debug.LogWarning("Cancelled generating Atoms.");
                return;
            }

            var itemsToRegenerate = new List <RegenerateItem>()
            {
                new RegenerateItem(
                    valueType: "Void",
                    baseWritePath: Path.Combine(path, "BaseAtoms"),
                    isValueEquatable: false,
                    atomTypesToGenerate: new List <AtomType>()
                {
                    AtomTypes.EVENT, AtomTypes.UNITY_EVENT, AtomTypes.BASE_EVENT_REFERENCE, AtomTypes.EVENT_INSTANCER, AtomTypes.BASE_EVENT_REFERENCE_LISTENER
                },
                    typeNamespace: "",
                    subUnityAtomsNamespace: "BaseAtoms"
                    ),
                new RegenerateItem(valueType: "bool", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Collider2D", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: false, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Collider", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: false, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Collision2D", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: false, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Collision", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: false, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Color", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "float", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "GameObject", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: false, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "int", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "string", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Vector2", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(valueType: "Vector3", baseWritePath: Path.Combine(path, "BaseAtoms"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: "BaseAtoms"),
                new RegenerateItem(
                    valueType: "AtomBaseVariable",
                    baseWritePath: Path.Combine(path, "BaseAtoms"),
                    isValueEquatable: false,
                    atomTypesToGenerate: new List <AtomType>()
                {
                    AtomTypes.EVENT, AtomTypes.ACTION, AtomTypes.UNITY_EVENT, AtomTypes.BASE_EVENT_REFERENCE, AtomTypes.EVENT_INSTANCER, AtomTypes.BASE_EVENT_REFERENCE_LISTENER
                },
                    typeNamespace: "",
                    subUnityAtomsNamespace: "BaseAtoms"
                    ),
                new RegenerateItem(valueType: "ColliderGameObject", baseWritePath: Path.Combine(path, "MonoHooks"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.MonoHooks", subUnityAtomsNamespace: "MonoHooks"),
                new RegenerateItem(valueType: "Collider2DGameObject", baseWritePath: Path.Combine(path, "MonoHooks"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.MonoHooks", subUnityAtomsNamespace: "MonoHooks"),
                new RegenerateItem(valueType: "TouchUserInput", baseWritePath: Path.Combine(path, "Mobile"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.Mobile", subUnityAtomsNamespace: "Mobile"),
                new RegenerateItem(valueType: "SceneField", baseWritePath: Path.Combine(path, "SceneMgmt"), isValueEquatable: true, atomTypesToGenerate: AtomTypes.ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.SceneMgmt", subUnityAtomsNamespace: "SceneMgmt"),
                new RegenerateItem(
                    valueType: "FSMTransitionData",
                    baseWritePath: Path.Combine(path, "FSM"),
                    isValueEquatable: false,
                    atomTypesToGenerate: new List <AtomType>()
                {
                    AtomTypes.EVENT, AtomTypes.ACTION, AtomTypes.UNITY_EVENT, AtomTypes.BASE_EVENT_REFERENCE, AtomTypes.EVENT_INSTANCER, AtomTypes.BASE_EVENT_REFERENCE_LISTENER
                },
                    typeNamespace: "",
                    subUnityAtomsNamespace: "FSM"
                    ),
            };


            foreach (var item in itemsToRegenerate)
            {
                var templates            = Generator.GetTemplatePaths();
                var templateConditions   = Generator.CreateTemplateConditions(item.IsValueEquatable, item.ValueTypeNamespace, item.SubUnityAtomsNamespace);
                var templateVariables    = Generator.CreateTemplateVariablesMap(item.ValueType, item.ValueTypeNamespace, item.SubUnityAtomsNamespace);
                var capitalizedValueType = item.ValueType.Capitalize();

                var atomTypesToGenerate = item.AtomTypesToGenerate;
                foreach (var atomType in atomTypesToGenerate)
                {
                    templateVariables["VALUE_TYPE_NAME"] = atomType.IsValuePair ? $"{capitalizedValueType}Pair" : capitalizedValueType;
                    var valueType = atomType.IsValuePair ? $"{capitalizedValueType}Pair" : item.ValueType;
                    templateVariables["VALUE_TYPE"] = valueType;
                    Generator.Generate(new AtomReceipe(atomType, valueType), item.BaseWritePath, templates, templateConditions, templateVariables);
                }
            }
            AssetDatabase.Refresh();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when editor is enabled.
        /// </summary>
        private void OnEnable()
        {
#if UNITY_2019_1_OR_NEWER
            var root = this.rootVisualElement;
#elif UNITY_2018_3_OR_NEWER
            var root = this.GetRootVisualContainer();
#endif
            var pathRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            pathRow.Add(new Label()
            {
                text = "Relative Write Path", style = { width = 180, marginRight = 8 }
            });
            var textfield = new TextField()
            {
                value = _baseWritePath, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _baseWritePath = evt.newValue);
            pathRow.Add(textfield);
            root.Add(pathRow);

            var typeNameRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            typeNameRow.Add(new Label()
            {
                text = "Type Name", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _valueType, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _valueType = evt.newValue);
            typeNameRow.Add(textfield);
            root.Add(typeNameRow);

            var equatableRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            equatableRow.Add(new Label()
            {
                text = "Is Type Equatable?", style = { width = 180, marginRight = 8 }
            });
            var equatableToggle = new Toggle()
            {
                value = _isValueTypeEquatable, style = { flexGrow = 1 }
            };
            equatableToggle.RegisterCallback <ChangeEvent <bool> >(evt => _isValueTypeEquatable = evt.newValue);
            equatableRow.Add(equatableToggle);
            root.Add(equatableRow);

            var typeNamespaceRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            typeNamespaceRow.Add(new Label()
            {
                text = "Type Namespace", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _valueTypeNamespace, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _valueTypeNamespace = evt.newValue);
            typeNamespaceRow.Add(textfield);
            root.Add(typeNamespaceRow);

            var subUnityAtomsNamespaceRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            subUnityAtomsNamespaceRow.Add(new Label()
            {
                text = "Sub Unity Atoms Namespace", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _subUnityAtomsNamespace, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _subUnityAtomsNamespace = evt.newValue);
            subUnityAtomsNamespaceRow.Add(textfield);
            root.Add(subUnityAtomsNamespaceRow);

            root.Add(CreateDivider());

            var typesToGenerateLabelRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            typesToGenerateLabelRow.Add(new Label()
            {
                text = "Type(s) to Generate"
            });
            root.Add(typesToGenerateLabelRow);

            foreach (var atomType in AtomTypes.ALL_ATOM_TYPES)
            {
                _typeVEDict.Add(atomType, CreateAtomTypeToGenerateToggleRow(atomType));
                root.Add(_typeVEDict[atomType]);
            }

            root.Add(CreateDivider());

            _typesToGenerateInfoRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Column }
            };
            _typesToGenerateInfoRow.Add(new Label()
            {
                style = { color = Color.yellow, height = 12 }
            });
            _typesToGenerateInfoRow.RegisterCallback <MouseUpEvent>((e) => { _typesToGenerateInfoRow.Query <Label>().First().text = ""; });
            root.Add(_typesToGenerateInfoRow);

            root.Add(CreateDivider());

            var buttonRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            var button1 = new Button(Close)
            {
                text  = "Close",
                style = { flexGrow = 1 }
            };
            buttonRow.Add(button1);

            var button2 = new Button(() =>
            {
                var templates            = Generator.GetTemplatePaths();
                var templateConditions   = Generator.CreateTemplateConditions(_isValueTypeEquatable, _valueTypeNamespace, _subUnityAtomsNamespace, _valueType);
                var templateVariables    = Generator.CreateTemplateVariablesMap(_valueType, _valueTypeNamespace, _subUnityAtomsNamespace);
                var capitalizedValueType = _valueType.Capitalize();

                _atomTypesToGenerate.ForEach((atomType) =>
                {
                    templateVariables["VALUE_TYPE_NAME"] = atomType.IsValuePair ? $"{capitalizedValueType}Pair" : capitalizedValueType;
                    var valueType = atomType.IsValuePair ? $"{capitalizedValueType}Pair" : _valueType;
                    templateVariables["VALUE_TYPE"] = valueType;
                    Generator.Generate(new AtomReceipe(atomType, valueType), _baseWritePath, templates, templateConditions, templateVariables);
                });

                AssetDatabase.Refresh();
            })
            {
                text  = "Generate",
                style = { flexGrow = 1 }
            };
            buttonRow.Add(button2);
            root.Add(buttonRow);
        }
        static void Regenereate()
        {
            if (!Runtime.IsUnityAtomsRepo)
            {
                Debug.LogWarning("This is currently only available working in the Unity Atoms project...");
            }

            string path = EditorUtility.OpenFolderPanel("Select the 'Packages' folder (containing Core)", ".", "");

            if (string.IsNullOrEmpty(path))
            {
                Debug.LogWarning("Empty path. Abort.");
                return;
            }
            // make path relative:
            path = new Uri(Application.dataPath).MakeRelativeUri(new Uri(path)).ToString();

            var i = EditorUtility.DisplayDialogComplex("Regenerate Atoms",
                                                       $"Do you want to regenerate all Atoms and write them to '{path}'?\n",
                                                       "Yes, I know what I'm doing!", "Cancel", "");

            if (i == 1)
            {
                Debug.LogWarning("Cancelled generating Atoms.");
                return;
            }
#if UNITY_EDITOR
            Runtime.IsUnityAtomsRepo = i == 0;
#endif
            List <AtomType> ALL_ATOM_TYPES = new List <AtomType>()
            {
                AtomTypes.ACTION,
                AtomTypes.ACTION_X2,
                AtomTypes.CONSTANT,
                AtomTypes.EVENT,
                AtomTypes.EVENT_X2,
                AtomTypes.LIST,
                AtomTypes.LISTENER,
                AtomTypes.LISTENER_X2,
                AtomTypes.REFERENCE,
                AtomTypes.SET_VARIABLE_VALUE,
                AtomTypes.UNITY_EVENT,
                AtomTypes.UNITY_EVENT_X2,
                AtomTypes.VARIABLE
            };



            var itemsToRegenerate = new List <RegenerateItem>()
            {
                new RegenerateItem(type: "bool", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "Collider2D", baseWritePath: Path.Combine(path, "Core"), isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "Collider", baseWritePath: Path.Combine(path, "Core"), isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "Color", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "float", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "GameObject", baseWritePath: Path.Combine(path, "Core"), isEquatable: false, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "int", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "string", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "Vector2", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "Vector3", baseWritePath: Path.Combine(path, "Core"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityEngine", subUnityAtomsNamespace: ""),
                new RegenerateItem(type: "TouchUserInput", baseWritePath: Path.Combine(path, "Mobile"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.Mobile", subUnityAtomsNamespace: "Mobile"),
                new RegenerateItem(type: "SceneField", baseWritePath: Path.Combine(path, "SceneMgmt"), isEquatable: true, atomTypesToGenerate: ALL_ATOM_TYPES, typeNamespace: "UnityAtoms.SceneMgmt", subUnityAtomsNamespace: "SceneMgmt"),
            };

            var generator = new Generator();
            foreach (var item in itemsToRegenerate)
            {
                generator.Generate(item.type, item.baseWritePath, item.isEquatable, item.atomTypesToGenerate, item.typeNamespace, item.subUnityAtomsNamespace);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Called when editor is enabled.
        /// </summary>
        private void OnEnable()
        {
            _atomTypesToGenerate = new List <AtomType>()
            {
                AtomTypes.ACTION,
                AtomTypes.ACTION_X2,
                AtomTypes.CONSTANT,
                AtomTypes.EVENT,
                AtomTypes.EVENT_X2,
                AtomTypes.LIST,
                AtomTypes.LISTENER,
                AtomTypes.LISTENER_X2,
                AtomTypes.REFERENCE,
                AtomTypes.SET_VARIABLE_VALUE,
                AtomTypes.UNITY_EVENT,
                AtomTypes.UNITY_EVENT_X2,
                AtomTypes.VARIABLE
            };
            generator = generator == null ? new Generator() : generator;

            var root    = this.rootVisualElement;
            var pathRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            pathRow.Add(new Label()
            {
                text = "Relative Write Path", style = { width = 180, marginRight = 8 }
            });
            var textfield = new TextField()
            {
                value = _writePath, style = { flexGrow = 1 }
            };

            textfield.RegisterCallback <ChangeEvent <string> >(evt => _writePath = evt.newValue);
            pathRow.Add(textfield);
            root.Add(pathRow);

            var typeNameRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            typeNameRow.Add(new Label()
            {
                text = "Type Name", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _type, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _type = evt.newValue);
            typeNameRow.Add(textfield);
            root.Add(typeNameRow);

            var equatableRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            equatableRow.Add(new Label()
            {
                text = "Is Type Equatable?", style = { width = 180, marginRight = 8 }
            });
            var equatableToggle = new Toggle()
            {
                value = _isEquatable, style = { flexGrow = 1 }
            };

            equatableToggle.RegisterCallback <ChangeEvent <bool> >(evt => _isEquatable = evt.newValue);
            equatableRow.Add(equatableToggle);
            root.Add(equatableRow);

            var typeNamespaceRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            typeNamespaceRow.Add(new Label()
            {
                text = "Type Namespace", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _typeNamespace, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _typeNamespace = evt.newValue);
            typeNamespaceRow.Add(textfield);
            root.Add(typeNamespaceRow);

            var subUnityAtomsNamespaceRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            subUnityAtomsNamespaceRow.Add(new Label()
            {
                text = "Sub Unity Atoms Namespace", style = { width = 180, marginRight = 8 }
            });
            textfield = new TextField()
            {
                value = _subUnityAtomsNamespace, style = { flexGrow = 1 }
            };
            textfield.RegisterCallback <ChangeEvent <string> >(evt => _subUnityAtomsNamespace = evt.newValue);
            subUnityAtomsNamespaceRow.Add(textfield);
            root.Add(subUnityAtomsNamespaceRow);

            root.Add(CreateDivider());

            var typesToGenerateLabelRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };

            typesToGenerateLabelRow.Add(new Label()
            {
                text = "Type(s) to Generate"
            });
            root.Add(typesToGenerateLabelRow);

            _typeVEDict.Add(AtomTypes.ACTION, CreateAtomTypeToGenerateToggleRow(AtomTypes.ACTION));
            root.Add(_typeVEDict[AtomTypes.ACTION]);
            _typeVEDict.Add(AtomTypes.ACTION_X2, CreateAtomTypeToGenerateToggleRow(AtomTypes.ACTION_X2));
            root.Add(_typeVEDict[AtomTypes.ACTION_X2]);
            _typeVEDict.Add(AtomTypes.CONSTANT, CreateAtomTypeToGenerateToggleRow(AtomTypes.CONSTANT));
            root.Add(_typeVEDict[AtomTypes.CONSTANT]);
            _typeVEDict.Add(AtomTypes.EVENT, CreateAtomTypeToGenerateToggleRow(AtomTypes.EVENT));
            root.Add(_typeVEDict[AtomTypes.EVENT]);
            _typeVEDict.Add(AtomTypes.EVENT_X2, CreateAtomTypeToGenerateToggleRow(AtomTypes.EVENT_X2));
            root.Add(_typeVEDict[AtomTypes.EVENT_X2]);
            _typeVEDict.Add(AtomTypes.LIST, CreateAtomTypeToGenerateToggleRow(AtomTypes.LIST));
            root.Add(_typeVEDict[AtomTypes.LIST]);
            _typeVEDict.Add(AtomTypes.LISTENER, CreateAtomTypeToGenerateToggleRow(AtomTypes.LISTENER));
            root.Add(_typeVEDict[AtomTypes.LISTENER]);
            _typeVEDict.Add(AtomTypes.LISTENER_X2, CreateAtomTypeToGenerateToggleRow(AtomTypes.LISTENER_X2));
            root.Add(_typeVEDict[AtomTypes.LISTENER_X2]);
            _typeVEDict.Add(AtomTypes.REFERENCE, CreateAtomTypeToGenerateToggleRow(AtomTypes.REFERENCE));
            root.Add(_typeVEDict[AtomTypes.REFERENCE]);
            _typeVEDict.Add(AtomTypes.SET_VARIABLE_VALUE, CreateAtomTypeToGenerateToggleRow(AtomTypes.SET_VARIABLE_VALUE));
            root.Add(_typeVEDict[AtomTypes.SET_VARIABLE_VALUE]);
            _typeVEDict.Add(AtomTypes.UNITY_EVENT, CreateAtomTypeToGenerateToggleRow(AtomTypes.UNITY_EVENT));
            root.Add(_typeVEDict[AtomTypes.UNITY_EVENT]);
            _typeVEDict.Add(AtomTypes.UNITY_EVENT_X2, CreateAtomTypeToGenerateToggleRow(AtomTypes.UNITY_EVENT_X2));
            root.Add(_typeVEDict[AtomTypes.UNITY_EVENT_X2]);
            _typeVEDict.Add(AtomTypes.VARIABLE, CreateAtomTypeToGenerateToggleRow(AtomTypes.VARIABLE));
            root.Add(_typeVEDict[AtomTypes.VARIABLE]);

            root.Add(CreateDivider());

            _typesToGenerateInfoRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Column }
            };
            _typesToGenerateInfoRow.Add(new Label()
            {
                style = { color = Color.yellow, height = 12 }
            });
            _typesToGenerateInfoRow.RegisterCallback <MouseUpEvent>((e) => { _typesToGenerateInfoRow.Query <Label>().First().text = ""; });
            root.Add(_typesToGenerateInfoRow);

            root.Add(CreateDivider());

            var buttonRow = new VisualElement()
            {
                style = { flexDirection = FlexDirection.Row }
            };
            var button1 = new Button(Close)
            {
                text  = "Close",
                style = { flexGrow = 1 }
            };

            buttonRow.Add(button1);

            var button2 = new Button(() => generator.Generate(
                                         type: _type,
                                         baseWritePath: _writePath,
                                         isEquatable: _isEquatable,
                                         atomTypesToGenerate: _atomTypesToGenerate,
                                         typeNamespace: _typeNamespace,
                                         subUnityAtomsNamespace: _subUnityAtomsNamespace
                                         ))
            {
                text  = "Generate",
                style = { flexGrow = 1 }
            };

            buttonRow.Add(button2);
            root.Add(buttonRow);
        }