void OnGUI()
    {
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);

        GUILayout.BeginVertical();

        EditorGUILayout.LabelField("Create New Graph:", EditorStyles.boldLabel);

        wantedName = EditorGUILayout.TextField("Enter Name: ", wantedName);

        GUILayout.Space(10);
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Create Graph", GUILayout.Height(40)))
        {
            if (!string.IsNullOrEmpty(wantedName) && wantedName != "Enter a name...")
            {
                NodeUtils.CreateNewGraph(wantedName);
                curPopup.Close();
            }
            else
            {
                EditorUtility.DisplayDialog("Node Message:", "Please enter a valid graph name!", "OK");
            }
        }

        if (GUILayout.Button("Cancel", GUILayout.Height(40)))
        {
            curPopup.Close();
        }
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.Space(10);
        GUILayout.EndHorizontal();
        GUILayout.Space(10);
    }
Exemplo n.º 2
0
    private void OnGUI()
    {
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);

        GUILayout.BeginVertical();

        EditorGUILayout.LabelField("Create a new Graph:", EditorStyles.boldLabel);
        graphName = EditorGUILayout.TextField("Enter name: ", graphName);

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Create Graph", GUILayout.Height(40)))
        {
            if (!string.IsNullOrEmpty(graphName) && graphName != "Enter a name...")
            {
                NodeUtilities.CreateNewGraph(graphName);
                currentPopup.Close();
            }
            else
            {
                EditorUtility.DisplayDialog("Graph Message", "Por favor, ingrese un nombre válido.", "OK");
            }
        }
        if (GUILayout.Button("Cancel", GUILayout.Height(40)))
        {
            currentPopup.Close();
        }
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();

        GUILayout.Space(20);
        GUILayout.EndHorizontal();
        GUILayout.Space(20);
    }