Mercurial > hg > Database > jungle-sharp
view src/test/csharp/DefaultJungleTreeTest.cs @ 0:dec15de2c6ff
first commit
author | Kazuma |
---|---|
date | Tue, 21 Jun 2016 17:11:12 +0900 |
parents | |
children | 4d08270a61c8 02b2ab7bffe6 |
line wrap: on
line source
using UnityEngine; using System.Collections; using System; //using System.Diagnostics; public class DefaultJungleTreeTest : MonoBehaviour { // apiの仕様的にこんな感じ public Jungle instance() { Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); // hogeというtreeを作る return j; } public static string key = "KEY"; public GameObject value; void Start() { Jungle j = instance (); JungleTree tree = j.createNewTree ("tree"); // hogeの中にtreeという名前の木を作る JungleTreeEditor editor1 = tree.getTreeEditor (); // editor DefaultNodePath path = new DefaultNodePath (); // NodePath path; Either<Error, JungleTreeEditor> either = editor1.putAttribute (path, key, value); if (either.isA ()) { // 失敗した場合のコード Debug.Log ("失敗しました。"); } editor1 = either.b (); //成功した場合 editor1.success (); // 大本にあるTreeにここで変更を加える TreeNode node = tree.getRootNode (); Debug.Log (node); Debug.Log (node.getAttributes ().getKeys ()); GameObject v = node.getAttributes ().get (key); Debug.Log (v); } void Update() { } }