void DrawOptionsColumn(Rect rect, int rowIdx, SignalReceiver target)
 {
     if (!readonlySignal)
     {
         rect.height = Styles.OptionsStyle.normal.background.height;
         rect.width  = Styles.OptionsStyle.normal.background.width;
         GUI.SetNextControlName(SignalOptions);
         if (GUI.Button(rect, Styles.OptionsStyle.normal.background, GUIStyle.none))
         {
             var menu = new GenericMenu();
             menu.AddItem(EditorGUIUtility.TrTextContent(Styles.SignalListDuplicateOption), false, () =>
             {
                 var evtCloner = ScriptableObject.CreateInstance <UnityEventCloner>();
                 evtCloner.evt = target.GetReactionAtIndex(rowIdx);
                 var clone     = Object.Instantiate(evtCloner);
                 target.AddEmptyReaction(clone.evt);
                 m_ShouldRefreshParent = true;
             });
             menu.AddItem(EditorGUIUtility.TrTextContent(Styles.SignalListDeleteOption), false, () =>
             {
                 target.RemoveAtIndex(rowIdx);
                 m_ShouldRefreshParent = true;
             });
             menu.ShowAsContext();
         }
     }
 }
Exemplo n.º 2
0
 void DrawOptionsButton(Rect rect, int rowIdx, SignalReceiver target)
 {
     GUI.SetNextControlName(SignalOptions);
     if (EditorGUI.DropdownButton(rect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.iconButton))
     {
         var menu = new GenericMenu();
         menu.AddItem(new GUIContent(Styles.SignalListDuplicateOption), false, () =>
         {
             Undo.RecordObject(target, Styles.UndoDuplicateRow);
             var evtCloner = ScriptableObject.CreateInstance <UnityEventCloner>();
             evtCloner.evt = target.GetReactionAtIndex(rowIdx);
             var clone     = Object.Instantiate(evtCloner);
             target.AddEmptyReaction(clone.evt);
             m_TreeView.dirty = true;
             PrefabUtility.RecordPrefabInstancePropertyModifications(target);
         });
         menu.AddItem(new GUIContent(Styles.SignalListDeleteOption), false, () =>
         {
             Undo.RecordObject(target, Styles.UndoDeleteRow);
             target.RemoveAtIndex(rowIdx);
             m_TreeView.dirty = true;
             PrefabUtility.RecordPrefabInstancePropertyModifications(target);
         });
         menu.ShowAsContext();
     }
 }