Mercurial > hg > Members > kazuma > JungleforUnity
comparison Assets/Application/Scripts/SaveData.cs @ 5:12f4f937da7f
Add BenchMark
author | Kazuma |
---|---|
date | Thu, 10 Nov 2016 04:21:19 +0900 |
parents | 2878be4487ec |
children | ad4729c5eec4 |
comparison
equal
deleted
inserted
replaced
4:2878be4487ec | 5:12f4f937da7f |
---|---|
24 Debug.Log ("[Jungle] Start ..."); | 24 Debug.Log ("[Jungle] Start ..."); |
25 mainScene = new DefaultJungle(null, "Main", new DefaultTreeEditor(new DefaultTraverser())); | 25 mainScene = new DefaultJungle(null, "Main", new DefaultTreeEditor(new DefaultTraverser())); |
26 } | 26 } |
27 | 27 |
28 public void CreateTree (string name) { | 28 public void CreateTree (string name) { |
29 mainTree = mainScene.createNewTree (name); | 29 mainScene.createNewTree (name); |
30 mainTree = mainScene.getTreeByName (name); | |
30 Debug.Log ("[Jungle] Create " + name + " Tree"); | 31 Debug.Log ("[Jungle] Create " + name + " Tree"); |
31 EditorMode (); | 32 EditorMode (); |
32 } | 33 } |
33 | 34 |
34 public void EditorMode () { | 35 public void EditorMode () { |
35 TreeEditor = mainTree.getTreeEditor (); | 36 TreeEditor = mainTree.getTreeEditor (); |
36 Debug.Log ("[Jungle] Editor Mode" + TreeEditor.ToString()); | 37 Debug.Log ("[Jungle] Editor Mode" + TreeEditor.ToString()); |
37 } | 38 } |
38 | 39 |
39 public void PutAttribute (NodePath path, string key, byte[] value) { | 40 public void createTree (int pos, NodePath path, string key, byte[] value) { |
40 Either<Error, JungleTreeEditor> either = TreeEditor.putAttribute (path, key, value); | 41 Either<Error, JungleTreeEditor> either = TreeEditor.addNewChildAt(path, pos); |
41 if (either.isA ()) { | 42 if (either.isA ()) { |
42 Debug.LogError ("[Error]" + either.a()); | 43 Debug.LogError ("[Error]" + either.a ()); |
43 } else { | 44 } else { |
44 Debug.Log ("[Success]"); | 45 TreeEditor = either.b (); |
45 either.b (); | 46 Either<Error, JungleTreeEditor> eitherput = TreeEditor.putAttribute (path.add(pos), key, value); |
47 if (eitherput.isA ()) { | |
48 Debug.LogError ("[Error]" + eitherput.a()); | |
49 } else { | |
50 Debug.Log ("[Success]"); | |
51 TreeEditor = eitherput.b (); | |
52 } | |
46 } | 53 } |
47 } | 54 } |
48 | 55 |
56 // public void PutAttribute (NodePath path, string key, byte[] value) { | |
57 // Either<Error, JungleTreeEditor> either = TreeEditor.putAttribute (path, key, value); | |
58 // if (either.isA ()) { | |
59 // Debug.LogError ("[Error]" + either.a()); | |
60 // } else { | |
61 // Debug.Log ("[Success]"); | |
62 // either.b (); | |
63 // } | |
64 // } | |
65 | |
49 public void GetAttribute (NodePath path, string key) { | 66 public void GetAttribute (NodePath path, string key) { |
50 node = mainTree.getNodeOfPath (path).b (); | 67 Either<Error, TreeNode> either = mainTree.getNodeOfPath (path); |
51 byte[] target = node.getAttributes ().get (key); | 68 if (either.isA ()) { |
52 var obj = ConvertObject.UnConvert (target); | 69 Debug.LogError ("[Error]"); |
53 print (obj); | 70 } else { |
71 node = either.b (); | |
72 print (key); | |
73 byte[] target = node.getAttributes ().get (key); | |
74 var obj = ConvertObject.UnConvert (target); | |
75 print (obj); | |
76 } | |
54 } | 77 } |
55 | 78 |
56 public void Push() { | 79 public void Push() { |
57 Either<Error, JungleTreeEditor> r = TreeEditor.success(); | 80 Either<Error, JungleTreeEditor> r = TreeEditor.success(); |
58 if (!r.isA ()) { | 81 if (r.isA ()) { |
59 Debug.LogError ("[Error]"); | 82 Debug.LogError ("[Error]"); |
60 } else { | 83 } else { |
61 Debug.Log ("[Success]"); | 84 Debug.Log ("[Success]"); |
62 TreeEditor = r.b (); | 85 TreeEditor = r.b (); |
63 } | 86 } |