示例#1
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);
                     }
                 }
             }
         }
     }
 }
示例#2
0
 public void RemoveTask(UTsak task)
 {
     tasks.Remove(task);
 }
示例#3
0
 public void AddTask(UTsak task)
 {
     tasks.Add(task);
 }
示例#4
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();
                    }
                }
            }
        }