comparison Assets/Application/Scripts/Test/SaveDataTest.cs @ 10:3fefb9f9025d

put Attribute class.
author Kazuma Takeda
date Fri, 20 Jan 2017 07:30:26 +0900
parents bbab930748c4
children cf20add31466
comparison
equal deleted inserted replaced
9:bbab930748c4 10:3fefb9f9025d
109 109
110 private void CreateItemTree () { 110 private void CreateItemTree () {
111 JungleTree tree = jungle.createNewTree ("ItemTree"); 111 JungleTree tree = jungle.createNewTree ("ItemTree");
112 JungleTreeEditor edt = tree.getTreeEditor (); 112 JungleTreeEditor edt = tree.getTreeEditor ();
113 113
114 edt = edt.putAttribute (rootPath, "TreeName", Encoding.UTF8.GetBytes ("Item")).b (); 114 edt = edt.putAttribute (rootPath, "TreeName", "Item").b ();
115 115
116 edt = edt.addNewChildAt (rootPath, 0).b (); 116 edt = edt.addNewChildAt (rootPath, 0).b ();
117 edt = edt.putAttribute ("Category", Encoding.UTF8.GetBytes ("Box")).b (); 117 edt = edt.putAttribute ("Category", "Box").b ();
118 118
119 edt = edt.addNewChildAt (rootPath, 1).b (); 119 edt = edt.addNewChildAt (rootPath, 1).b ();
120 edt = edt.putAttribute ("Category", Encoding.UTF8.GetBytes ("Food")).b (); 120 edt = edt.putAttribute ("Category", "Food").b ();
121 121
122 NodePath path = rootPath.add(0); 122 NodePath path = rootPath.add(0);
123 123
124 edt = edt.addNewChildAt (path, 0).b (); 124 edt = edt.addNewChildAt (path, 0).b ();
125 edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("1")).b (); 125
126 edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Grass")).b (); 126 ItemInfo item_info = new ItemInfo (1, 2, "Grass", "#019540FF");
127 edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("2")).b (); 127 edt = edt.putAttribute (item_info).b ();
128 edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#019540FF")).b ();
129 128
130 edt = edt.addNewChildAt (path, 1).b (); 129 edt = edt.addNewChildAt (path, 1).b ();
131 edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("2")).b (); 130 item_info = new ItemInfo (2, 4, "Wood", "#7F3C01FF");
132 edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Wood")).b (); 131 edt = edt.putAttribute (item_info).b ();
133 edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("4")).b ();
134 edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#7F3C01FF")).b ();
135
136 132
137 edt = edt.addNewChildAt (path, 2).b (); 133 edt = edt.addNewChildAt (path, 2).b ();
138 edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("3")).b (); 134 item_info = new ItemInfo (3, 1, "Sand", "#D4500EFF");
139 edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Sand")).b (); 135 edt = edt.putAttribute (item_info).b ();
140 edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("1")).b ();
141 edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#D4500EFF")).b ();
142 136
143 137
144 edt = edt.addNewChildAt (path, 3).b (); 138 edt = edt.addNewChildAt (path, 3).b ();
145 edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("4")).b (); 139 item_info = new ItemInfo (4, 5, "Water", "#2432ADFF");
146 edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Water")).b (); 140 edt = edt.putAttribute (item_info).b ();
147 edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("5")).b ();
148 edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#2432ADFF")).b ();
149 edt.commit (); 141 edt.commit ();
150 142
151 StageManager.Instance.Init (); 143 StageManager.Instance.Init ();
152 } 144 }
153 145
154 private void CreateSceneTree () { 146 private void CreateSceneTree () {
155 JungleTree tree = jungle.createNewTree ("SceneTree"); 147 JungleTree tree = jungle.createNewTree ("SceneTree");
156 JungleTreeEditor edt = tree.getTreeEditor (); 148 JungleTreeEditor edt = tree.getTreeEditor ();
157 149
158 edt = edt.addNewChildAt (rootPath, 0).b (); 150 edt = edt.addNewChildAt (rootPath, 0).b ();
159 edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("Player")).b (); 151 edt = edt.putAttribute ("NodeName", "Player").b ();
160 152
161 NodePath playerpath = rootPath.add (0); 153 NodePath playerpath = rootPath.add (0);
162 154
163 edt = edt.addNewChildAt (playerpath, 0).b(); 155 edt = edt.addNewChildAt (playerpath, 0).b();
164 edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("HaveItems")).b(); 156 edt = edt.putAttribute ("NodeName", "HaveItems").b();
165 157
166 edt = edt.addNewChildAt (rootPath, 1).b (); 158 edt = edt.addNewChildAt (rootPath, 1).b ();
167 edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("Stage")).b (); 159 edt = edt.putAttribute ("NodeName", "Stage").b ();
168 160
169 edt = edt.commit ().b(); 161 edt = edt.commit ().b();
170 } 162 }
171 } 163 }