Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { HttpClient } from '@angular/common/http';
  3.  
  4. @Component({
  5. selector: 'heatmap',
  6. templateUrl: './heatmap.component.html',
  7. styleUrls: ['./heatmap.component.css']
  8. })
  9. export class HeatmapComponent implements OnInit {
  10.  
  11. apiKey = "RGAPI-28103ca1-6e15-4af1-90fb-bb084909498f";
  12. getUrl = "http://localhost/riot_get.php?get_string=";
  13.  
  14. accountId = ""
  15. gameId = 0;
  16. playerPosition: [int, int] = [0,0];
  17. summonerName = "TN5 Celestial";
  18.  
  19.  
  20. getSummonerIdByName(): void{
  21. let url = this.getUrl + "summoner/v4/summoners/by-name/" + this.summonerName + "&api_key=" + this.apiKey;
  22.  
  23. this.http
  24. .get(url)
  25. .subscribe(responseData =>{
  26. console.log(responseData.accountId);
  27. this.accountId = responseData.accountId;
  28. });
  29. }
  30.  
  31. getMatchListByAccountId(): void{
  32. let url = this.getUrl + "match/v4/matchlists/by-account/" + this.accountId + "&api_key=" + this.apiKey;
  33.  
  34. this.http
  35. .get(url)
  36. .subscribe(responseData =>{
  37. console.log(responseData);
  38. console.log(responseData.matches[0].gameId);
  39. this.gameId = responseData.matches[0].gameId;
  40. })
  41. }
  42.  
  43. getTimelineByGameId(): void{
  44. let url = this.getUrl + "match/v4/timelines/by-match/" + this.gameId + "&api_key=" + this.apiKey;
  45.  
  46. this.http
  47. .get(url)
  48. .subscribe(responseData =>{
  49. console.log(responseData)
  50. for (let i = 0; i < responseData.frames.length; i++) {
  51. this.playerPosition.push(responseData.frames[i].participantFrames[2].position);
  52. }
  53. console.log(this.playerPosition);
  54. })
  55. }
  56.  
  57. constructor(private http: HttpClient) { }
  58.  
  59. ngOnInit() {
  60. }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement