private void OnNoteTake()
        {
            var noteField = transformContainer.Q("noteField");

            transformContainer.Remove(noteField);
            var db      = StickyNoteManagementUtils.LoadOrCreateDatabase();
            var localId = StickyNoteManagementUtils.GetLocalIdentifierFromSceneObject(_transform.gameObject);

            if (localId != 0 && db.GetStickySceneNotes(localId).Length != 0)
            {
                noteField = new VisualElement();
                noteField.style.flexDirection = FlexDirection.Row;
                foreach (var stickySceneNote in db.GetStickySceneNotes(localId))
                {
                    noteField.Add(new Label(stickySceneNote.paperColor.ToString()));
                }
                transformContainer.Add(noteField);
            }
            else
            {
                var noteInstance = ScriptableObject.CreateInstance <StickyNote>();
                AssetDatabase.AddObjectToAsset(noteInstance, db);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                db.NewStickySceneNote(
                    StickyNoteManagementUtils.GetLocalIdentifierFromSceneObject(_transform.gameObject), noteInstance);
                EditorUtility.SetDirty(db);
            }
        }
        public override VisualElement CreateInspectorGUI()
        {
            _note = target as StickyNote;
            var database       = StickyNoteManagementUtils.LoadOrCreateDatabase();
            var root           = new VisualElement();
            var noteStyleSheet = Resources.Load <StyleSheet>("StickyNotesStyle");

            root.styleSheets.Add(noteStyleSheet);
            root.name = "row";

            var headerLabel = new TextField()
            {
                name = "headerTextField"
            };

            headerLabel.SetValueWithoutNotify(_note.noteHeader);
            headerLabel.RegisterValueChangedCallback(evt =>
            {
                _note.noteHeader = evt.newValue;
                EditorUtility.SetDirty(_note);
            });
            var headerVisualElement = new VisualElement()
            {
                name = "header"
            };

            headerVisualElement.Add(headerLabel);
            root.Add(headerVisualElement);

            var noteLabel = new TextField()
            {
                name = "contentTextField"
            };

            noteLabel.SetValueWithoutNotify(_note.noteContext);
            noteLabel.RegisterValueChangedCallback(evt =>
            {
                _note.noteContext = evt.newValue;
                EditorUtility.SetDirty(_note);
            });
            root.Add(noteLabel);

//            foreach (var stickyNote in database.GameObjectHashMap)
//            {
//                var row = new VisualElement();
//                row.style.flexDirection = FlexDirection.Row;
//                var labelKey = new Label(stickyNote.Key);
//                var labelValue = new Label(stickyNote.Value.attachment.ToString());
//                row.Add(labelKey);
//                row.Add(labelValue);
//                root.Add(row);
//            }

            return(root);
        }
 public static void StickNotesSetup()
 {
     StickyNoteManagementUtils.LoadOrCreateDatabase();
 }