public IEnumerator GetMatchList(GetMatchListRequest request, Action <GetMatchListResponse> onMatchListResponse, Action <string> onError) { yield return(SyncGet( request, responseText => { if (!string.IsNullOrEmpty(responseText)) { onMatchListResponse(GetMatchListResponse.FromJSON(responseText)); } else { onMatchListResponse(new GetMatchListResponse() { matches = new List <Match>() }); } }, onError )); }
public IEnumerator GetMatchList() { GetMatchListRequest request = new GetMatchListRequest { filterBy = "live", limit = -1, // all matchType = "all", period = "all" }; yield return(gameOnApi.GetMatchList( request, response => { // clear existing matches matches.Clear(); DebugOutput("Match Get Success: Found " + response.matches.Count + " match(es)"); foreach (Match match in response.matches) { DebugOutput(" Found match: \"" + match.title + "\" (" + match.matchId + ")"); matches.Add(match.matchId, match.title); } DebugOutput("Found " + response.playerMatches.Count + " player match(es)"); foreach (PlayerMatch playerMatch in response.playerMatches) { DebugOutput(" Found player match: \"" + playerMatch.title + "\" (" + playerMatch.matchId + ")"); } }, error => { DebugOutput("Error getting match list: " + error); } )); }