Beispiel #1
0
        public override void OnInspectorGUI()
        {
            if (item == null)
            {
                return;
            }

            UnisaveEditorHelper.InspectorHeading("Document", item.icon);

            UnisaveEditorHelper.LabeledBox("Properties", () => {
                UnisaveEditorHelper.ReadOnlyField("_id", item.DocumentId);
                UnisaveEditorHelper.ReadOnlyField("_rev", item.DocumentRev);
                UnisaveEditorHelper.ReadOnlyField("_key", item.DocumentKey);
            });

            jsonEditor.OnGUI();

            UnisaveEditorHelper.LabeledBox("Document actions", () => {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Delete"))
                {
                    DeleteDocument();
                }
                EditorGUILayout.EndHorizontal();
            });
        }
        public override void OnInspectorGUI()
        {
            if (item == null)
            {
                return;
            }

            UnisaveEditorHelper.InspectorHeading("Database", item.icon);

            UnisaveEditorHelper.LabeledBox("Properties", () => {
                UnisaveEditorHelper.ReadOnlyField("Name", item.DatabaseName);
                UnisaveEditorHelper.ReadOnlyField(
                    "Collections",
                    item.Database.Collections.Count.ToString()
                    );
                UnisaveEditorHelper.ReadOnlyField(
                    "Documents",
                    documentCount.ToString()
                    );
            });

            UnisaveEditorHelper.StringCreationBox(
                title: "Create collection",
                fieldLabel: "Collection name",
                buttonText: "Create",
                fieldValue: ref newCollectionName,
                errorMessage: newCollectionError,
                submit: CreateCollection
                );

            UnisaveEditorHelper.LabeledBox("Database actions", () => {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Truncate"))
                {
                    TruncateDatabase();
                }
                if (GUILayout.Button("Clear"))
                {
                    ClearDatabase();
                }
                if (GUILayout.Button("Delete"))
                {
                    DeleteDatabase();
                }
                EditorGUILayout.EndHorizontal();
            });
        }