# HG changeset patch # User Kazuma Takeda # Date 1481813950 -32400 # Node ID e1f3843950f78ba6564affb049a11cfd1a027d97 # Parent 03c58d4b2ccfd0e5952d7186fac36af7ed9b1c67 add README. diff -r 03c58d4b2ccf -r e1f3843950f7 README.md --- /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 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 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 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. +}