示例#1
0
    /// <summary>
    ///
    /// </summary>
    void DrawFoot()
    {
        GUILayout.BeginArea(new Rect(0, Screen.height - 50, Screen.width, 25));
        GUILayout.BeginHorizontal("box");
        GUILayout.Label("Show: ", GUILayout.Width(50));
        List <string> cl = new List <string>();

        cl.Add("All");
        cl.AddRange(CategoryString.ToArray());
        ShowCat  = EditorGUILayout.Popup(ShowCat, cl.ToArray(), EditorStyles.toolbarPopup, GUILayout.Width(70));
        showSort = ShowCat != 0;
        if (GUILayout.Button("History", EditorStyles.toolbarButton, GUILayout.Width(75)))
        {
            windowID = 1;
        }
        if (GUILayout.Button("Stats", EditorStyles.toolbarButton, GUILayout.Width(75)))
        {
            windowID = 2;
        }
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("✎", EditorStyles.wordWrappedLabel, GUILayout.Width(22)))
        {
            bl_DevNotesCategorys cat = EditorWindow.GetWindow <bl_DevNotesCategorys>();
            cat.SetNotes(Notes, this);
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
示例#2
0
 void DrawAddBox()
 {
     if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
     {
         AddNewJob();
     }
     GUILayout.BeginVertical("box");
     AddCat     = EditorGUILayout.Popup(AddCat, CategoryString.ToArray(), GUILayout.Width(60));
     AddNote    = GUILayout.TextArea(AddNote, GUILayout.Height(22));
     AddComment = GUILayout.TextArea(AddComment, GUILayout.Height(50));
     GUILayout.EndVertical();
     GUILayout.BeginHorizontal();
     if (GUILayout.Button(new GUIContent(" ADD", icons[1]), EditorStyles.toolbarButton))
     {
         AddNewJob();
     }
     if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.Width(100)))
     {
         AddComment = string.Empty;
         showAddBox = false;
         AddNote    = string.Empty;
     }
     GUILayout.EndHorizontal();
 }
示例#3
0
    void DrawReorderableNotesContent(Rect rect, int index, bool isActive, bool isFocused)
    {
        var  element  = notesList.serializedProperty.GetArrayElementAtIndex(index);
        var  comment  = element.FindPropertyRelative("Comment");
        var  category = element.FindPropertyRelative("CategoryID");
        bool altStyle = (index % 2) == 0;

        if (altStyle)
        {
            DrawWhiteBox(rect, new Color(0, 0, 0, 0.3f));
        }
        Rect r = rect;

        r.width = 3;
        r.x    -= 3;
        Color categoryColor = Notes.AllCategorys[category.intValue].Color;

        DrawWhiteBox(r, categoryColor);

        r        = rect;
        r.x     += 5;
        r.width -= 50;
        r.height = EditorGUIUtility.singleLineHeight;
        var note = element.FindPropertyRelative("Note");

        if (OpenCommentID != index)
        {
            GUI.Label(r, note.stringValue);
        }
        else
        {
            var sourceNote = Notes.Notes[index];
            sourceNote.Note = EditorGUI.TextField(r, note.stringValue);

            r.y               += EditorGUIUtility.singleLineHeight + 2;
            r.height           = 40;
            r.width           -= 20;
            sourceNote.Comment = EditorGUI.TextArea(r, comment.stringValue);

            r        = rect;
            r.y     += EditorGUIUtility.singleLineHeight + 2;
            r.height = EditorGUIUtility.singleLineHeight;
            r.x     += r.width - 64;
            r.width  = 60;

            sourceNote.CategoryID = EditorGUI.Popup(r, category.intValue, CategoryString.ToArray(), EditorStyles.toolbarPopup);
            r.y += EditorGUIUtility.singleLineHeight + 4;
            if (GUI.Button(r, "Done", EditorStyles.toolbarButton))
            {
                serializedObject.ApplyModifiedProperties();
                SaveNotes();
                OpenCommentID = -1;
            }
        }

        r        = rect;
        r.x     += r.width - 20;
        r.width  = 16;
        r.height = EditorGUIUtility.singleLineHeight;
        if (GUI.Button(r, "✓", EditorStyles.wordWrappedLabel))
        {
            OnCompleteJob(index);
        }
        r.x -= 20;
        if (GUI.Button(r, "✉", EditorStyles.wordWrappedLabel))
        {
            OpenCommentID = index;
        }
    }
