Exemplo n.º 1
0
        // 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;
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        // 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();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 10
0
        // 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();
        }
Exemplo n.º 11
0
        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;
            }
        }
Exemplo n.º 12
0
        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);
            }
        }