/// <summary> /// <para>Agregar de la interfaz</para> /// </summary> private void OnGUIAddMenu() // Agregar de la interfaz { EditorGUILayout.BeginHorizontal(); newDefineName = EditorGUILayout.TextField(newDefineName, GUILayout.MinWidth(TOP_MENU_BUTTON_WIDTH)); bool isInvalid = false; if (GlobalDefine.IsValidName(newDefineName) == false) { EditorGUILayout.HelpBox(StringsUEME.NOMBRE_INVALIDO_MDEFINE, MessageType.Error); isInvalid = true; } else if (definesEditing.IsDefined(newDefineName)) { EditorGUILayout.HelpBox(StringsUEME.DEFINE_EXISTE_MDEFINE, MessageType.Error); isInvalid = true; } EditorGUI.BeginDisabledGroup(isInvalid); if (isInvalid == false) { GUI.backgroundColor = Color.cyan; } if (GUILayout.Button(StringsUEME.ADD_DEFINE_MDEFINE, GUILayout.Width(TOGGLE_WIDTH))) { GlobalDefine newDefine = definesEditing.GetData(newDefineName); if (newDefine != null) { newDefine.SetEnableAll(true); } GUI.FocusControl(""); newDefineName = CrearNuevoNombreDefine(); } GUI.backgroundColor = Color.white; EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); }
/// <summary> /// <para>Item Define</para> /// </summary> /// <param name="no"></param> /// <param name="defineItem"></param> private void OnGUIDefineItem(int no, GlobalDefine defineItem) // Item Define { if (defineItem == null) { return; } bool isSelected = IsSelectedDefine(defineItem); bool isEditing = IsEditingDefine(defineItem); bool isEnabledAll = defineItem.IsEnabledAll(); GUI.backgroundColor = isSelected ? Color.yellow : Color.white; Rect rtItem = EditorGUILayout.BeginHorizontal("TextArea", GUILayout.MinHeight(25f)); GUI.backgroundColor = Color.white; GUI.color = isEnabledAll ? Color.cyan : Color.black; EditorGUILayout.LabelField(no.ToString() + ".", GUILayout.Width(20f)); GUI.color = Color.white; if (isEditing) { GUI.SetNextControlName(STR_DEFINE_NAME_TEXT_FIELD); editingName = EditorGUILayout.TextField(editingName, GUILayout.MinWidth(DEFINE_LABEL_LONG_WIDTH)); if (isEditingName == false) { isEditingName = true; GUI.FocusControl(STR_DEFINE_NAME_TEXT_FIELD); } } else { GUIStyle style = isEnabledAll ? EditorStyles.whiteLabel : EditorStyles.miniLabel; if (isSelected) { EditorGUILayout.LabelField(defineItem.Nombre, style, GUILayout.MinWidth(DEFINE_LABEL_WIDTH)); if (GUILayout.Button(StringsUEME.RENOMBRAR_MDEFINE, GUILayout.Width(BUTTON_WIDTH))) { BeginRename(defineItem); isEditingName = false; } if (GUILayout.Button(StringsUEME.BORRAR_MDEFINE, GUILayout.Width(BUTTON_WIDTH))) { listDeleteReserved.Add(defineItem.Nombre); } } else { EditorGUILayout.LabelField(defineItem.Nombre, style, GUILayout.MinWidth(DEFINE_LABEL_LONG_WIDTH)); } } GUI.backgroundColor = isEnabledAll ? Color.cyan : Color.white; bool newValue = GUILayout.Toggle(isEnabledAll, "All", EditorStyles.miniButtonLeft, GUILayout.Width(BUTTON_WIDTH)); if (newValue != isEnabledAll) { defineItem.SetEnableAll(newValue); SetSelectedDefine(defineItem); } OnGUIDefineItemToggle(defineItem, COMPILER.CSHARP); OnGUIDefineItemToggle(defineItem, COMPILER.CSHARP_EDITOR); OnGUIDefineItemToggle(defineItem, COMPILER.UNITY_SCRIPT); EditorGUILayout.EndHorizontal(); ProcessInput(rtItem, defineItem); }