Beispiel #1
0
 public void ReadChildren(JsonData inJsonData)
 {
     for (int i = 0; i < inJsonData["children"].Count; ++i)
     {
         string str     = inJsonData["children"][i]["type"].ToString();
         Type   t       = Type.GetType(str);
         BTNode newNode = Activator.CreateInstance(t) as BTNode;
         newNode.ReadJson(inJsonData["children"][i]);
         newNode.parentNode = this;
         this.AddChild(newNode);
     }
 }
        public void ReadJson(JsonData inJsonData)
        {
            treeName = inJsonData["name"].ToString();
            tickRate = double.Parse(inJsonData["tickrate"].ToString());
            treeRoot = null;

            if ((( IDictionary )inJsonData).Contains("node"))
            {
                string str  = inJsonData["node"]["type"].ToString();
                Type   type = Type.GetType(str);
                treeRoot = Activator.CreateInstance(type) as BTNode;
                treeRoot.ReadJson(inJsonData["node"]);
            }
        }