// Displaying Changes ------------------------------------------------------------------------------- private void LayoutPRInfo() { bool isR1 = (prInfoData.rank == 1); CPROption.IsVisible = !isR1; if (hasStages) { CCPOption.IsVisible = !isR1; } PagesStack.IsVisible = !(!hasZones && isR1); // Info ----------------------------------------------------------------- string time = String_Formatter.toString_RankTime(prInfoData.time) + " (WR"; if (isR1) { if (prInfoData.r2Diff is null || prInfoData.r2Diff == "0") { time += " N/A"; } else { time += "-" + String_Formatter.toString_RankTime(prInfoData.r2Diff.Substring(1)); } }
// 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 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; }
// 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 LayoutTiers() { string[] labelTexts = new string[48]; int i = 0; foreach (PlayerTierCompletion datum in recordsData) { labelTexts[i++] = datum.map + "/" + datum.mapTotal + " (" + String_Formatter.toString_CompletionPercent(datum.map, datum.mapTotal) + ")"; labelTexts[i++] = String_Formatter.toString_Points(datum.stage) + "/" + String_Formatter.toString_Points(datum.stageTotal) + " (" + String_Formatter.toString_CompletionPercent(datum.stage, datum.stageTotal) + ")"; labelTexts[i++] = String_Formatter.toString_Points(datum.bonus) + "/" + String_Formatter.toString_Points(datum.bonusTotal) + " (" + String_Formatter.toString_CompletionPercent(datum.bonus, datum.bonusTotal) + ")"; } applyLabelTexts(labelTexts); }
// 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; }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutRecords() { if (list_index != 1) { WRsStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } int i = 0; int length = worldRecordsData.Count; foreach (PlayerWorldRecords datum in worldRecordsData) { string rrstring = datum.mapName; if (wrsType != EFilter_PlayerWRsType.wr) { rrstring += " " + EFilter_ToString.zoneFormatter(datum.zoneID, false, false); } WRsStack.Children.Add(new Label { Text = rrstring, Style = App.Current.Resources["RRLabelStyle"] as Style }); string rrtime = "in " + String_Formatter.toString_RankTime(datum.surfTime) + " ("; if (datum.r2Diff is null) { rrtime += "WR N/A"; } else { rrtime += "WR-" + String_Formatter.toString_RankTime(datum.r2Diff.Substring(1)); } rrtime += ") (" + String_Formatter.toString_LastOnline(datum.date) + ")"; WRsStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != length) { WRsStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } } moreRecords = (i == LIST_LIMIT); MoreFrame.IsVisible = moreRecords; if (i == 0) // no recently broken records { WRsStack.Children.Add(new Label { Text = "None! :(", Style = App.Current.Resources["LeftColStyle"] as Style, HorizontalOptions = LayoutOptions.Center }); } }
// 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; }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutPRDetails() { string units = " u/s"; int i = 0; foreach (MapCPRDetails zoneCPR in CPRDetails) { CPRStack.Children.Add(new Label { Text = EFilter_ToString.CPRZoneFormatter(zoneCPR.zoneID, mapType), Style = App.Current.Resources["HeaderLabel"] as Style, Margin = new Thickness(10, 0, 0, 0) }); Grid recordGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 102 }, new ColumnDefinition { Width = 92 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, Style = App.Current.Resources["ColumnGridStyle"] as Style }; int playerVel = (int)double.Parse(zoneCPR.playerTouchVel); int wrVel = (int)double.Parse(zoneCPR.WRTouchVel); int diffVel = (int)double.Parse(zoneCPR.velDiff); recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = String_Formatter.toString_RankTime(zoneCPR.playerTime), Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT, IsVisible = i != 0 }, new Label { Text = playerVel + units, Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT }, } }, 0, 0); recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = String_Formatter.toString_RankTime(zoneCPR.WRTime), Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT, IsVisible = i != 0 }, new Label { Text = wrVel + units, Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT }, } }, 1, 0); string velPrefix = (diffVel > 0)? "+" : ""; string timePrefix = "+"; if (zoneCPR.timeDiff.Contains("-")) { zoneCPR.timeDiff = zoneCPR.timeDiff.Replace("-", ""); timePrefix = "-"; } recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = "(" + timePrefix + String_Formatter.toString_RankTime(zoneCPR.timeDiff) + ")", Style = App.Current.Resources["RightColStyle"] as Style, FontSize = GRIDFONT, IsVisible = i != 0 }, new Label { Text = "[" + velPrefix + diffVel + units + "]", Style = App.Current.Resources["RightColStyle"] as Style, FontSize = GRIDFONT }, } }, 2, 0); CPRStack.Children.Add(recordGrid); if (++i != CPRDetails.Count) { CPRStack.Children.Add(new BoxView { Style = App.Current.Resources["Separator2Style"] 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 (PlayerOldRecord 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 }); string rrtime = ""; string rrdiff = ""; if (oldestType == EFilter_PlayerOldestType.top10) { rrtime += "[R" + datum.rank + "] "; if (datum.wrdiff == "0") { rrdiff += " (WR)"; } else { rrdiff += " (WR+" + String_Formatter.toString_RankTime(datum.wrdiff) + ")"; } } else if (oldestType == EFilter_PlayerOldestType.map) { if (datum.top10Group != "0") { rrtime += "[G" + datum.top10Group.Substring(1) + "] "; } } else if (oldestType == EFilter_PlayerOldestType.wr || oldestType == EFilter_PlayerOldestType.wrcp || oldestType == EFilter_PlayerOldestType.wrb) { if (!(datum.r2Diff is null)) { if (datum.r2Diff != "0") { rrdiff += " (WR-" + String_Formatter.toString_RankTime(datum.r2Diff.Substring(1)) + ")"; } else { rrdiff += " (RETAKEN)"; } } else { rrdiff += " (WR N/A)"; } } rrtime += "in " + String_Formatter.toString_RankTime(datum.surfTime) + rrdiff; rrtime += " (" + String_Formatter.toString_LastOnline(datum.date) + ")"; ORStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != length) { ORStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } }
private void ChangeServers() { CSSServerStack.Children.Clear(); CSSMapsStack.Children.Clear(); CSS100TServerStack.Children.Clear(); CSS100TMapsStack.Children.Clear(); CSGOServerStack.Children.Clear(); CSGOMapsStack.Children.Clear(); int i = 1; int len = css_serverData.Count; foreach (KSFServerDatum datum in css_serverData) { if (datum.surftimer_servername.Equals("test", StringComparison.OrdinalIgnoreCase)) { --len; continue; } CSSServerStack.Children.Add(new Label { Text = datum.surftimer_servername, Style = App.Current.Resources["LeftColStyle"] as Style, }); CSSMapsStack.Children.Add(new Label { Text = datum.currentmap, Style = Resources["Right2ColStyle"] as Style }); CSSMapsStack.Children.Add(new Label { Text = datum.playersonline + " players, " + String_Formatter.toString_PlayTime(datum.timeleft, true) + " left", Style = Resources["Right3ColStyle"] as Style }); if (++i < len) { CSSMapsStack.Children.Add(new BoxView { Style = Resources["MapSeparatorStyle"] as Style }); } } i = 1; len = css100t_serverData.Count; foreach (KSFServerDatum datum in css100t_serverData) { if (datum.surftimer_servername.IndexOf("test", StringComparison.OrdinalIgnoreCase) >= 0) { --len; continue; } CSS100TServerStack.Children.Add(new Label { Text = datum.surftimer_servername, Style = App.Current.Resources["LeftColStyle"] as Style, }); CSS100TMapsStack.Children.Add(new Label { Text = datum.currentmap, Style = Resources["Right2ColStyle"] as Style }); CSS100TMapsStack.Children.Add(new Label { Text = datum.playersonline + " players, " + String_Formatter.toString_PlayTime(datum.timeleft, true) + " left", Style = Resources["Right3ColStyle"] as Style }); if (++i < len) { CSS100TMapsStack.Children.Add(new BoxView { Style = Resources["MapSeparatorStyle"] as Style }); } } i = 1; len = csgo_serverData.Count; foreach (KSFServerDatum datum in csgo_serverData) { if (datum.surftimer_servername.Equals("test", StringComparison.OrdinalIgnoreCase)) { --len; continue; } if (datum.surftimer_servername == "EasySurf Europe") { datum.surftimer_servername = "EasySurf EU"; } CSGOServerStack.Children.Add(new Label { Text = datum.surftimer_servername, Style = App.Current.Resources["LeftColStyle"] as Style, }); CSGOMapsStack.Children.Add(new Label { Text = datum.currentmap, Style = Resources["Right2ColStyle"] as Style }); CSGOMapsStack.Children.Add(new Label { Text = datum.playersonline + " players, " + String_Formatter.toString_PlayTime(datum.timeleft, true) + " left", Style = Resources["Right3ColStyle"] as Style }); if (++i < len) { CSGOMapsStack.Children.Add(new BoxView { Style = Resources["MapSeparatorStyle"] as Style }); } } }
private void LayoutStats() { CompletionsLabel.Text = String_Formatter.toString_Int(pointsData.TotalPlayers); TimesPlayedLabel.Text = String_Formatter.toString_Int(mapSettings.totalplaytimes); PlayTimeLabel.Text = String_Formatter.toString_PlayTime(mapSettings.playtime, true); }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutRecords() { ClearRecordsStacks(); int i = 0; foreach (RecentPlayerRecords datum in recordsBrokenData) { string rrstring = datum.mapName + " "; if (datum.zoneID != "0") { rrstring += EFilter_ToString.zoneFormatter(datum.zoneID, false, false) + " "; } RecordsBrokenStack.Children.Add(new Label { Text = rrstring, Style = App.Current.Resources["RRLabelStyle"] as Style }); if (datum.recordType.Contains("Top10")) { if (datum.prevRank != "10") { datum.recordType = "[R" + datum.prevRank + "]"; } else { datum.recordType = "Top10"; } } RecordsBrokenStack.Children.Add(new Label { Text = datum.recordType + " lost on " + datum.server + " server", Style = App.Current.Resources["RR2LabelStyle"] as Style, }); string rrtime = "now [R" + datum.newRank + "] ("; if (datum.wrDiff == "0") { rrtime += "RETAKEN"; } else { rrtime += "WR+" + String_Formatter.toString_RankTime(datum.wrDiff); } rrtime += ") (" + String_Formatter.toString_LastOnline(datum.date) + ")"; RecordsBrokenStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != recordsBrokenData.Count) { RecordsBrokenStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } } if (i == 0) // no recently broken records { RecordsBrokenStack.Children.Add(new Label { Text = "None! :)", Style = App.Current.Resources["LeftColStyle"] as Style, HorizontalOptions = LayoutOptions.Center }); } i = 0; foreach (RecentPlayerRecords datum in recordsSetData) { string rrstring = datum.mapName + " "; if (datum.zoneID != "0") { rrstring += EFilter_ToString.zoneFormatter(datum.zoneID, false, false) + " "; } RecordsSetStack.Children.Add(new Label { Text = rrstring, Style = App.Current.Resources["RRLabelStyle"] as Style }); RecordsSetStack.Children.Add(new Label { Text = datum.recordType + " set on " + datum.server + " server", Style = App.Current.Resources["RR2LabelStyle"] as Style }); string rrtime = "[R" + datum.newRank + "] in " + String_Formatter.toString_RankTime(datum.surfTime) + " ("; if (datum.wrDiff != "0") { if (datum.newRank == "1") { rrtime += "now "; } rrtime += "WR+" + String_Formatter.toString_RankTime(datum.wrDiff) + ") ("; } rrtime += String_Formatter.toString_LastOnline(datum.date) + ")"; RecordsSetStack.Children.Add(new Label { Text = rrtime, Style = App.Current.Resources["TimeLabelStyle"] as Style }); if (++i != recordsSetData.Count) { RecordsSetStack.Children.Add(new BoxView { Style = App.Current.Resources["SeparatorStyle"] as Style }); } } if (i == 0) // no recently set records { RecordsSetStack.Children.Add(new Label { Text = "None! :(", Style = App.Current.Resources["LeftColStyle"] as Style, HorizontalOptions = LayoutOptions.Center }); } }
private void LayoutPoints() { int fontsize = 16; CompletionStack.Children.Add(new Label { Text = "Map", Style = Resources["PointsStyle"] as Style, FontSize = fontsize }); CompletionValueStack.Children.Add(new Label { Text = String_Formatter.toString_Points(mapSettings.map_finish), Style = App.Current.Resources["RightColStyle"] as Style, FontSize = fontsize }); if (stageCount > 0) { CompletionStack.Children.Add(new Label { Text = "Stage", Style = Resources["PointsStyle"] as Style }); CompletionValueStack.Children.Add(new Label { Text = String_Formatter.toString_Points(mapSettings.stage_finish), Style = App.Current.Resources["RightColStyle"] as Style, FontSize = fontsize }); } if (bonusCount > 0) { CompletionStack.Children.Add(new Label { Text = "Bonus", Style = Resources["PointsStyle"] as Style, FontSize = fontsize }); CompletionValueStack.Children.Add(new Label { Text = String_Formatter.toString_Points(mapSettings.bonus_finish), Style = App.Current.Resources["RightColStyle"] as Style, FontSize = fontsize }); } int i = 1; foreach (double points in pointsData.TopPoints) { if (points == 0) { continue; } TopGroupStack.Children.Add(new Label { Text = (i != 1) ? "R" + i : "WR", Style = Resources["PointsStyle"] as Style, FontSize = fontsize }); TopGroupValueStack.Children.Add(new Label { Text = String_Formatter.toString_Points(points), Style = App.Current.Resources["RightColStyle"] as Style, FontSize = fontsize });; i++; } i = 0; int rank = 10; foreach (double points in pointsData.GroupPoints) { if (points == 0) { continue; } i++; int groupEnd = 10 + pointsData.GroupRanks[i]; GroupStack.Children.Add(new Label { Text = "G" + i + " (" + String_Formatter.toString_Points(rank + 1) + "-" + String_Formatter.toString_Points(groupEnd) + ")", Style = Resources["PointsStyle"] as Style, FontSize = fontsize }); GroupValueStack.Children.Add(new Label { Text = String_Formatter.toString_Points(points), Style = App.Current.Resources["RightColStyle"] as Style, FontSize = fontsize });; rank = groupEnd; } }
// 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 LayoutPRDetails() { string units = " u/s"; int i = 0; foreach (MapPRDetails zonePR in mapPRDetails) { if (zonePR.zoneID == "0") { continue; } bool noTime = (zonePR.surfTime is null || zonePR.surfTime == "0"); if (i != 0) { ZoneRecordStack.Children.Add(new BoxView { Style = App.Current.Resources["Separator2Style"] as Style }); } ZoneRecordStack.Children.Add(new Label { Text = EFilter_ToString.zoneFormatter(zonePR.zoneID, false, true), Style = App.Current.Resources["HeaderLabel"] as Style, Margin = new Thickness(10, 0, 0, 0) }); // Info ----------------------------------------------------------------- Grid recordGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 45 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, Style = App.Current.Resources["ColumnGridStyle"] as Style }; recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = "Time", Style = App.Current.Resources["LeftColStyle"] as Style }, new Label { Text = "Rank", Style = App.Current.Resources["LeftColStyle"] as Style }, } }, 0, 0); if (noTime) { recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = "None", Style = App.Current.Resources["RightColStyle"] as Style }, new Label { Text = "N/A", Style = App.Current.Resources["RightColStyle"] as Style }, } }, 1, 0); } else { string rank = zonePR.rank + "/" + zonePR.totalRanks; if (zonePR.rank == "1") { rank = "[WR] " + rank; } else if (int.Parse(zonePR.rank) <= 10) { rank = "[Top10] " + rank; } recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = String_Formatter.toString_RankTime(zonePR.surfTime), Style = App.Current.Resources["RightColStyle"] as Style }, new Label { Text = rank, Style = App.Current.Resources["RightColStyle"] as Style }, } }, 1, 0); } ZoneRecordStack.Children.Add(recordGrid); if (noTime) { i++; continue; } ZoneRecordStack.Children.Add(new BoxView { Style = App.Current.Resources["MiniSeparatorStyle"] as Style }); // Velocity ------------------------------------------------------------- Grid velGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 95 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, Style = App.Current.Resources["ColumnGridStyle"] as Style }; velGrid.Children.Add(new StackLayout { Children = { new Label { Text = "Avg Vel", Style = App.Current.Resources["LeftColStyle"] as Style }, new Label { Text = "Start Vel", Style = App.Current.Resources["LeftColStyle"] as Style }, new Label { Text = "End Vel", Style = App.Current.Resources["LeftColStyle"] as Style }, } }, 0, 0); velGrid.Children.Add(new StackLayout { Children = { new Label { Text = ((int)double.Parse(zonePR.avgVel)) + units, Style = App.Current.Resources["RightColStyle"] as Style }, new Label { Text = ((int)double.Parse(zonePR.startVel)) + units, Style = App.Current.Resources["RightColStyle"] as Style }, new Label { Text = ((int)double.Parse(zonePR.endVel)) + units, Style = App.Current.Resources["RightColStyle"] as Style }, } }, 1, 0); ZoneRecordStack.Children.Add(velGrid); ZoneRecordStack.Children.Add(new BoxView { Style = App.Current.Resources["MiniSeparatorStyle"] as Style }); // Completion ------------------------------------------------------------------ string completion = zonePR.count; if (!(zonePR.attempts is null)) { string percent = String_Formatter.toString_CompletionPercent(zonePR.count, zonePR.attempts); completion += "/" + zonePR.attempts + " (" + percent + ")"; } string time = ""; if (!(zonePR.totalSurfTime is null)) { time = String_Formatter.toString_PlayTime(zonePR.totalSurfTime, true); } Grid compGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 114 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, Style = App.Current.Resources["ColumnGridStyle"] as Style }; compGrid.Children.Add(new StackLayout { Children = { new Label { Text = "Completions", Style = App.Current.Resources["LeftColStyle"] as Style }, new Label { Text = "Time in Zone", Style = App.Current.Resources["LeftColStyle"] as Style }, } }, 0, 0); compGrid.Children.Add(new StackLayout { Children = { new Label { Text = completion, Style = App.Current.Resources["RightColStyle"] as Style }, new Label { Text = time, Style = App.Current.Resources["RightColStyle"] as Style }, } }, 1, 0); ZoneRecordStack.Children.Add(compGrid); i++; } }
// Displaying Changes ------------------------------------------------------------------------------- private void LayoutPRDetails() { string units = " u/s"; int i = 0; foreach (MapCCPDetails zoneCCP in CCPDetails) { CCPStack.Children.Add(new Label { Text = EFilter_ToString.zoneFormatter(zoneCCP.zoneID, true, true), Style = App.Current.Resources["HeaderLabel"] as Style, Margin = new Thickness(10, 0, 0, 0) }); Grid recordGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 102 }, new ColumnDefinition { Width = 92 }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, Style = App.Current.Resources["ColumnGridStyle"] as Style }; int playerVel = (int)double.Parse(zoneCCP.avgVelPlayer); int wrVel = (int)double.Parse(zoneCCP.avgVelWR); int diffVel = playerVel - wrVel; recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = String_Formatter.toString_RankTime(zoneCCP.cpTimePlayer), Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT, }, new Label { Text = playerVel + units, Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT }, } }, 0, 0); recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = String_Formatter.toString_RankTime(zoneCCP.cpTimeWR), Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT, }, new Label { Text = wrVel + units, Style = App.Current.Resources["LeftColStyle"] as Style, FontSize = GRIDFONT }, } }, 1, 0); double playerTime = double.Parse(zoneCCP.cpTimePlayer); double wrTime = double.Parse(zoneCCP.cpTimeWR); double timeDiff = playerTime - wrTime; string timePrefix = (timeDiff > 0) ? "+" : ""; string velPrefix = (diffVel > 0) ? "+" : ""; string timeString = String_Formatter.toString_RankTime(timeDiff.ToString()); if (timeString.Contains("-")) { timeString = timeString.Replace("-", ""); timePrefix = "-"; } recordGrid.Children.Add(new StackLayout { Children = { new Label { Text = "(" + timePrefix + timeString + ")", Style = App.Current.Resources["RightColStyle"] as Style, FontSize = GRIDFONT }, new Label { Text = "[" + velPrefix + diffVel + units + "]", Style = App.Current.Resources["RightColStyle"] as Style, FontSize = GRIDFONT }, } }, 2, 0); CCPStack.Children.Add(recordGrid); if (++i != CCPDetails.Count) { CCPStack.Children.Add(new BoxView { Style = App.Current.Resources["Separator2Style"] as Style }); } } }
private void LayoutPlayerInfo() { // Info ----------------------------------------------------------- RankLabel.Text = String_Formatter.toString_Int(playerInfoData.SurfRank); PointsLabel.Text = String_Formatter.toString_Points(playerInfoData.playerPoints.points); CompletionLabel.Text = playerInfoData.percentCompletion + "%"; WRsLabel.Text = playerInfoData.WRZones.wr; WRCPsLabel.Text = String_Formatter.toString_Int(playerInfoData.WRZones.wrcp); WRBsLabel.Text = String_Formatter.toString_Points(playerInfoData.WRZones.wrb); if (int.Parse(playerInfoData.WRZones.wr) > 0) { wrsType = EFilter_PlayerWRsType.wr; } else if (int.Parse(playerInfoData.WRZones.wrcp) > 0) { wrsType = EFilter_PlayerWRsType.wrcp; } else if (int.Parse(playerInfoData.WRZones.wrb) > 0) { wrsType = EFilter_PlayerWRsType.wrb; } WRsFrame.IsVisible = (wrsType != EFilter_PlayerWRsType.none); FirstOnlineLabel.Text = String_Formatter.toString_KSFDate(playerInfoData.basicInfo.firstOnline); LastSeenLabel.Text = String_Formatter.toString_LastOnline(playerInfoData.basicInfo.lastOnline); SurfTimeLabel.Text = String_Formatter.toString_PlayTime(playerInfoData.basicInfo.aliveTime, true); SpecTimeLabel.Text = String_Formatter.toString_PlayTime(playerInfoData.basicInfo.deadTime, true); // Completion ----------------------------------------------------- MapsValueLabel.Text = playerInfoData.CompletedZones.map + "/" + playerInfoData.TotalZones.TotalMaps; MapsValueLabel.Text += " (" + String_Formatter.toString_CompletionPercent(playerInfoData.CompletedZones.map, playerInfoData.TotalZones.TotalMaps) + ")"; StagesValueLabel.Text = String_Formatter.toString_Points(playerInfoData.CompletedZones.stage) + "/" + String_Formatter.toString_Points(playerInfoData.TotalZones.TotalStages); StagesValueLabel.Text += " (" + String_Formatter.toString_CompletionPercent(playerInfoData.CompletedZones.stage, playerInfoData.TotalZones.TotalStages) + ")"; BonusesValueLabel.Text = String_Formatter.toString_Points(playerInfoData.CompletedZones.bonus) + "/" + String_Formatter.toString_Points(playerInfoData.TotalZones.TotalBonuses); BonusesValueLabel.Text += " (" + String_Formatter.toString_CompletionPercent(playerInfoData.CompletedZones.bonus, playerInfoData.TotalZones.TotalBonuses) + ")"; // Groups --------------------------------------------------------- Top10sLabel.Text = playerInfoData.Top10Groups.top10; hasTop = (playerInfoData.Top10Groups.top10 != "0"); if (hasTop) { if (playerInfoData.Top10Groups.rank1 != "0") { R1GroupLabel.IsVisible = true; R1ValueLabel.IsVisible = true; R1ValueLabel.Text = playerInfoData.Top10Groups.rank1; } else { R1GroupLabel.IsVisible = false; R1ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank2 != "0") { R2GroupLabel.IsVisible = true; R2ValueLabel.IsVisible = true; R2ValueLabel.Text = playerInfoData.Top10Groups.rank2; } else { R2GroupLabel.IsVisible = false; R2ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank3 != "0") { R3GroupLabel.IsVisible = true; R3ValueLabel.IsVisible = true; R3ValueLabel.Text = playerInfoData.Top10Groups.rank3; } else { R3GroupLabel.IsVisible = false; R3ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank4 != "0") { R4GroupLabel.IsVisible = true; R4ValueLabel.IsVisible = true; R4ValueLabel.Text = playerInfoData.Top10Groups.rank4; } else { R4GroupLabel.IsVisible = false; R4ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank5 != "0") { R5GroupLabel.IsVisible = true; R5ValueLabel.IsVisible = true; R5ValueLabel.Text = playerInfoData.Top10Groups.rank5; } else { R5GroupLabel.IsVisible = false; R5ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank6 != "0") { R6GroupLabel.IsVisible = true; R6ValueLabel.IsVisible = true; R6ValueLabel.Text = playerInfoData.Top10Groups.rank6; } else { R6GroupLabel.IsVisible = false; R6ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank7 != "0") { R7GroupLabel.IsVisible = true; R7ValueLabel.IsVisible = true; R7ValueLabel.Text = playerInfoData.Top10Groups.rank7; } else { R7GroupLabel.IsVisible = false; R7ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank8 != "0") { R8GroupLabel.IsVisible = true; R8ValueLabel.IsVisible = true; R8ValueLabel.Text = playerInfoData.Top10Groups.rank8; } else { R8GroupLabel.IsVisible = false; R8ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank9 != "0") { R9GroupLabel.IsVisible = true; R9ValueLabel.IsVisible = true; R9ValueLabel.Text = playerInfoData.Top10Groups.rank9; } else { R9GroupLabel.IsVisible = false; R9ValueLabel.IsVisible = false; } if (playerInfoData.Top10Groups.rank10 != "0") { R10GroupLabel.IsVisible = true; R10ValueLabel.IsVisible = true; R10ValueLabel.Text = playerInfoData.Top10Groups.rank10; } else { R10GroupLabel.IsVisible = false; R10ValueLabel.IsVisible = false; } } else { R1GroupLabel.IsVisible = false; R1ValueLabel.IsVisible = false; R2GroupLabel.IsVisible = false; R2ValueLabel.IsVisible = false; R3GroupLabel.IsVisible = false; R3ValueLabel.IsVisible = false; R4GroupLabel.IsVisible = false; R4ValueLabel.IsVisible = false; R5GroupLabel.IsVisible = false; R5ValueLabel.IsVisible = false; R6GroupLabel.IsVisible = false; R6ValueLabel.IsVisible = false; R7GroupLabel.IsVisible = false; R7ValueLabel.IsVisible = false; R8GroupLabel.IsVisible = false; R8ValueLabel.IsVisible = false; R9GroupLabel.IsVisible = false; R9ValueLabel.IsVisible = false; R10GroupLabel.IsVisible = false; R10ValueLabel.IsVisible = false; } G1sLabel.Text = playerInfoData.Top10Groups.g1; G2sLabel.Text = playerInfoData.Top10Groups.g2; G3sLabel.Text = playerInfoData.Top10Groups.g3; G4sLabel.Text = playerInfoData.Top10Groups.g4; G5sLabel.Text = playerInfoData.Top10Groups.g5; G6sLabel.Text = playerInfoData.Top10Groups.g6; GroupsLabel.Text = playerInfoData.Top10Groups.groups; // Points Stack ------------------------------------------------------ Top10PtsLabel.Text = String_Formatter.toString_Points(playerInfoData.playerPoints.top10); GroupsPtsLabel.Text = String_Formatter.toString_Points(playerInfoData.playerPoints.groups); MapsPtsLabel.Text = String_Formatter.toString_Points(playerInfoData.playerPoints.map); string wrcpPoints = ""; if (playerInfoData.playerPoints.wrcp != "0") { wrcpPoints = "[+" + String_Formatter.toString_Points(playerInfoData.playerPoints.wrcp) + "] "; } StagesPtsLabel.Text = wrcpPoints + String_Formatter.toString_Points(playerInfoData.playerPoints.stage); string wrbPoints = ""; if (playerInfoData.playerPoints.wrb != "0") { wrbPoints = "[+" + String_Formatter.toString_Points(playerInfoData.playerPoints.wrb) + "] "; } BonusesPtsLabel.Text = wrbPoints + String_Formatter.toString_Points(playerInfoData.playerPoints.bonus); }