Mercurial > hg > Database > jungle-sharp
view README.md @ 25:3039d158e31b
add readme.md
author | Kazuma Takeda |
---|---|
date | Fri, 16 Dec 2016 00:04:11 +0900 |
parents | e1f3843950f7 |
children | f7616084d3ab |
line wrap: on
line source
# 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. } # Get Data.