IEnumerator GetGameStartByMatchID(long matchID) { string uri = API_URI + "/lol/match/v4/matches/" + matchID.ToString() + "?api_key=" + API_KEY;; UnityWebRequest uwr = UnityWebRequest.Get(uri); yield return(uwr.SendWebRequest()); Debug.Log(uwr); Match.MatchDto match = new Match.MatchDto(); match = JsonUtility.FromJson <Match.MatchDto>(uwr.downloadHandler.text); Debug.Log(match); if (uwr.responseCode == 404) { Debug.LogError("404!"); } if (uwr.responseCode == 200) { Debug.Log("FETCHING GAME START TIME"); gameStartTime = FromUnixTime(match.gameCreation); Debug.Log("Game Start Time : " + gameStartTime.Month.ToString() + "/" + gameStartTime.Day.ToString() + " , " + string.Format("{0:hh:mm:ss tt}", gameStartTime)); if (!timelineDictionary.ContainsKey(gameStartTime)) { timelineDictionary.Add(gameStartTime, "\n - | | | | GAME START TIME : " + gameStartTime.Month.ToString() + "/" + gameStartTime.Day.ToString() + " , " + string.Format("{0:hh:mm:ss tt}", gameStartTime) + " | | | | - MATCH ID - " + matchId + " - |"); } else { string prev; prev = timelineDictionary[gameStartTime]; string newEntry = status + "\n" + prev; timelineDictionary[gameStartTime] = newEntry; } } }
IEnumerator GetParticipantIDByMatchID(long matchID) { string uri = API_URI + "/lol/match/v4/matches/" + matchID.ToString() + "?api_key=" + API_KEY;; UnityWebRequest uwr = UnityWebRequest.Get(uri); yield return(uwr.SendWebRequest()); Debug.Log(uwr); Match.MatchDto match = new Match.MatchDto(); match = JsonUtility.FromJson <Match.MatchDto>(uwr.downloadHandler.text); Debug.Log(match); if (uwr.responseCode == 404) { Debug.LogError("404!"); } if (uwr.responseCode == 200) { Debug.Log("FETCHING PARTICIPANT ID"); for (int i = 0; i < match.participantIdentities.Count; i++) { if (match.participantIdentities[i].player.summonerName == summonerName) { mostRecentParticipantId = match.participantIdentities[i].participantId; } } } ParticpantIDField.text = mostRecentParticipantId.ToString(); Debug.Log("Exiting"); }