#if UNITY_2018_3_OR_NEWER using System; using System.Linq; using System.Collections.Generic; using UnityEditor; using UnityEngine; #if UNITY_2019_1_OR_NEWER using UnityEngine.UIElements; #elif UNITY_2018_3_OR_NEWER using UnityEditor.Experimental.UIElements; using UnityEngine.Experimental.UIElements; using UnityEngine.Experimental.UIElements.StyleEnums; #endif namespace UnityAtoms.Editor { /// /// Editor class for the `Generator`. Use it via the top window bar at _Tools / Unity Atoms / Generator_. Only availble in `UNITY_2019_1_OR_NEWER`. /// public class GeneratorEditor : EditorWindow { /// /// Create the editor window. /// [MenuItem("Tools/Unity Atoms/Generator")] static void Init() { var window = GetWindow(false, "Unity Atoms - Generator"); window.position = new Rect(Screen.width / 2, Screen.height / 2, 440, 540); window.Show(); } private string _valueType = ""; private bool _isValueTypeEquatable = true; private string _valueTypeNamespace = ""; private string _subUnityAtomsNamespace = ""; private List _atomTypesToGenerate = new List(AtomTypes.ALL_ATOM_TYPES); private Dictionary _typeVEDict = new Dictionary(); private VisualElement _typesToGenerateInfoRow; /// /// Add provided `AtomType` to the list of Atom types to be generated. /// /// The `AtomType` to be added. private void AddAtomTypeToGenerate(AtomType atomType) { _atomTypesToGenerate.Add(atomType); foreach (KeyValuePair> entry in AtomTypes.DEPENDENCY_GRAPH) { if (!_typeVEDict.ContainsKey(entry.Key)) continue; if (entry.Value.All((atom) => _atomTypesToGenerate.Contains(atom))) { _typeVEDict[entry.Key].SetEnabled(true); } } _typesToGenerateInfoRow.Query