private data_page_view_model set_vm(GameModeStatsData vid, data_page_view_model vm) { vm.assists = vid.Assists; vm.boosts = vid.Boosts; vm.headshots = vid.HeadshotKills; vm.heals = vid.Heals; vm.kills = vid.Kills; vm.knocks = vid.DBNOs; vm.k_d = Math.Round((double)vid.Kills / (double)vid.Losses, 2); vm.longest_kill = Math.Round(vid.LongestKill); vm.max_kill_streak = vid.MaxKillStreaks; vm.most_survival_time = Math.Round(vid.MostSurvivalTime / 60, 2); vm.rank_points = Math.Round(vid.RankPoints); vm.ride_dist = Math.Round(vid.RideDistance / 100, 2); vm.road_kill = vid.RoadKills; vm.round_max_kill = vid.RoundMostKills; vm.round_played = vid.RoundsPlayed; vm.suicide = vid.Suicides; vm.swim_dist = Math.Round(vid.SwimDistance / 1000, 2); vm.team_kill = vid.TeamKills; vm.top_10 = vid.Top10s; vm.total_survival_time = Math.Round(vid.TimeSurvived / 60, 2); vm.vehicle_destroys = vid.VehicleDestroys; vm.walk_dist = Math.Round(vid.WalkDistance / 1000, 2); vm.wins = vid.Wins; vm.weaponsAcquired = vid.WeaponsAcquired; vm.avg_damage = Math.Round(vid.DamageDealt / (double)vid.RoundsPlayed); vm.revives = vid.Revives; return(vm); }
public async Task take_data() { var players = await client.GetPlayersByUsernames(new string[] { Name }); if (Name == null) { await DisplayAlert("Уведомление", "Поле не може бути пустим", "ОK"); check_reaspon = false; } else if (players == null) { await DisplayAlert("Уведомление", "Неправильне імя гравця", "ОK"); check_reaspon = false; } else { foreach (var item in players.Data) { player_id = item.Id; } var season_stat = await client.GetSeasonStatsForPlayer(player_id, season_ids); var lifetime_stat = await client.GetLifetimeStatsForPlayer(player_id); solo_fpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.SoloFpp, solo_fpp_vm); solo_fpp_vm.image = get_rank_pics(solo_fpp_vm.rank_points, solo_i); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_s", solo_fpp_vm); duo_fpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.DuoFpp, duo_fpp_vm); duo_fpp_vm.image = get_rank_pics(duo_fpp_vm.rank_points, duo_i); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_d", duo_fpp_vm); squad_fpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.SquadFpp, squad_fpp_vm); squad_fpp_vm.image = get_rank_pics(squad_fpp_vm.rank_points, sq_i); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_sq", squad_fpp_vm); solo_tpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.Solo, solo_tpp_vm); solo_tpp_vm.image = get_rank_pics(solo_tpp_vm.rank_points, solo_i_t); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_s_t", solo_tpp_vm); duo_tpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.Duo, duo_tpp_vm); duo_tpp_vm.image = get_rank_pics(duo_tpp_vm.rank_points, duo_i_t); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_d_t", duo_tpp_vm); squad_tpp_vm = set_vm(season_stat.Data.Attributes.GameModeStats.Squad, squad_tpp_vm); squad_tpp_vm.image = get_rank_pics(squad_tpp_vm.rank_points, sq_i_t); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_sq_t", squad_tpp_vm); lsolo_fpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.SoloFpp, lsolo_fpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_ls", lsolo_fpp_vm); lduo_fpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.DuoFpp, lduo_fpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_ld", lduo_fpp_vm); lsquad_fpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.SquadFpp, lsquad_fpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_lsq", lsquad_fpp_vm); lsolo_tpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.Solo, lsolo_tpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_ls_t", lsolo_tpp_vm); lduo_tpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.Duo, lduo_tpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_ld_t", lduo_tpp_vm); lsquad_tpp_vm = set_vm(lifetime_stat.Data.Attributes.GameModeStats.Squad, lsquad_tpp_vm); MessagingCenter.Send <search_page, data_page_view_model>(this, "data_lsq_t", lsquad_tpp_vm); } }