示例#4
0
    /// <summary>
    ///
    /// </summary>
    void DrawNotes()
    {
        DrawWindowArea();
        if (Notes != null)
        {
            noteScroll = GUILayout.BeginScrollView(noteScroll, "box");
            bool bg = false;
            for (int i = 0; i < Notes.Notes.Count; i++)
            {
                if (showSort)
                {
                    if (Notes.Notes[i].CategoryID != (ShowCat - 1))
                    {
                        continue;
                    }
                }
                Rect r    = EditorGUILayout.BeginHorizontal();
                Rect boxr = r;
                if (bg)
                {
                    r.height += 2;
                    GUI.Box(r, GUIContent.none);
                }
                GUI.color  = Notes.AllCategorys[Notes.Notes[i].CategoryID].Color;
                boxr.width = 3;
                GUI.DrawTexture(boxr, whiteBox, ScaleMode.StretchToFill);
                GUI.color = Color.white;
                GUILayout.Space(3);
                Notes.Notes[i].CategoryID = EditorGUILayout.Popup(Notes.Notes[i].CategoryID, CategoryString.ToArray(), EditorStyles.toolbarPopup, GUILayout.Width(60));
                Notes.Notes[i].Note       = GUILayout.TextField(Notes.Notes[i].Note, EditorStyles.wordWrappedLabel);
                if (GUILayout.Button("✉", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                {
                    OpenCommentID = i;
                }
                if (i > 0)
                {
                    if (GUILayout.Button("↑", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                    {
                        MoveField(i, true);
                    }
                }
                else
                {
                    GUILayout.Box("", EditorStyles.wordWrappedLabel, GUILayout.Width(16));
                }
                if (i < Notes.Notes.Count - 1)
                {
                    if (GUILayout.Button("↓", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                    {
                        MoveField(i, false);
                    }
                }
                else
                {
                    GUILayout.Box("", EditorStyles.wordWrappedLabel, GUILayout.Width(16));
                }
                if (GUILayout.Button("✓", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                {
                    OnCompleteJob(i);
                }
                EditorGUILayout.EndHorizontal();
                if (OpenCommentID != -1 && OpenCommentID == i)
                {
                    GUILayout.BeginVertical("box");
                    Notes.Notes[i].Comment = GUILayout.TextField(Notes.Notes[i].Comment, EditorStyles.helpBox, GUILayout.Height(50));
                    GUILayout.BeginHorizontal("box");
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("✓", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                    {
                        if (!string.IsNullOrEmpty(Notes.Notes[i].Comment))
                        {
                            SaveNotes();
                        }
                        OpenCommentID = -1;
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                }
                GUILayout.Space(1);
                bg = !bg;
            }
            GUILayout.EndScrollView();
        }

        if (!showAddBox)
        {
            GUILayout.BeginVertical("box");
            if (GUILayout.Button(new GUIContent(" ADD", icons[1]), EditorStyles.toolbarButton))
            {
                showAddBox = true;
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            GUILayout.BeginVertical("box");
            AddCat     = EditorGUILayout.Popup(AddCat, CategoryString.ToArray(), GUILayout.Width(60));
            AddNote    = GUILayout.TextArea(AddNote, GUILayout.Height(22));
            AddComment = GUILayout.TextArea(AddComment, GUILayout.Height(50));
            GUILayout.EndVertical();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(new GUIContent(" ADD", icons[1]), EditorStyles.toolbarButton))
            {
                AddNewJob();
            }
            if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.Width(100)))
            {
                AddComment = string.Empty;
                showAddBox = false;
                AddNote    = string.Empty;
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndArea();
    }