Пример #1
0
    void CountTasks(bl_DevNotesInfo notes)
    {
        CompletedTaks.Clear();
        MaxCatCount = 0;

        for (int i = 0; i < notes.HistoryNotes.Count; i++)
        {
            if (CompletedTaks.Exists(x => x.CatID == notes.HistoryNotes[i].CategoryID))
            {
                TaskCount tc = CompletedTaks.Find(x => x.CatID == notes.HistoryNotes[i].CategoryID);
                tc.Completed++;
                if (tc.Completed > MaxCatCount)
                {
                    MaxCatCount = tc.Completed;
                }
            }
            else
            {
                TaskCount tc = new TaskCount();
                tc.CatID     = notes.HistoryNotes[i].CategoryID;
                tc.Completed = 1;
                tc.Build(notes);
                CompletedTaks.Add(tc);
            }
        }
        MaxCatCount += 5;
    }
Пример #2
0
 public void LoadList(bool forced = false)
 {
     if (Notes == null || forced)
     {
         Notes = settings.GetNoteList();
     }
 }
Пример #3
0
    void FetchDateState(bl_DevNotesInfo notes)
    {
        todayJobs         = 0;
        weekJobs          = 0;
        monthJobs         = 0;
        jobsInMonthPerDay = new Dictionary <int, int>();
        for (int i = 0; i < notes.HistoryNotes.Count; i++)
        {
            var note = notes.HistoryNotes[i];
            if (string.IsNullOrEmpty(note.CompleteDate))
            {
                continue;
            }

            DateTime date = bl_DevNotesUtils.ParseDate(note.CompleteDate);
            var      ts   = new TimeSpan(DateTime.Now.Ticks - date.Ticks);

            if (ts.TotalDays <= 30)
            {
                if (!jobsInMonthPerDay.ContainsKey((int)ts.TotalDays))
                {
                    jobsInMonthPerDay.Add((int)ts.TotalDays, 1);
                }
                else
                {
                    jobsInMonthPerDay[(int)ts.TotalDays]++;
                }
            }

            if (ts.TotalDays <= 1)
            {
                todayJobs++;
                weekJobs++;
                monthJobs++;
                continue;
            }
            if (ts.TotalDays <= 7)
            {
                weekJobs++;
                monthJobs++;
                continue;
            }
            if (ts.TotalDays <= 30)
            {
                monthJobs++;
                continue;
            }
        }
        dateStatsFetchs = true;
    }
Пример #4
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="notes"></param>
    public void DrawStats(bl_DevNotesInfo notes)
    {
        bl_DevNoteList.DrawWindowArea();
        GUILayout.BeginVertical("box");
        GUILayout.Label(string.Format("Task completed: <size=20>{0}</size>", notes.HistoryNotes.Count));

        CountTasks(notes);
        if (!dateStatsFetchs || lastCount != notes.HistoryNotes.Count)
        {
            FetchDateState(notes);
            BuildGraph();
        }

        GUILayout.BeginVertical("box");
        int barSize = Screen.width - 105;

        for (int i = 0; i < CompletedTaks.Count; i++)
        {
            GUILayout.BeginHorizontal();
            Rect r = GUILayoutUtility.GetRect(70, EditorGUIUtility.singleLineHeight);
            DrawWhiteBox(r, Color.black);
            EditorGUI.LabelField(r, CompletedTaks[i].Category.Name + "s");

            Color c = CompletedTaks[i].Category.Color;
            c.a = 0.4f;
            float bz = ((float)CompletedTaks[i].Completed / (float)MaxCatCount) * (float)barSize;
            r = GUILayoutUtility.GetRect(bz, EditorGUIUtility.singleLineHeight);
            DrawWhiteBox(r, c);
            r.width = 75;
            r.x    += 5;
            GUI.Label(r, CompletedTaks[i].Completed.ToString());
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(4);
        }
        GUILayout.EndVertical();

        DrawDateStats();
        DrawDateGraph();

        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.EndArea();
        lastCount = notes.HistoryNotes.Count;
    }
Пример #5
0
    public bl_DevNotesInfo GetNoteList()
    {
        string          path = allList[CurrentList].GetPath();
        bl_DevNotesInfo list;

        if (File.Exists(path))
        {
            string json = File.ReadAllText(path);
            list = JsonUtility.FromJson <bl_DevNotesInfo>(json);
        }
        else
        {
            using (StreamWriter sw = File.CreateText(path)) { }
            list = new bl_DevNotesInfo();
            AssetDatabase.Refresh();
        }
        return(list);
    }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 void AddNewJob()
 {
     if (Notes == null)
     {
         Notes = new bl_DevNotesInfo();
     }
     bl_DevNotesInfo.Info info = new bl_DevNotesInfo.Info();
     info.CategoryID = AddCat;
     info.Note       = AddNote;
     info.Comment    = AddComment;
     info.noteType   = bl_DevNotesInfo.NoteType.Note;
     info.CreateDate = GetTodayDateAsString();
     Notes.Notes.Add(info);
     SaveNotes();
     showAddBox = false;
     AddComment = string.Empty;
     AddNote    = string.Empty;
     Repaint();
 }
Пример #7
0
    public void SaveList(bl_DevNotesInfo data)
    {
        string json = JsonUtility.ToJson(data);
        string path = allList[CurrentList].GetPath();

        if (File.Exists(path))
        {
            StreamWriter writer = new StreamWriter(path, false);
            writer.WriteLine(json);
            writer.Close();
        }
        else
        {
            using (StreamWriter sw = File.CreateText(path))
            {
                sw.Write(json);
            }
        }
        AssetDatabase.Refresh();
    }
Пример #8
0
 public void Build(bl_DevNotesInfo notes)
 {
     Category = notes.AllCategorys[CatID];
 }
Пример #9
0
 public void SetNotes(bl_DevNotesInfo not, bl_DevNoteList manager)
 {
     Notes       = not;
     ListManager = manager;
 }