public void OnGUI()
        {
            rect = EditorGUILayout.BeginVertical();
            {
                // header
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(Label);
                var preState = isFold;
                EditorGUILayout.BeginHorizontal(GUIHelper.Styles.MemoHeader);
                {
                    GUILayout.Space(5f);
                    GUILayout.Label(Date.ToBold(), new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(18) });
                    GUILayout.FlexibleSpace();
                    var fold = GUILayout.Toggle(isFold, "≡", EditorStyles.toolbarButton, new GUILayoutOption[] { GUILayout.Width(20) });
                    if (fold != preState)
                    {
                        UndoHelper.EditorMemoUndo(UndoHelper.UNDO_MEMO_EDIT);
                        GUIUtility.keyboardControl = 0;
                        isFold = fold;
                    }
                }
                EditorGUILayout.EndHorizontal();
                GUI.backgroundColor = Color.white;

                EditorGUILayout.BeginVertical(GUIHelper.Styles.MemoBack);
                {
                    GUILayout.Space(2);

                    // memo
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(5);
                        EditorGUILayout.BeginVertical(GUILayout.Width(32));
                        GUILayout.Box(GUIHelper.Textures.Emotions[( int )Tex], GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(32), GUILayout.Height(32) });
                        EditorGUILayout.EndVertical();

                        // Display Or Edit Memo
                        if (isFold)
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.EditorMemoUndo(UndoHelper.UNDO_MEMO_EDIT);
                            Memo = EditorGUILayout.TextArea(Memo, GUIHelper.Styles.TextAreaWordWrap);
                        }
                        else
                        {
                            GUILayout.Label(Memo, GUIHelper.Styles.LabelWordWrap);
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    ObjectRef.Draw(isFold);

                    GUILayout.Space(5f);

                    // Display Memo Edit Buttons
                    if (isFold)
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.FlexibleSpace();
                            Tex   = ( UnityEditorMemoTexture )GUILayout.Toolbar(( int )Tex, GUIHelper.Textures.Emotions, new GUILayoutOption[] { GUILayout.Height(25), GUILayout.Width(120) });
                            Label = ( UnityEditorMemoLabel )EditorGUILayout.Popup(( int )Label, GUIHelper.Label, GUILayout.Width(100));
                        }
                        EditorGUILayout.EndHorizontal();
                        GUILayout.Space(5);
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            eventProcess(Event.current);
        }
Exemple #2
0
        public void OnGUI()
        {
            rect = EditorGUILayout.BeginVertical();
            {
                // header
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(Label);
                var preState = isFoldout;
                EditorGUILayout.BeginHorizontal(GUIHelper.Styles.MemoHeader);
                {
                    var fold = GUILayout.Toggle(isFoldout, "≡", EditorStyles.toolbarButton, new GUILayoutOption[] { GUILayout.Width(20) });
                    if (fold != preState)
                    {
                        UndoHelper.EditorMemoUndo(UndoHelper.UNDO_MEMO_EDIT);
                        GUIUtility.keyboardControl = 0;
                        isFoldout = fold;
                    }

                    GUILayout.Label(Date.ToBold(), new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(18) });

                    GUILayout.FlexibleSpace();

                    if (!string.IsNullOrEmpty(URL))
                    {
                        if (GUILayout.Button(new GUIContent("open", GUIHelper.Textures.OpenLink), EditorStyles.toolbarButton, new GUILayoutOption[] { GUILayout.Width(60) }))
                        {
                            Application.OpenURL(URL);
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
                GUI.backgroundColor = Color.white;

                EditorGUILayout.BeginVertical(GUIHelper.Styles.MemoBack);
                {
                    GUILayout.Space(2);

                    // memo
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(5);

                        EditorGUILayout.BeginVertical(GUILayout.Width(32));
                        GUILayout.Box(GUIHelper.Textures.Emotions[( int )Tex], GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(32), GUILayout.Height(32) });
                        EditorGUILayout.EndVertical();

                        // display or edit memo
                        if (isFoldout)
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.EditorMemoUndo(UndoHelper.UNDO_MEMO_EDIT);
                            Memo = EditorGUILayout.TextArea(Memo, GUIHelper.Styles.TextAreaWordWrap);
                        }
                        else
                        {
                            GUIHelper.Styles.LabelWordWrap.fontSize = UnityEditorMemoPrefs.UnityEditorMemoFontSize;
                            GUILayout.Label(Memo, GUIHelper.Styles.LabelWordWrap);
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    ObjectRef.Draw(isFoldout);

                    GUILayout.Space(5);

                    // edit memo menu
                    if (isFoldout)
                    {
                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(37);

                            GUILayout.Label("URL", GUILayout.Width(30));
                            URL = EditorGUILayout.TextField(URL, GUIHelper.Styles.TextFieldWordWrap);

                            Tex   = ( UnityEditorMemoTexture )GUILayout.Toolbar(( int )Tex, GUIHelper.Textures.Emotions, new GUILayoutOption[] { GUILayout.Height(23), GUILayout.Width(110) });
                            Label = ( UnityEditorMemoLabel )EditorGUILayout.Popup(( int )Label, GUIHelper.LabelMenu, GUIHelper.Styles.LargeDropdown, GUILayout.Width(90));
                        }
                        EditorGUILayout.EndHorizontal();
                        GUILayout.Space(5);
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            eventProcess(Event.current);
        }