private void OnDownloadSuccess(byte[] dataBytes, string error = null) { if (dataBytes != null && CurType != null) { var filePath = DataFolder + string.Format("{0}.{1}.bytes", CurType.FullName, FileFormat); // 这里取巧了,假设了DataListVersion必定是第一个文件 // 在Editor里面就不做优化了,降低复杂度 if (CurType == typeof(DataListVersion)) { if (FileFormat == "pbz") { _newDataVersionList = JsHelper.ParseProtoObj(new ByteArray(dataBytes), true) as DataList; } else { _newDataVersionList = ParseJsz <DataList>(new ByteArray(dataBytes), true); } } File.WriteAllBytes(filePath, dataBytes); LoadNextData(); } else { if (_newDataVersionList != null) { var item = _newDataVersionList.items.FirstOrDefault(o => CurType == o.GetType()); if (item == null) { Debug.LogError("服务器列表不存在:" + CurType); LoadNextData(); return; } } error = error ?? string.Format("{0} 下载失败,是否继续?", CurType); if (EditorUtility.DisplayDialog("错误:", error, "确定", "取消")) { LoadNextData(); } else { OnLoadDataFinished(); throw new Exception("出现错误,用户取消了操作!"); } } }