// Displaying Changes --------------------------------------------------------------------------------- private void LayoutTop(string modeString, string zone) { StyleOptionLabel.Text = "Style: " + modeString; ZoneOptionLabel.Text = "Zone: " + zone; foreach (TopDatum datum in topData) { TopRankStack.Children.Add(new Label { Text = list_index + ". " + String_Formatter.toEmoji_Country(datum.country) + " " + datum.name + " (" + datum.count + ")", Style = Resources["TopStyle"] as Style }); Label TimeLabel = new Label { Text = String_Formatter.toString_RankTime(datum.time), Style = Resources["TopStyle"] as Style }; if (list_index != 1) { TimeLabel.Text += " (+" + String_Formatter.toString_RankTime(datum.wrDiff) + ")"; } else { TimeLabel.Text += " (WR)"; } TopTimeStack.Children.Add(TimeLabel); list_index++; } moreRecords = (((list_index - 1) % LIST_LIMIT == 0) && ((list_index - 1) < CALL_LIMIT)); MoreFrame.IsVisible = moreRecords; }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangePR(EFilter_Mode newMode, EFilter_PlayerType newPlayerType, string newPlayerValue) { if (currentMode == newMode && newPlayerType == playerType && newPlayerValue == playerValue) { return; } var prInfoDatum = await mapsViewModel.GetMapPRInfo(game, newMode, map, newPlayerType, newPlayerValue); prInfoData = prInfoDatum?.data; if (prInfoData is null || prInfoData.basicInfo is null) { hidePR(); await DisplayAlert("Could not find player profile!", "Invalid SteamID or rank.", "OK"); return; } currentMode = newMode; playerType = newPlayerType; playerValue = newPlayerValue; playerSteamID = prInfoData.basicInfo.steamID; Title = mapsMapTitle + " " + EFilter_ToString.toString(currentMode) + "]"; PRTitleLabel.Text = String_Formatter.toEmoji_Country(prInfoData.basicInfo.country) + " " + prInfoData.basicInfo.name; if (prInfoData.time is null || prInfoData.time == "0") // no main completion { hidePR(); return; } displayPR(); playerRank = prInfoData.rank.ToString(); LayoutPRInfo(); }
// Displaying Changes -------------------------------------------------------------------------- private void LayoutRecentRecords(string typeString) { Title = "Records [" + EFilter_ToString.toString2(game) + ", " + EFilter_ToString.toString(mode) + "]"; RRTypeOptionLabel.Text = "Type: " + typeString; RecordsStack.Children.Clear(); int i = 0; int length = recentRecordsData.Count; foreach (RRDatum datum in recentRecordsData) { RecordsStack.Children.Add(new Label { Text = datum.mapName + " " + EFilter_ToString.zoneFormatter(datum.zoneID, false, false), Style = App.Current.Resources["RRLabelStyle"] as Style }); RecordsStack.Children.Add(new Label { Text = String_Formatter.toEmoji_Country(datum.country) + " " + datum.playerName + " on " + datum.server + " server", Style = App.Current.Resources["RR2LabelStyle"] as Style }); string rrtime = "in " + String_Formatter.toString_RankTime(datum.surfTime) + " ("; if (datum.wrDiff == "0") { if (datum.r2Diff is null) { rrtime += "WR N/A"; } else { rrtime += "WR-" + String_Formatter.toString_RankTime(datum.r2Diff.Substring(1)); } } else { rrtime += "now WR+" + String_Formatter.toString_RankTime(datum.wrDiff); } rrtime += ") (" + String_Formatter.toString_LastOnline(datum.date) + ")"; RecordsStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != length) { RecordsStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } } }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangePRDetails() { var ccpDatum = await mapsViewModel.GetMapCCP(game, mode, map, EFilter_PlayerType.steamid, playerSteamID); CCPDetails = ccpDatum?.data.CCP; if (CCPDetails is null || CCPDetails.Count < 1) { return; } WRPlayer.Text = "PRCP vs " + String_Formatter.toEmoji_Country(ccpDatum.data.basicInfoWR.country) + " " + ccpDatum.data.basicInfoWR.name; LayoutPRDetails(); }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangePRDetails() { var prDatum = await mapsViewModel.GetMapPR(game, mode, map, EFilter_PlayerType.steamid, playerSteamID); mapPRDetails = prDatum?.data.PRInfo; if (mapPRDetails is null) { return; } PRTitleLabel.Text = String_Formatter.toEmoji_Country(prDatum.data.basicInfo.country) + " " + prDatum.data.basicInfo.name; LayoutPRDetails(); }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangePRDetails() { var cprDatum = await mapsViewModel.GetMapCPR(game, mode, map, EFilter_PlayerType.steamid, playerSteamID); CPRDetails = cprDatum?.data.CPR; if (CPRDetails is null || CPRDetails.Count < 1) { return; } mapType = (EFilter_MapType)int.Parse(cprDatum.data.mapType); WRPlayer.Text = "PR vs " + String_Formatter.toEmoji_Country(cprDatum.data.basicInfoWR.country) + " " + cprDatum.data.basicInfoWR.name; LayoutPRDetails(); }
private void LayoutRecentRecords10() { RRTypeOptionLabel.Text = "Type: Top10"; RecordsStack.Children.Clear(); int i = 0; int length = recentRecords10Data.Count; foreach (RR10Datum datum in recentRecords10Data) { int rank = int.Parse(datum.newRank); RecordsStack.Children.Add(new Label { Text = datum.mapName + " [R" + rank + "]", Style = App.Current.Resources["RRLabelStyle"] as Style }); RecordsStack.Children.Add(new Label { Text = String_Formatter.toEmoji_Country(datum.country) + " " + datum.playerName + " on " + datum.server + " server", Style = App.Current.Resources["RR2LabelStyle"] as Style, }); string rrtime = "in " + String_Formatter.toString_RankTime(datum.surfTime) + " ("; if (datum.wrDiff == "0") { rrtime += "WR"; } else { rrtime += "WR+" + String_Formatter.toString_RankTime(datum.wrDiff); } rrtime += ") (" + String_Formatter.toString_LastOnline(datum.date) + ")"; RecordsStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != length) { RecordsStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } } }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutRecords() { if (list_index != 1) { ORStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } int i = 0; int length = oldRecordData.Count; foreach (OldRecord datum in oldRecordData) { string rrstring = datum.mapName; if (datum.zoneID != null) { rrstring += " " + EFilter_ToString.zoneFormatter(datum.zoneID, false, false); } ORStack.Children.Add(new Label { Text = rrstring, Style = App.Current.Resources["RRLabelStyle"] as Style }); ORStack.Children.Add(new Label { Text = String_Formatter.toEmoji_Country(datum.country) + " " + datum.playerName, Style = App.Current.Resources["RR2LabelStyle"] as Style }); string rrtime = "in " + String_Formatter.toString_RankTime(datum.surfTime); if (!(datum.r2Diff is null)) { if (datum.r2Diff != "0") { rrtime += " (WR-" + String_Formatter.toString_RankTime(datum.r2Diff.Substring(1)) + ")"; } else { rrtime += " (RETAKEN)"; } }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangeCountryTop(string country, bool clearGrid) { var countryTopDatum = await recordsViewModel.GetCountryTop(game, mode, country, list_index); countryTopData = countryTopDatum?.data; if (countryTopData is null) { return; } if (clearGrid) { ClearCountryTopGrid(); } this.country = country; CountryOptionLabel.Text = "Country: " + String_Formatter.toEmoji_Country(country); LayoutCountryTop(); }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutTopCountries() { foreach (CountryPoints datum in topCountriesData) { RankStack.Children.Add(new Label { Text = list_index + ". " + String_Formatter.toEmoji_Country(datum.country) + " " + datum.country, Style = App.Current.Resources["GridLabelStyle"] as Style }); PointsStack.Children.Add(new Label { Text = String_Formatter.toString_Points(datum.points), Style = App.Current.Resources["GridLabelStyle"] as Style }); list_index++; } moreRecords = (((list_index - 1) % LIST_LIMIT == 0) && ((list_index - 1) < CALL_LIMIT)); MoreFrame.IsVisible = moreRecords; }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangeMostByType(EFilter_Game game, EFilter_MostType type, EFilter_Mode mode, bool clearGrid) { string rightColString = "Player"; string leftColString = ""; List <string> players = new List <string>(); List <string> values = new List <string>(); switch (type) { case EFilter_MostType.pc: { var mostPCDatum = await recordsViewModel.GetMostPC(game, mode, list_index); mostPCData = mostPCDatum?.data; if (mostPCData is null || mostPCData.Count < 1) { MoreFrame.IsVisible = false; return; } leftColString = "Total"; foreach (MostPCDatum datum in mostPCData) { players.Add(String_Formatter.toEmoji_Country(datum.country) + " " + datum.name); values.Add((double.Parse(datum.percentCompletion) * 100).ToString("0.00") + "%"); } break; } case EFilter_MostType.wr: case EFilter_MostType.wrcp: case EFilter_MostType.wrb: case EFilter_MostType.mostwr: case EFilter_MostType.mostwrcp: case EFilter_MostType.mostwrb: { var mostCountDatum = await recordsViewModel.GetMostCount(game, type, mode, list_index); mostCountData = mostCountDatum?.data; if (mostCountData is null || mostCountData.Count < 1) { MoreFrame.IsVisible = false; return; } leftColString = "Total"; foreach (MostCountDatum datum in mostCountData) { players.Add(String_Formatter.toEmoji_Country(datum.country) + " " + datum.name); values.Add(String_Formatter.toString_Int(datum.total)); } break; } case EFilter_MostType.top10: { var mostTopDatum = await recordsViewModel.GetMostTop(game, mode, list_index); mostTopData = mostTopDatum?.data; if (mostTopData is null || mostTopData.Count < 1) { MoreFrame.IsVisible = false; return; } leftColString = "Points"; foreach (MostTopDatum datum in mostTopData) { players.Add(String_Formatter.toEmoji_Country(datum.country) + " " + datum.name); values.Add(String_Formatter.toString_Points(datum.top10Points)); } break; } case EFilter_MostType.group: { var mostGroupDatum = await recordsViewModel.GetMostGroup(game, mode, list_index); mostGroupData = mostGroupDatum?.data; if (mostGroupData is null || mostGroupData.Count < 1) { MoreFrame.IsVisible = false; return; } leftColString = "Points"; foreach (MostGroupDatum datum in mostGroupData) { players.Add(String_Formatter.toEmoji_Country(datum.country) + " " + datum.name); values.Add(String_Formatter.toString_Points(datum.groupPoints)); } break; } case EFilter_MostType.mostcontestedwr: { var mostContWrDatum = await recordsViewModel.GetMostContWr(game, mode, list_index); mostContWrData = mostContWrDatum?.data; if (mostContWrData is null || mostContWrData.Count < 1) { MoreFrame.IsVisible = false; return; } rightColString = "Map"; leftColString = "Beaten"; foreach (MostContWrDatum datum in mostContWrData) { players.Add(datum.mapName); values.Add(String_Formatter.toString_Int(datum.total)); } break; } case EFilter_MostType.mostcontestedwrcp: case EFilter_MostType.mostcontestedwrb: { var mostContZoneDatum = await recordsViewModel.GetMostContZone(game, type, mode, list_index); mostContZoneData = mostContZoneDatum?.data; if (mostContZoneData is null || mostContZoneData.Count < 1) { MoreFrame.IsVisible = false; return; } rightColString = "Zone"; leftColString = "Beaten"; foreach (MostContZoneDatum datum in mostContZoneData) { string zoneString = EFilter_ToString.zoneFormatter(datum.zoneID, false, false); players.Add(datum.mapName + " " + zoneString); values.Add(String_Formatter.toString_Int(datum.total)); } break; } case EFilter_MostType.playtimeday: case EFilter_MostType.playtimeweek: case EFilter_MostType.playtimemonth: { var mostTimeDatum = await recordsViewModel.GetMostTime(game, type, mode, list_index); mostTimeData = mostTimeDatum?.data; if (mostTimeData is null || mostTimeData.Count < 1) { return; } rightColString = "Map"; leftColString = "Time"; foreach (MostTimeDatum datum in mostTimeData) { players.Add(datum.mapName); values.Add(String_Formatter.toString_PlayTime(datum.totalplaytime.ToString(), true)); } break; } default: return; } MostTypeOptionLabel.Text = "Type: " + EFilter_ToString.toString2(type); if (clearGrid) { ClearMostByTypeGrid(rightColString, leftColString); } LayoutMostByType(type, players, values); }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutPlayerProfile() { if (playerSteamProfile is null) { PlayerImage.Source = "failed_steam_profile.png"; } else { PlayerImage.Source = playerSteamProfile.avatarfull; } PlayerNameLabel.Text = playerInfoData.basicInfo.name; PlayerCountryLabel.Text = String_Formatter.toEmoji_Country(playerInfoData.basicInfo.country) + " " + playerInfoData.basicInfo.country; List <string> attributes = new List <string>(); if (!(playerInfoData.banStatus is bool)) { attributes.Add("BANNED"); } if (playerInfoData.KSFStatus != null) { attributes.Add("KSF"); } if (playerInfoData.vipStatus != null) { attributes.Add("VIP"); } if (playerInfoData.adminStatus != null) { attributes.Add("Admin"); } if (playerInfoData.mapperID != null) { attributes.Add("Mapper"); } PlayerAttributesLabel.Text = string.Join(" | ", attributes); string rankTitle = EFilter_ToString.getRankTitle(playerInfoData.SurfRank, playerInfoData.playerPoints.points); Color rankColor = new Color(); switch (rankTitle) { case "MASTER": rankColor = EFilter_ToString.rankColors[0]; break; case "ELITE": rankColor = EFilter_ToString.rankColors[1]; break; case "VETERAN": rankColor = EFilter_ToString.rankColors[2]; break; case "PRO": rankColor = EFilter_ToString.rankColors[3]; break; case "EXPERT": rankColor = EFilter_ToString.rankColors[4]; break; case "HOTSHOT": rankColor = EFilter_ToString.rankColors[5]; break; case "EXCEPTIONAL": rankColor = EFilter_ToString.rankColors[6]; break; case "SEASONED": rankColor = EFilter_ToString.rankColors[7]; break; case "EXPERIENCED": rankColor = EFilter_ToString.rankColors[8]; break; case "PROFICIENT": rankColor = EFilter_ToString.rankColors[9]; break; case "SKILLED": rankColor = EFilter_ToString.rankColors[10]; break; case "CASUAL": rankColor = EFilter_ToString.rankColors[11]; break; case "BEGINNER": rankColor = EFilter_ToString.rankColors[12]; break; case "ROOKIE": rankColor = EFilter_ToString.rankColors[13]; break; } RankTitleLabel.Text = rankTitle; RankTitleLabel.TextColor = rankColor; PlayerImageFrame.BorderColor = rankColor; }