public void RequestEntity(string uid) { if (isLocal) { var path = Path.Combine(rootPath, "entity/entity_" + uid + ".json"); if (!File.Exists(path)) { ZLog.Warning("the file not exist that path = " + path); return; } var txt = File.ReadAllText(path); var info = ParseUtil.ParseEntityJson(txt, rootPath); DFNotifyManager.SendNotify(DFNotifyType.OnEntityDataUpdate, info); } else { string address = GetAddress(HttpAPIType.Entity); LitJson.JsonData json = new LitJson.JsonData { ["uid"] = uid, ["code"] = codes }; ZHttpController.Post(URL_Entity, address, json.ToString(), HttpCompleteHandler, true); } }
private bool CheckNextGraph(RGNode node) { string root = MessageManager.Instance.RootPath; var expend = layout.CheckExpend(root, node); if (!expend) { return(false); } if (node.Data.entity == null) { var file = Path.Combine(node.Data.fullPath); if (File.Exists(file)) { var json = File.ReadAllText(file); var tmp = ParseUtil.ParseEntityJson(json, root); if (tmp != null) { tmp.uid = node.Data.UID; node.Data.entity = tmp; } else { node.Data.entity = new EntityInfo { uid = node.Data.UID, name = node.Data.name }; } } else { node.Data.entity = new EntityInfo { uid = node.Data.UID, name = node.Data.name }; } } node.Data.Screen = RectTransformUtility.WorldToScreenPoint(renderCamera, node.mTransform.position); // DFNotifyManager.SendNotify(DFNotifyType.OnNodeSelected, node.Data); return(true); }
private void HttpCompleteHandler(ZHttpController.Response info) { if (info.state != ZHttpController.Status.Normal) { reqNum += 1; if (reqNum > maxReconnected) { MessageManager.HttpConnected = false; ZHttpController.Clear(); } ZLog.Warning("Http Response Exception...." + info.data); DFNotifyManager.SendNotify(DFNotifyType.OnResponseError, ServerErrorStaus.Success); return; } MessageManager.HttpConnected = true; int status = 0; string result = DealResponse(info.data, out status); ZLog.Log("HttpCompleteHandler....uid = " + info.uid + " ;result = " + result); if (status != 0) { return; } if (info.uid == URL_Graph) { Model.GraphModel graph = ParseUtil.ParseGraphJson(result, rootPath); DFNotifyManager.SendNotify(DFNotifyType.OnGraphDataUpdate, graph); } else if (info.uid == URL_Entity) { Model.EntityInfo tmp = ParseUtil.ParseEntityJson(result, ""); DFNotifyManager.SendNotify(DFNotifyType.OnEntityDataUpdate, tmp); } else if (info.uid == URL_Themes) { // DFNotifyManager.SendNotify(DFNotifyType.OnThemesUpdate, list); } }