diff 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
line wrap: on
line diff
--- a/Assets/Application/Scripts/Test/SaveDataTest.cs	Wed Jan 18 22:00:24 2017 +0900
+++ b/Assets/Application/Scripts/Test/SaveDataTest.cs	Fri Jan 20 07:30:26 2017 +0900
@@ -111,41 +111,33 @@
 		JungleTree tree = jungle.createNewTree ("ItemTree");
 		JungleTreeEditor edt = tree.getTreeEditor ();
 
-		edt = edt.putAttribute (rootPath, "TreeName", Encoding.UTF8.GetBytes ("Item")).b ();
+		edt = edt.putAttribute (rootPath, "TreeName", "Item").b ();
 
 		edt = edt.addNewChildAt (rootPath, 0).b ();
-		edt = edt.putAttribute ("Category", Encoding.UTF8.GetBytes ("Box")).b ();
+		edt = edt.putAttribute ("Category", "Box").b ();
 
 		edt = edt.addNewChildAt (rootPath, 1).b ();
-		edt = edt.putAttribute ("Category", Encoding.UTF8.GetBytes ("Food")).b ();
+		edt = edt.putAttribute ("Category", "Food").b ();
 
 		NodePath path = rootPath.add(0);
 
 		edt = edt.addNewChildAt (path, 0).b ();
-		edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("1")).b ();
-		edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Grass")).b ();
-		edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("2")).b ();
-		edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#019540FF")).b ();
+
+		ItemInfo item_info = new ItemInfo (1, 2, "Grass", "#019540FF");
+		edt = edt.putAttribute (item_info).b ();
 
 		edt = edt.addNewChildAt (path, 1).b ();
-		edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("2")).b ();
-		edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Wood")).b ();
-		edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("4")).b ();
-		edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#7F3C01FF")).b ();
-
+		item_info = new ItemInfo (2, 4, "Wood", "#7F3C01FF");
+		edt = edt.putAttribute (item_info).b ();
 
 		edt = edt.addNewChildAt (path, 2).b ();
-		edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("3")).b ();
-		edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Sand")).b ();
-		edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("1")).b ();
-		edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#D4500EFF")).b ();
+		item_info = new ItemInfo (3, 1, "Sand", "#D4500EFF");
+		edt = edt.putAttribute (item_info).b ();
 
 
 		edt = edt.addNewChildAt (path, 3).b ();
-		edt = edt.putAttribute ("ID", Encoding.UTF8.GetBytes ("4")).b ();
-		edt = edt.putAttribute ("Type", Encoding.UTF8.GetBytes ("Water")).b ();
-		edt = edt.putAttribute ("Broken", Encoding.UTF8.GetBytes ("5")).b ();
-		edt = edt.putAttribute ("Color", Encoding.UTF8.GetBytes ("#2432ADFF")).b ();
+		item_info = new ItemInfo (4, 5, "Water", "#2432ADFF");
+		edt = edt.putAttribute (item_info).b ();
 		edt.commit ();
 
 		StageManager.Instance.Init ();
@@ -156,15 +148,15 @@
 		JungleTreeEditor edt = tree.getTreeEditor ();
 
 		edt = edt.addNewChildAt (rootPath, 0).b ();
-		edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("Player")).b ();
+		edt = edt.putAttribute ("NodeName", "Player").b ();
 
 		NodePath playerpath = rootPath.add (0);
 
 		edt = edt.addNewChildAt (playerpath, 0).b();
-		edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("HaveItems")).b();
+		edt = edt.putAttribute ("NodeName", "HaveItems").b();
 
 		edt = edt.addNewChildAt (rootPath, 1).b ();
-		edt = edt.putAttribute ("NodeName", Encoding.UTF8.GetBytes ("Stage")).b ();
+		edt = edt.putAttribute ("NodeName", "Stage").b ();
 
 		edt = edt.commit ().b();
 	}