Beispiel #1
0
    private void OnGUI()
    {
        if (Notes == null)
        {
            GUILayout.Label("No notes!");
            return;
        }


        if (Notes.AllCategorys != null && Notes.AllCategorys.Count > 0)
        {
            GUILayout.BeginVertical("box");
            for (int i = 0; i < Notes.AllCategorys.Count; i++)
            {
                GUILayout.BeginHorizontal();
                Notes.AllCategorys[i].Name  = GUILayout.TextField(Notes.AllCategorys[i].Name);
                Notes.AllCategorys[i].Color = EditorGUILayout.ColorField(Notes.AllCategorys[i].Color, GUILayout.Width(100));
                if (GUILayout.Button("✓", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                {
                    UpdateText();
                }
                if (GUILayout.Button("✘", EditorStyles.wordWrappedLabel, GUILayout.Width(16)))
                {
                    Notes.AllCategorys.RemoveAt(i);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
        GUILayout.BeginVertical("box");
        if (openAdd)
        {
            GUILayout.BeginHorizontal();
            CatAdd   = GUILayout.TextField(CatAdd);
            ColorAdd = EditorGUILayout.ColorField(ColorAdd);
            GUILayout.EndHorizontal();
            if (GUILayout.Button("Add"))
            {
                bl_DevNotesInfo.Categorys cat = new bl_DevNotesInfo.Categorys();
                cat.Name  = CatAdd;
                cat.Color = ColorAdd;
                Notes.AllCategorys.Add(cat);
                openAdd  = false;
                CatAdd   = string.Empty;
                ColorAdd = Color.white;
                UpdateText();
            }
        }
        else
        {
            if (GUILayout.Button("Add New Category"))
            {
                openAdd = true;
            }
        }
        GUILayout.EndVertical();
    }
Beispiel #2
0
 public void Build(bl_DevNotesInfo notes)
 {
     Category = notes.AllCategorys[CatID];
 }