private void OnUpdateVersionByVersionResponse(string response) { #if UNITY_EDITOR if (Tracking) { PrintTrack(MethodBase.GetCurrentMethod().Name); PrintTrack("response: " + response); } #endif _getDlcListMessageRef = null; if (string.IsNullOrEmpty(response)) { FinishUpdate(false); return; } GetDlcListResponseMessage responseMessage = GetDlcListResponseMessage.FromJson(response); if (responseMessage == null) { FinishUpdate(false); return; } VersionNumber currentDLCVersionOnDevice = GetCurrentDLCVersionOnDevice(); int currentIndex = responseMessage.DlcVersionInfoList.FindIndex((DlcVersionInfo dlcVersionInfo) => { if (dlcVersionInfo.Version.CompareTo(currentDLCVersionOnDevice) == 0) { return(true); } return(false); }); _downloadAndUpdateVersionByVersionRef = DownloadAndUpdateVersionByVersion(currentIndex, responseMessage.DlcVersionInfoList); StartCoroutine(_downloadAndUpdateVersionByVersionRef); }
public static GetDlcListResponseMessage FromJson(string jsonString) { GetDlcListResponseMessage result = new GetDlcListResponseMessage(); try { JsonData jsonData = JsonMapper.ToObject(jsonString); result.DlcVersionInfoList = new List <DlcVersionInfo>(); for (int i = 0; i < jsonData["message"].Count; i++) { result.DlcVersionInfoList.Add(DlcVersionInfo.FromJson(jsonData["message"][i].ToJson())); } result.DlcVersionInfoList.Sort(DlcVersionInfo.SortCore); return(result); } catch (Exception e) { Debug.LogError(e); return(null); } }