private static void ParseResponse <T> (string responseText, Action <LemmingNetworkResult <T> > successCallback, Action <ErrorResult> failCallback) { LemmingNetworkResult <T> lemmingNetworkResult = null; Debug.Log(responseText); try { lemmingNetworkResult = JsonConvert.DeserializeObject <LemmingNetworkResult <T> > (responseText); } catch (Exception e) { Debug.LogError("response parsing error..."); Debug.LogError(e.StackTrace); } if (lemmingNetworkResult.status == "ok") { successCallback(lemmingNetworkResult); } else if (lemmingNetworkResult.status == "fail") { var errorResult = new ErrorResult(lemmingNetworkResult.errorResult as string); failCallback(errorResult); } else { Debug.LogError("Invalid network response"); } }
private void GetWorldRecordsSuccessCallback(LemmingNetworkResult <GetWorldRecordsResult> result) { var worldRecords = result.GetFirstResult(); RefreshRecord(worldRecords.userRecords); }