// UI ------------------------------------------------------------------------------------------------------------------------------------- #region UI private void ChangePlayerFilter(EFilter_PlayerType newPlayerType) { if (playerType == newPlayerType) { return; } switch (playerType) { case EFilter_PlayerType.me: PlayerMeLabel.TextColor = untappedTextColor; break; case EFilter_PlayerType.rank: PlayerRankLabel.TextColor = untappedTextColor; break; case EFilter_PlayerType.steamid: PlayerSteamLabel.TextColor = untappedTextColor; break; default: break; } switch (newPlayerType) { case EFilter_PlayerType.me: PlayerMeLabel.TextColor = tappedTextColor; break; case EFilter_PlayerType.rank: PlayerRankLabel.TextColor = tappedTextColor; break; case EFilter_PlayerType.steamid: PlayerSteamLabel.TextColor = tappedTextColor; break; default: break; } resetPlayer = (newPlayerType != EFilter_PlayerType.me); checkReset(); BaseViewModel.vibrate(allowVibrate); playerType = newPlayerType; }
internal async Task <PlayerWRsRootObject> GetPlayerWRs(EFilter_Game game, EFilter_Mode mode, EFilter_PlayerWRsType wrType, EFilter_PlayerType playerType, string playerValue, int startIndex) { if (!BaseViewModel.hasConnection()) { return(null); } string gameString = EFilter_ToString.toString(game); string modeString = ((int)mode).ToString(); string wrString = EFilter_ToString.toString(wrType); string playerTypeString = EFilter_ToString.toString(playerType); if (gameString == "" || playerValue == "") { return(null); } client.BaseUrl = new Uri("http://surf.ksfclan.com/api2/" + gameString + "/" + playerTypeString + "/" + playerValue + "/" + wrString + "/" + startIndex + ",10/" + modeString); await Task.Run(() => response = client.Execute(request)); if (response.StatusCode == System.Net.HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <PlayerWRsRootObject>(response.Content)); } else { return(null); } }
// 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(); }
public PlayerFilterPage(Action <EFilter_Game, EFilter_Mode, EFilter_PlayerType, string> FilterApplier, EFilter_Game currentGame, EFilter_Mode currentMode, EFilter_PlayerType currentPlayerType, string currentPlayerSteamId, string currentPlayerRank, EFilter_Game defaultGame, EFilter_Mode defaultMode, string meSteamId) { this.FilterApplier = FilterApplier; this.defaultGame = defaultGame; this.defaultMode = defaultMode; this.meSteamId = meSteamId; InitializeComponent(); ChangeGameFilter(currentGame); ChangeModeFilter(currentMode); ChangePlayerFilter(currentPlayerType); PlayerMeIDLabel.Text = " " + meSteamId; playerRank = currentPlayerRank; RankEntry.Text = playerRank; playerSteamId = currentPlayerSteamId; SteamIdEntry.Text = playerSteamId; allowVibrate = true; }
public PlayerRecentRecordsPage(string title, PlayerViewModel playerViewModel, EFilter_Game game, EFilter_Mode mode, EFilter_PlayerType playerType, string playerValue) { this.playerViewModel = playerViewModel; this.game = game; this.mode = mode; this.playerType = playerType; this.playerValue = playerValue; InitializeComponent(); Title = title; }
public PlayerMapsCompletionPage(string title, PlayerViewModel playerViewModel, EFilter_Game game, EFilter_Mode mode, EFilter_PlayerCompletionType completionType, EFilter_PlayerType playerType, string playerValue) { this.playerViewModel = playerViewModel; this.game = game; this.mode = mode; this.playerType = playerType; this.playerValue = playerValue; this.completionType = completionType; InitializeComponent(); Title = title; HeaderLabel.Text = EFilter_ToString.toString2(completionType); }
internal async void ApplyFilters(EFilter_Game newGame, EFilter_Mode newMode, EFilter_PlayerType newPlayerType, string newPlayerValue) { if (BaseViewModel.hasConnection()) { LoadingAnimation.IsRunning = true; await ChangePlayerInfo(newGame, newMode, newPlayerType, newPlayerValue); LoadingAnimation.IsRunning = false; } else { await DisplayNoConnectionAlert(); } await PlayerPageScrollView.ScrollToAsync(0, 0, true); }
public static string toString(EFilter_PlayerType type) { string typeString = ""; switch (type) { case EFilter_PlayerType.steamid: typeString = "steamid"; break; case EFilter_PlayerType.rank: typeString = "rank"; break; case EFilter_PlayerType.me: goto case EFilter_PlayerType.steamid; default: break; } return(typeString); }
public PlayerOldestRecordsPage(string title, PlayerViewModel playerViewModel, EFilter_Game game, EFilter_Mode mode, EFilter_PlayerType playerType, string playerValue, EFilter_PlayerWRsType wrsType, bool hasTop) { this.playerViewModel = playerViewModel; this.game = game; this.mode = mode; this.playerType = playerType; this.playerValue = playerValue; this.wrsType = wrsType; this.hasTop = hasTop; oldRecordsOptionStrings = new List <string>(EFilter_ToString.ortype_arr); InitializeComponent(); Title = title; }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangePlayerInfo(EFilter_Game newGame, EFilter_Mode newMode, EFilter_PlayerType newPlayerType, string newPlayerValue) { if (newGame == game && newMode == mode && newPlayerValue == playerValue) { return; } var playerInfoDatum = await playerViewModel.GetPlayerInfo(newGame, newMode, newPlayerType, newPlayerValue); playerInfoData = playerInfoDatum?.data; if (playerInfoData is null || playerInfoData.basicInfo is null) { await DisplayAlert("Could not find player profile!", "Invalid SteamID or rank.", "OK"); return; } playerType = newPlayerType; playerValue = newPlayerValue; game = newGame; mode = newMode; playerSteamId = playerInfoData.basicInfo.steamID; playerRank = playerInfoData.SurfRank; string playerName = playerInfoData.basicInfo.name; if (playerName.Length > 18) { playerName = playerName.Substring(0, 13) + "..."; } Title = playerName + " [" + EFilter_ToString.toString2(game) + ", " + EFilter_ToString.toString(mode) + "]"; var PlayerSteamDatum = await playerViewModel.GetPlayerSteamProfile(playerSteamId); playerSteamProfile = PlayerSteamDatum?.response.players[0]; wrsType = EFilter_PlayerWRsType.none; LayoutPlayerInfo(); LayoutPlayerProfile(); }
public MapsMapPRPage(string title, MapsViewModel mapsViewModel, EFilter_Game game, string map, bool hasZones, bool hasStages) { mapsMapTitle = title; this.mapsViewModel = mapsViewModel; this.game = game; this.map = map; this.hasZones = hasZones; this.hasStages = hasStages; playerValue = meSteamID; playerSteamID = meSteamID; playerType = EFilter_PlayerType.me; InitializeComponent(); Title = mapsMapTitle + " " + EFilter_ToString.toString(defaultMode) + "]"; if (!hasZones) { ZoneRecordsOption.IsVisible = false; } if (!hasStages) { CCPOption.IsVisible = false; } }
internal async Task <MapPRInfoRootObject> GetMapPRInfo(EFilter_Game game, EFilter_Mode mode, string map, EFilter_PlayerType playerType, string playerValue) { if (!BaseViewModel.hasConnection()) { return(null); } string gameString = EFilter_ToString.toString(game); string modeString = ((int)mode).ToString(); string playerTypeString = EFilter_ToString.toString(playerType); if (gameString == "" || map == "" || playerValue == "") { return(null); } client.BaseUrl = new Uri("http://surf.ksfclan.com/api2/" + gameString + "/map/" + map + "/zone/0/" + playerTypeString + "/" + playerValue + "/recordinfo/" + modeString); await Task.Run(() => response = client.Execute(request)); if (response.StatusCode == System.Net.HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <MapPRInfoRootObject>(response.Content)); } else { return(null); } }