public static Node JObjectToNode(JObject jobj) { JsonSerializer se = JsonSerializer.CreateDefault(); se.Converters.Add(new NodeConverter()); object obj = jobj.ToObject(NodeJsonUtil.GetNodeType(jobj), se); if (!(obj is Node)) { Logging.Instance.Log("Invalid json object."); return(null); } // 手动恢复每个 node 的 m_parent 字段 Node root = obj as Node; SceneGraphUtil.UnifyParents(root); return(root); }
protected override Node Create(Type objectType, JObject jObject) { return(NodeJsonUtil.CreateNode(jObject)); }