/******* * Init * *******/ public static void Show(string buttonText, Action <string> callback) { AskTextPopup popup = new AskTextPopup(); popup.Prepare(buttonText, callback); PopupWindow.Show(new Rect(Screen.width / 2 - c_RectWidth / 2, c_RectHeight, c_RectWidth, c_RectHeight), popup); }
private void DrawLeftMenu() { EditorGUILayout.BeginVertical("box", GUILayout.Width(c_ScrollListWidthPercent * position.width)); { EditorGUILayout.LabelField("Menu", EditorStyles.boldLabel); GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); if (GUILayout.Button("Clear", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false))) { m_SearchText = ""; } m_SearchText = GUILayout.TextField(m_SearchText, EditorStyles.toolbarTextField, GUILayout.ExpandWidth(true)); GUILayout.EndHorizontal(); string[] searchTexts = m_SearchText.Split(' '); // New GUI.backgroundColor = c_ColorNew; if (GUILayout.Button("New Animation")) { AskTextPopup.Show("Create", NewObject); } GUI.backgroundColor = m_DefaultGUIBackgroundColor; EditorGUILayout.Space(); // List of all objects List <UTADirector> directors = GetAllUTADirectors(); m_MenuScrollView = EditorGUILayout.BeginScrollView(m_MenuScrollView, false, false); { for (int i = 0; i < directors.Count; i++) { string directorName = directors[i].name; if (_StringContains(directorName, searchTexts)) { if (_CurrentUTADirector == directors[i]) { GUI.backgroundColor = c_ColorCurrent; } if (GUILayout.Button(directorName)) { SelectCurrentObject(directors[i]); } } GUI.backgroundColor = m_DefaultGUIBackgroundColor; } } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); }
/************* * Right Menu * *************/ private void DrawRightMenu() { EditorGUILayout.BeginVertical("box"); m_MainWindowScrollView = EditorGUILayout.BeginScrollView(m_MainWindowScrollView, false, false); { if (_CurrentUTADirector == null) { EditorGUILayout.HelpBox("Select an animation or a create a new one using the left menu", MessageType.Info); } else { GUIStyle centeredLabel = new GUIStyle(EditorStyles.boldLabel) { alignment = TextAnchor.UpperCenter }; EditorGUILayout.LabelField(_CurrentUTADirector.name, centeredLabel); EditorGUILayout.Space(); //if (EditorGUITools.Button("Rename", c_ColorSave, GUILayout.Width(150))) //{ // AskTextPopup.Show("Rename", RenameCurrentObject); //} GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (EditorGUITools.Button("Duplicate", c_ColorDuplicate, GUILayout.Width(150))) { AskTextPopup.Show("Duplicate", DuplicateCurrentObject); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (EditorGUITools.Button("Delete", c_ColorDelete, GUILayout.Width(150))) { if (EditorUtility.DisplayDialog("Delete animation?", "Are you sure you want to delete this animation ?", "Do it!", "Hell no!")) { DeleteCurrentObject(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); }