Beispiel #1
0
        void LabelGUI()
        {
            EditorGUILayout.BeginHorizontal();
            {
                var curToggles = new bool[6];
                footerToggle.CopyTo(curToggles, 0);

                curToggles[0]       = GUILayout.Toggle(curToggles[0], "all", EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(1);
                curToggles[1]       = GUILayout.Toggle(curToggles[1], UnityEditorMemoPrefs.Label1, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(2);
                curToggles[2]       = GUILayout.Toggle(curToggles[2], UnityEditorMemoPrefs.Label2, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(3);
                curToggles[3]       = GUILayout.Toggle(curToggles[3], UnityEditorMemoPrefs.Label3, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(4);
                curToggles[4]       = GUILayout.Toggle(curToggles[4], UnityEditorMemoPrefs.Label4, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(5);
                curToggles[5]       = GUILayout.Toggle(curToggles[5], UnityEditorMemoPrefs.Label5, EditorStyles.toolbarButton);
                GUI.backgroundColor = Color.white;
                var label = WindowHelper.ChangeFooterStatus(selectLabel, ref curToggles);
                if (label != selectLabel)
                {
                    UndoHelper.WindowUndo(UndoHelper.UNDO_CHANGE_LABEL);   // avoid error. why? :(
                    postMemoLabel            = label;
                    selectLabel              = label;
                    memoTreeView.SelectLabel = ( UnityEditorMemoLabel )selectLabel;
                    memoTreeView.Reload();
                    GUIUtility.keyboardControl = 0;
                }
                footerToggle = curToggles;
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #2
0
        void CategoryMenu()
        {
            var selectedId = 0;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
            {
                //searchText = GUILayout.TextField( searchText, GUIHelper.Styles.SearchField, GUILayout.Width( 200 ) );
                //if( GUILayout.Button( "", GUIHelper.Styles.SearchFieldCancel ) ) {
                //    searchText = "";
                //    GUIUtility.keyboardControl = 0;
                //}
                GUILayout.Space(position.width * 0.48f);
                GUI.backgroundColor = Color.yellow;
                selectedId          = EditorGUILayout.Popup(selectCategoryId, WindowHelper.Data.CategoryList, EditorStyles.toolbarPopup);
                GUI.backgroundColor = Color.white;
            }
            EditorGUILayout.EndHorizontal();

            if (selectCategoryId != selectedId)
            {
                Undo.IncrementCurrentGroup();
                UndoHelper.WindowUndo(UndoHelper.UNDO_CHANGE_CATEGORY);
                GUIUtility.keyboardControl = 0;
                selectLabel  = 0;
                footerToggle = new bool[] { true, false, false, false, false, false };
                WindowHelper.CurCategory(selectedId).OnCategoryChange();
            }
            selectCategoryId = selectedId;
        }
Beispiel #3
0
        private void OnCategoryChange()
        {
            Undo.IncrementCurrentGroup();
            UndoHelper.WindowUndo(UndoHelper.UNDO_CHANGE_CATEGORY);

            selectLabel  = 0;
            footerToggle = new bool[] { true, false, false, false, false, false };
            WindowHelper.GetCategory(selectCategoryId).Initialize();
            MemoTreeViewInitialize();
            EditorGUIUtility.keyboardControl = 0;
        }
Beispiel #4
0
        void CategoryMenu()
        {
            var selectedId = 0;

            EditorGUILayout.BeginHorizontal(GUIHelper.Styles.NoSpaceBox, GUILayout.ExpandWidth(true));
            {
                GUILayout.Label("Category".ToBold());
                GUI.backgroundColor = Color.yellow;
                selectedId          = EditorGUILayout.Popup(selectCategoryId, WindowHelper.Data.CategoryList, EditorStyles.toolbarPopup);
                GUI.backgroundColor = Color.white;
            }
            EditorGUILayout.EndHorizontal();

            if (selectCategoryId != selectedId)
            {
                Undo.IncrementCurrentGroup();
                UndoHelper.WindowUndo(UndoHelper.UNDO_CHANGE_CATEGORY);
                GUIUtility.keyboardControl = 0;
                selectLabel  = 0;
                footerToggle = new bool[] { true, false, false, false, false, false };
                WindowHelper.CurCategory(selectCategoryId).OnCategoryChange();
            }
            selectCategoryId = selectedId;
        }
Beispiel #5
0
        /// <summary>
        /// display posting area
        /// </summary>
        void PostGUI()
        {
            var category = WindowHelper.GetCategory(selectCategoryId);

            EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true) });
            {
                GUILayout.Box("", GUIHelper.Styles.NoSpaceBox, new GUILayoutOption[] { GUILayout.Height(2), GUILayout.ExpandWidth(true) });

                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                {
                    GUILayout.Label(DateTime.Now.RenderDate());
                    GUILayout.Space(5);
                    GUI.backgroundColor = GUIHelper.Colors.LabelColor(postMemoLabel);
                    postMemoLabel       = EditorGUILayout.Popup(postMemoLabel, GUIHelper.LabelMenu, EditorStyles.toolbarPopup, GUILayout.Width(80));
                    GUI.backgroundColor = Color.white;

                    GUILayout.FlexibleSpace();

                    GUILayout.Label("URL", GUILayout.Width(30));
                    postMemoUrl = EditorGUILayout.TextField(postMemoUrl, EditorStyles.toolbarTextField);
                }
                EditorGUILayout.EndHorizontal();

                if (UnityEditorMemoPrefs.UnityEditorMemoUseSlack)
                {
                    EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                    {
                        UnityEditorMemoPrefs.UnityEditorMemoSlackChannel = EditorGUILayout.TextField(UnityEditorMemoPrefs.UnityEditorMemoSlackChannel);
                        postToSlack = GUILayout.Toggle(postToSlack, "Post to Slack", EditorStyles.toolbarButton, GUILayout.Width(100));
                    }
                    EditorGUILayout.EndHorizontal();
                }

                GUILayout.Space(5);

                EditorGUILayout.BeginVertical();
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Label((WindowHelper.TEXT_CREATEMEMO_TITLE + category.Name).ToMiddleBold());
                        GUILayout.FlexibleSpace();
                    }
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(5);

                    postScrollView = EditorGUILayout.BeginScrollView(postScrollView);
                    {
                        // draft
                        var tmp = EditorGUILayout.TextArea(memoText, GUIHelper.Styles.TextAreaWordWrap, new GUILayoutOption[] { GUILayout.MaxHeight(300) });
                        if (tmp != memoText)
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.WindowUndo(UndoHelper.UNDO_DRAFT);
                            memoText = tmp;
                        }
                    }
                    EditorGUILayout.EndScrollView();

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.FlexibleSpace();

                        postMemoTex = GUILayout.Toolbar(postMemoTex, GUIHelper.Textures.Emotions, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.MaxWidth(150) });

                        //if ( GUILayout.Button( "test", new GUILayoutOption[] { GUILayout.Height( 30 ), GUILayout.Width( 50 ) } ) ) {
                        //    for( int i = 0; i < 110; i++ ) {
                        //        category.AddMemo( new UnityEditorMemo( i.ToString(), postMemoLabel, postMemoTex ) );
                        //    }
                        //}

                        // post button
                        GUI.backgroundColor = Color.cyan;
                        if (GUILayout.Button("Post", new GUILayoutOption[] { GUILayout.Height(30), GUILayout.MaxWidth(120) }))
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.WindowUndo(UndoHelper.UNDO_POST);
                            if (!string.IsNullOrEmpty(memoText))
                            {
                                var memo = new UnityEditorMemo(memoText, postMemoLabel, postMemoTex, postMemoUrl);
                                memo.id = category.Memo.Count;
                                if (UnityEditorMemoPrefs.UnityEditorMemoUseSlack && postToSlack)
                                {
                                    if (SlackHelper.Post(memo, category.Name))
                                    {
                                        OnMemoPost(category, memo);
                                    }
                                }
                                else
                                {
                                    OnMemoPost(category, memo);
                                }
                            }
                            else
                            {
                                Debug.LogWarning(WindowHelper.WARNING_MEMO_EMPTY);
                            }
                        }
                        GUI.backgroundColor = Color.white;
                    }
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(5);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #6
0
        /// <summary>
        /// display posting area
        /// </summary>
        void PostContents()
        {
            var category = WindowHelper.CurCategory(selectCategoryId);

            EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true) });
            {
                GUILayout.Box("", GUIHelper.Styles.NoSpaceBox, new GUILayoutOption[] { GUILayout.Height(2), GUILayout.ExpandWidth(true) });
                GUILayout.Space(5);
                GUILayout.Label((WindowHelper.TEXT_CREATEMEMO_TITLE + category.Name).ToMiddleBold());
                EditorGUILayout.BeginVertical();
                {
                    // date
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Label(DateTime.Now.RenderDate(), GUIHelper.Styles.MemoBox, new GUILayoutOption[] { GUILayout.Width(150), GUILayout.Height(25) });
                        postMemoLabel = EditorGUILayout.Popup(postMemoLabel, GUIHelper.Label, GUILayout.Width(100));
                    }
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(5);

                    // draft
                    Undo.IncrementCurrentGroup();
                    UndoHelper.WindowUndo(UndoHelper.UNDO_DRAFT);
                    memoText = EditorGUILayout.TextArea(memoText, GUIHelper.Styles.TextAreaWordWrap, new GUILayoutOption[] { GUILayout.MaxHeight(300) });
                    EditorGUILayout.BeginHorizontal();
                    {
                        postMemoTex = GUILayout.Toolbar(postMemoTex, GUIHelper.Textures.Emotions, new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(150) });
                        GUILayout.FlexibleSpace();

                        //if ( GUILayout.Button( "test", new GUILayoutOption[] { GUILayout.Height( 30 ), GUILayout.Width( 50 ) } ) ) {
                        //    for( int i = 0; i < 110; i++ ) {
                        //        category.AddMemo( new UnityEditorMemo( i.ToString(), postMemoLabel, postMemoTex ) );
                        //    }
                        //}

                        // post button
                        GUI.backgroundColor = Color.cyan;
                        if (GUILayout.Button("Post", new GUILayoutOption[] { GUILayout.Height(30), GUILayout.Width(100) }))
                        {
                            if (!string.IsNullOrEmpty(memoText))
                            {
                                Undo.IncrementCurrentGroup();
                                UndoHelper.EditorMemoUndo(UndoHelper.UNDO_POST);

                                category.AddMemo(new UnityEditorMemo(memoText, postMemoLabel, postMemoTex));
                                memoText                   = "";
                                postMemoLabel              = 0;
                                postMemoTex                = 0;
                                memoScrollView             = Vector2.zero;
                                GUIUtility.keyboardControl = 0;
                            }
                            else
                            {
                                Debug.LogWarning(WindowHelper.WARNING_MEMO_EMPTY);
                            }
                        }
                        GUI.backgroundColor = Color.white;
                    }
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(5);
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
        }