Esempio n. 1
0
        public override void OnGUI(Rect rect)
        {
            if (memoEditorItem == null)
            {
                editorWindow.Close();
                return;
            }

            EditorGUI.BeginChangeCheck();

            memoEditorItem.OnGUI();
            if (memoEditorItem.IsContextClick)
            {
                var menu = new GenericMenu();
                menu.AddItem(new GUIContent("Edit"), false, () => {
                    memoEditorItem.IsEdit = true;
                });
                menu.AddItem(new GUIContent("Delete"), false, () => {
                    UndoHelper.SceneMemoUndo(UndoHelper.UNDO_SCENEMEMO_DELETE);
                    SceneMemoHelper.RemoveMemo(memo);
                    memo = null;
                    editorWindow.Close();
                });
                menu.ShowAsContext();
            }

            if (EditorGUI.EndChangeCheck())
            {
                SceneMemoHelper.SetDirty();
            }
        }
 private void DrawMemo()
 {
     Memo.OnGUI();
     if (Memo.IsContextClick)
     {
         var menu = new GenericMenu();
         menu.AddItem(new GUIContent("Edit"), false, () => {
             Memo.IsEdit = true;
         });
         menu.AddItem(new GUIContent("Delete"), false, () => {
             UndoHelper.SceneMemoUndo(UndoHelper.UNDO_SCENEMEMO_DELETE);
             SceneMemoHelper.RemoveMemo(Memo);
             Memo = null;
             editorWindow.Close();
         });
         menu.ShowAsContext();
     }
 }