public void DrawTagsBtnsLayout(bool disabled) { Rect rect = GUILayoutUtility.GetRect(Screen.width, 50).Shrink(10); Rect btnRect = rect; //Update disable state of buttons based on selection breakBtn = DisableIf(haveSelection, breakBtn); emotionBtn = DisableIf(!haveSelection, emotionBtn); editBtn = DisableIf(haveSelection || !containsTag, editBtn); removeBtn = DisableIf(!containsTag, removeBtn); //Break button btnRect.width = 60; if (Utils.FlatButton(btnRect, new GUIContent(Resources.instance.breakIco), new Color(0.956f, 0.361f, 0.259f), ref breakBtn)) { tagToEdit = text.AddBreak(); } //Emotion button btnRect.Set(btnRect.x + btnRect.width + 5, btnRect.y, 130, btnRect.height); if (Utils.FlatButton(btnRect, new GUIContent("Add Emotion"), new Color(0.259f, 0.6f, 0.956f), ref emotionBtn)) { tagToEdit = text.AddTag(); } btnRect.Set(btnRect.x + btnRect.width + 5, btnRect.y, 70, btnRect.height); if (Utils.FlatButton(btnRect, new GUIContent("Edit"), new Color(0.259f, 0.6f, 0.956f), ref editBtn)) { tagToEdit = text.GetTag(); } btnRect.Set(btnRect.x + btnRect.width + 5, btnRect.y, 100, btnRect.height); if (Utils.FlatButton(btnRect, new GUIContent("Remove"), new Color(1.0f, 0.6f, 0.1f), ref removeBtn)) { if (text.haveSelection) { text.RemoveTag(); } else { text.RemoveTag(text.GetTag()); } } }
private void List_DrawElement(Rect rect, int index, bool isActive, bool isFocused) { Rect titleRect = new Rect(rect.x + 20, rect.y + 2, rect.width - 100, rect.height); GUI.Label(titleRect, speech.clips[index].clipName, EditorStyles.largeLabel); titleRect.Set(rect.x, rect.y + rect.height - 1, rect.width, 1.0f); EditorGUI.DrawRect(titleRect, Color.grey * 0.3f); bool haveClip = speech.clips[index].clip != null; float width = rect.width; rect.Set(width - 90, rect.y + 2, 50, rect.height - 4); if (Utils.FlatButton(rect, "Edit", Styles.clipGreenColor, 1.0f, rect.Contains(mousePosition) ? 0.5f : 0.2f)) { Selection.activeObject = speech.clips[index]; } rect.Set(width - 35, rect.y, 50, rect.height); Utils.DragArea(rect, speech.clips[index].clip); if (Utils.FlatButton(rect, "Clip", Styles.clipOrangeColor, 1.0f, haveClip ? (rect.Contains(mousePosition) ? 0.5f : 0.2f) : 1.0f) && haveClip) { Selection.activeObject = speech.clips[index].clip; } }
private void DrawProjectArea(Project project) { //Help box if nothing is selected if (project == null) { EditorGUILayout.HelpBox("Please select a project from the list above", MessageType.Info); return; } //Background box Rect rect = EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true)).Shrink(1); GUILayout.Space(160); EditorGUILayout.EndVertical(); Utils.FlatBox(rect, Styles.lightGreen, Styles.background, 0.01f, 40.0f); //Header Label Rect temp = rect; temp.Set(temp.x + 10, temp.y + 10, temp.width - 50, 20); GUI.Label(temp, project.name, Styles.projectHeaderLabel); //Open project in extern browser button temp.Set(temp.x + temp.width + 5, temp.y - 5, 30, 30); EditorGUIUtility.AddCursorRect(temp, MouseCursor.Link); if (GUI.Button(temp, Resources.instance.externalLink, GUIStyle.none)) { WebPage.ResembleProjects.Open(project.uuid); } //Description temp.Set(rect.x + 5, rect.y + 50, rect.width - 10, rect.height - 90); GUI.Label(temp, project.description, EditorStyles.largeLabel); //Buttons area rect.Set(temp.x, temp.y + temp.height + 5, temp.width, 30); if (Settings.haveProject) { //Unbind button temp.Set(rect.x + rect.width - 250, rect.y, 80, rect.height); if (Utils.FlatButton(temp, new GUIContent("Unbind"), Color.grey, 0.4f, 0.8f)) { Settings.UnbindProject(); } //Delete button temp.Set(rect.x + rect.width - 170, rect.y, 170, rect.height); if (Utils.FlatButton(temp, new GUIContent("Import clips"), Styles.purple, 0.4f, 0.8f)) { Settings.ImportClips(project); } } else { //Bind button temp.Set(rect.x + rect.width - 80, rect.y, 80, rect.height); if (Utils.FlatButton(temp, new GUIContent("Bind"), Styles.purple, 0.4f, 0.8f)) { Settings.BindProject(project); } //Delete button temp.Set(rect.x + rect.width - 180, rect.y, 100, rect.height); if (Utils.FlatButton(temp, new GUIContent("Delete"), Color.grey, 0.4f, 0.8f)) { Settings.DeleteProject(project); } } }