private void CreateContextMenu() { contextMenu = new GenericMenu(); contextMenu.AddItem(JuicyEditorUtils.GetContent("Reset"), false, ResetFeedback); contextMenu.AddSeparator(string.Empty); contextMenu.AddItem(JuicyEditorUtils.GetContent("Copy"), false, CopyFeedback); if (FeedbackListCopyHelper.HasCopy) { contextMenu.AddItem(JuicyEditorUtils.GetContent("Paste"), false, PasteFeedback); } else { contextMenu.AddDisabledItem(JuicyEditorUtils.GetContent("Paste")); } contextMenu.AddSeparator(string.Empty); contextMenu.AddItem(JuicyEditorUtils.GetContent("Debug"), debugView.boolValue, DebugView); }
private void CreateAddFeedbackMenu() { addFeedbackMenu = new GenericMenu(); types = JuicyEditorUtils.GetAllSubtypes(typeof(JuicyFeedbackBase)); foreach (var type in types) { addFeedbackMenu.AddItem(JuicyEditorUtils.GetContent( FeedbackAttribute.GetPath(type) ), false, () => { AddFeedback(type); serializedObject.ApplyModifiedProperties(); }); } }
private void ShowElementContextMenu(int index) { SerializedProperty property = feedbackListProp.GetArrayElementAtIndex(index); JuicyFeedbackBase feedback = property.objectReferenceValue as JuicyFeedbackBase; var itemMenu = new GenericMenu(); itemMenu.AddItem(JuicyEditorUtils.GetContent("Remove|Remove feedback from List"), false, () => Remove(property, feedback, index)); itemMenu.AddItem(JuicyEditorUtils.GetContent("Reset|Resets the feedback to default"), false, () => ResetEditor(property, feedback)); itemMenu.AddSeparator(string.Empty); itemMenu.AddItem(JuicyEditorUtils.GetContent("Copy|Copy feedback values"), false, () => { FeedbackCopyHelper.CopyReference(feedback); JuicyEditorUtils.CopyFeedback(property, feedback); }); if (FeedbackCopyHelper.HasCopy) { itemMenu.AddItem(JuicyEditorUtils.GetContent("Paste|Paste feedback values"), false, () => JuicyEditorUtils.PasteFeedback(property, feedback)); itemMenu.AddItem(JuicyEditorUtils.GetContent("Paste as new|Paste copied feedback values as a new feedback"), false, PasteAsNew); itemMenu.AddItem(JuicyEditorUtils.GetContent("Paste Reference|Paste feedback reference"), false, () => { FeedbackCopyHelper.PasteReference(juicyFeedbackList.feedbackList); }); } else { itemMenu.AddDisabledItem(JuicyEditorUtils.GetContent("Paste")); } Rect menuRect = new Rect(Event.current.mousePosition, Vector2.zero); menuRect.y -= 10; itemMenu.DropDown(menuRect); }
private void CreateContextMenu() { var e = Event.current; Vector2 position = e.mousePosition; var menu = new GenericMenu(); for (int i = 0; i < names.Length; i++) { string name = names[i]; menu.AddItem( JuicyEditorUtils.GetContent(name), false, ChangeCurve, i); } menu.DropDown(new Rect(position, Vector2.zero)); e.Use(); }
private void CreateContextMenu() { var e = Event.current; Vector2 position = e.mousePosition; var menu = new GenericMenu(); bool isActive = targetIsSelf.boolValue; menu.AddItem( JuicyEditorUtils.GetContent("This"), isActive, SetTargetIsSelf, true); menu.AddItem( JuicyEditorUtils.GetContent("Other"), !isActive, SetTargetIsSelf, false); menu.DropDown(new Rect(position, Vector2.zero)); }