Exemple #1
0
 private void DrawTodoList()
 {
     for (int i = 0; i < m_showTodos.Count; i++)
     {
         var todos = m_showTodos[i].m_items;
         // todo 在此绘制列表样式
         foreach (TodoItem item in todos)
         {
             // 根据等级区分颜色
             Color levelColor = UTodoColor.GetColorByLevel((UTaskLevel)item.todoLevel);
             using (new HorizontalBlock(GUILayout.Height(40), GUILayout.ExpandWidth(true)))
             {
                 GUI.color = levelColor;
                 using (new VerticalBlock(EditorStyles.textArea, GUILayout.Width(20), GUILayout.ExpandHeight(true)))
                 {
                     GUILayoutUtility.GetRect(0, 100000, 0, 100000);
                 }
                 GUI.color = Color.white;
                 using (new VerticalBlock())
                 {
                     using (new HorizontalBlock())
                     {
                         GUILayout.Label("LEVEL" + item.todoLevel);
                         GUILayout.FlexibleSpace();
                         GUILayout.Label(item.scriptPath, EditorStyles.miniBoldLabel);
                     }
                     GUILayout.Space(5f);
                     GUILayout.Label(item.todoContext, EditorStyles.largeLabel);
                 }
                 GUILayout.FlexibleSpace();
                 using (new GUILayout.VerticalScope(GUILayout.Width(position.width / 10), GUILayout.ExpandHeight(true)))
                 {
                     GUI.color = Color.red;
                     if (GUILayout.Button("delete"))
                     {
                     }
                     GUI.color = Color.green;
                     if (GUILayout.Button("finish"))
                     {
                     }
                     GUI.color = Color.white;
                 }
             }
             Event e    = Event.current;
             var   rect = GUILayoutUtility.GetLastRect();
             if (e.isMouse && e.type == EventType.MouseDown && rect.Contains(e.mousePosition) && e.clickCount == 2)
             {
                 var todoItem = item;
                 EditorApplication.delayCall += () =>
                 {
                     UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(todoItem.scriptPath, todoItem.lineCount);
                 };
             }
         }
     }
 }
Exemple #2
0
 private void DrawTsakList()
 {
     using (new GUILayout.VerticalScope())
     {
         for (int i = 0; i < TaskRec.tasks.Count; i++)
         {
             UTsak task = TaskRec.tasks[i];
             GUI.color = UTodoColor.GetColorByLevel(task.level);
             using (new GUILayout.HorizontalScope(GUI.skin.box, GUILayout.Height(40), GUILayout.ExpandHeight(true)))
             {
                 GUI.color = Color.white;
                 using (new GUILayout.HorizontalScope(GUILayout.Width(20), GUILayout.ExpandHeight(true)))
                 {
                     if (GUILayout.Button(UTodoIcon.GetTypeIcon(task.type.ToString().ToLower()), GUILayout.Width(30), GUILayout.Height(30)))
                     {
                     }
                     if (GUILayout.Button(UTodoIcon.GetFlagIcon("yellow"), GUILayout.Width(30), GUILayout.Height(30)))
                     {
                     }
                 }
                 using (new VerticalBlock(GUILayout.ExpandHeight(true)))
                 {
                     using (new GUILayout.HorizontalScope())
                     {
                         GUILayout.Label("任务序号" + (i + 1));
                         GUILayout.Label(task.name);
                         GUILayout.Label("负责人:" + task.pricipal);
                     }
                     using (new GUILayout.HorizontalScope())
                     {
                         GUILayout.Label("任务内容:" + task.context);
                     }
                 }
                 GUILayout.FlexibleSpace();
                 using (new GUILayout.HorizontalScope(GUILayout.Width(position.width / 15), GUILayout.ExpandHeight(true)))
                 {
                     GUILayout.FlexibleSpace();
                     if (GUILayout.Button(UTodoIcon.GetForkIcon("red"), GUILayout.Width(30), GUILayout.Height(30)))
                     {
                         TaskRec.RemoveTask(task);
                     }
                 }
             }
         }
     }
 }
Exemple #3
0
        private void OnGUI()
        {
            using (new GUILayout.ScrollViewScope(m_scrollPos))
            {
                using (new GUILayout.VerticalScope())
                {
                    GUI.color = new Color(0.85f, 0.85f, 0.85f);
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        GUI.color = Color.white;
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Index", GUILayout.Width(90));
                            tId = UTodoWindow.TaskRec.NextTaskId;
                            EditorGUILayout.IntField(tId);
                        }
                    }
                    GUI.color = UTodoColor.GetColorByLevel(tLevel);
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        GUI.color = Color.white;
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Level", GUILayout.Width(90));
                            tLevel = (UTaskLevel)EditorGUILayout.EnumPopup(tLevel);
                        }
                    }
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Type", GUILayout.Width(90));
                            tType = (UTaskType)EditorGUILayout.EnumPopup(tType);
                        }
                    }
                    GUI.color = new Color(0.85f, 0.85f, 0.85f);
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        GUI.color = Color.white;
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Pricipal", GUILayout.Width(90));
                            string[] names = UTodoWindow.UserGroup.userNames;
                            userIndex = EditorGUILayout.Popup(userIndex, names);
                            tPricipal = names[userIndex];
                        }
                    }
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Name", GUILayout.Width(90));
                            tName = EditorGUILayout.TextField(tName);
                        }
                    }
                    GUI.color = new Color(0.85f, 0.85f, 0.85f);
                    using (new GUILayout.VerticalScope(GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true)))
                    {
                        GUI.color = Color.white;
                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label("Task Context", GUILayout.Width(90));
                            tContext = EditorGUILayout.TextField(tContext);
                        }
                    }
                }

                GUILayout.FlexibleSpace();
                using (new GUILayout.VerticalScope(EditorStyles.helpBox))
                {
                    if (GUILayout.Button("确定添加"))
                    {
                        UTsak task = new UTsak();
                        task.id       = tId;
                        task.level    = tLevel;
                        task.name     = tName;
                        task.context  = tContext;
                        task.pricipal = tPricipal;
                        task.type     = tType;
                        UTodoWindow.TaskRec.AddTask(task);

                        tId       = -1;
                        tLevel    = UTaskLevel.Prior;
                        tName     = "New Task";
                        tContext  = "New Context";
                        tPricipal = "springdong";

                        // 先提示
                        window.Close();
                    }
                    if (GUILayout.Button("关闭窗口"))
                    {
                        window.Close();
                    }
                }
            }
        }