Mercurial > hg > Database > jungle-sharp
changeset 23:e1f3843950f7
add README.
author | Kazuma Takeda |
---|---|
date | Thu, 15 Dec 2016 23:59:10 +0900 |
parents | 03c58d4b2ccf |
children | df23b681d178 |
files | README.md |
diffstat | 1 files changed, 75 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Thu Dec 15 23:59:10 2016 +0900 @@ -0,0 +1,75 @@ +# Jungle-Sharp + +using UnityEngine. +tree structure database. + +# How to use Jungle-Sharp + +namespace is JungleDB, so you write c# script. + +using JungleDB; + +# How to use Jungle Database. + +- need interface. + +Jungle +JungleTree +JungleTreeEditor +NodePath + +1. Create Instance Jungle from DefaultJungle Class. +2. Create Tree in 1's Jungle Instance. +3. Set 2'Tree to Jungle Tree. +4. Change Tree Mode to Editor Tree Mode, so Set JungleTreeEditor. +5. Create root a Path. +6. Put Key(String) and Value(Byte Array) Attribute from path to TreeEditor. + +private void Start () { + Jungle jungle = new DefaultJungle(null, "TestJungle", new DefaultTreeEditor(new DefaultTraverser())); + jungle.createNewTree ("TestTree"); + JungleTree tree = jungle.getTreeByName ("TestTree"); + JungleTreeEditor editor = tree.getTreeEditor(); + NodePath root = new DefaultNodePath (); + // if put root. + Either<Error, JungleTreeEditor> putAttr = editor.putAttribute(root, "Key", "Value"); // <-1> + if(putAttr.isA()) { // put error. + // Expection + } + + editor = putAttr.b(); + + // elif put root children path. + NodePath path = root.add(0); + Either<Error, JungleTreeEditor> createRootChild = editor.addNewChildAt(root, 0); // <-1, 0> + if(createRootChild.isA()) { // child create error. + // Expection + } + + editor = createRootChild.b(); // success create root child. + + putAttr = editor.putAttribute(path, "Key", "Value"); + if(putAttr.isA()) { // put error. + // Expection + } + + editor = putAttr.b(); + + // else put other path child. + path = path.add(0); + Either<Error, JungleTreeEditor> createPathChild = editor.addNewChildAt(path, 0); // <-1, 0, 0> + if(createPathChild.isA()) { // child create error. + // Expection + } + + editor = createPathChild.b(); + + putAttr = editor.putAttribute(path, "Key", "Value"); + if(putAttr.isA()) { // put error. + // Expection + } + + editor = putAttr.b(); + + // end put Attribute function. +}