public static void Save(bool p_checkDefines = false) { Load(); string v_currentPath = KiltUtils.SearchFile(AUTOMATIC_DEFINE_SAVE); if (string.IsNullOrEmpty(v_currentPath)) { SerializerHelper.Serialize(s_defineByFolderName, "Editor", AUTOMATIC_DEFINE_SAVE, true, SerializationTypeEnum.JSON); } else { SerializerHelper.Serialize(s_defineByFolderName, v_currentPath, SerializationTypeEnum.JSON); } AssetDatabase.Refresh(); if (p_checkDefines) { CheckDefines(); } GlobalDefinesManager.Save(); }
void OnGUI() { Color oldColor = GUI.backgroundColor; defs = GlobalDefinesManager.Defines; scroll = GUILayout.BeginScrollView(scroll); GUI.backgroundColor = Color.cyan; if (GUILayout.Button("Add")) { defs.Add("NEW_DEFINE"); } GUI.backgroundColor = oldColor; GUILayout.Space(4); List <string> v_definesToRemove = new List <string>(); for (int i = 0; i < defs.Count; i++) { GUILayout.BeginHorizontal(); defs[i] = EditorGUILayout.TextField(defs[i]); GUI.backgroundColor = Color.red; if (GUILayout.Button("X", GUILayout.MaxWidth(24), GUILayout.MaxHeight(15))) { v_definesToRemove.AddChecking(defs[i]); } GUI.backgroundColor = oldColor; GUILayout.EndHorizontal(); } foreach (string v_defineToRemove in v_definesToRemove) { GlobalDefinesManager.RemoveDefineChecking(v_defineToRemove); } v_definesToRemove.Clear(); GUILayout.Space(4); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(); GUI.backgroundColor = Color.green; if (GUILayout.Button("Apply")) { GlobalDefinesManager.Save(); } GUI.backgroundColor = Color.magenta; if (GUILayout.Button("Refresh")) { GlobalDefinesManager.Load(); } GUILayout.EndHorizontal(); GUI.backgroundColor = oldColor; }