/// <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>Renombrar</para> /// </summary> /// <param name="rtItem"></param> /// <param name="define"></param> /// <returns></returns> private bool ProcessRename(Rect rtItem, GlobalDefine define) // Renombrar { if (define == null || define.Nombre != editingDefine) { return(false); } bool isInvalid = false; if (GlobalDefine.IsValidName(editingName) == false) { EditorGUILayout.HelpBox(StringsUEME.NOMBRE_INVALIDO_MDEFINE, MessageType.Error); isInvalid = true; } else if (editingName != define.Nombre && definesEditing.IsDefined(editingName)) { EditorGUILayout.HelpBox(StringsUEME.DEFINE_EXISTE_MDEFINE, MessageType.Error); isInvalid = true; } if ((Event.current.type == EventType.MouseDown && !UtilEvent.IsClicked(rtItem)) || (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return)) { if (isInvalid) { EndRename(); } else { doRename = true; } Event.current.Use(); return(true); } return(false); }