예제 #1
0
        private async void checkIfRecord()
        {
            bool hasBeenShowed = false;
            bool time          = false;
            bool score         = false;
            bool move          = false;
            var  scores        = await _rankservice.getTopScores();

            if (_rankservice.ScoreByTypeFilter(scores, 0)[_rankservice.ScoreByTypeFilter(scores, 0).Count - 1].Result < _gameService._game.Score)
            {
                hasBeenShowed = true;
                score         = true;
            }
            if (_rankservice.ScoreByTypeFilter(scores, 1)[_rankservice.ScoreByTypeFilter(scores, 1).Count - 1].Result > _gameService._game.BestTime)
            {
                hasBeenShowed = true;
                time          = true;
            }
            if (_rankservice.ScoreByTypeFilter(scores, 2)[_rankservice.ScoreByTypeFilter(scores, 2).Count - 1].Result < _gameService._game.BestMove)
            {
                hasBeenShowed = true;
                move          = true;
            }

            if (hasBeenShowed)
            {
                if (_gameService._game.Playername == null || _gameService._game.Playername == "")
                {
                    await _playerDialog.ShowAsync();

                    _gameService._game.Playername = _playerDialog._name;
                }
                string response;
                if (score)
                {
                    response = await _rankservice.addNewScore(_gameService._game.Playername, _gameService._game.Score, 0);
                }
                if (time)
                {
                    response = await _rankservice.addNewScore(_gameService._game.Playername, _gameService._game.BestTime, 1);
                }
                if (move)
                {
                    response = await _rankservice.addNewScore(_gameService._game.Playername, _gameService._game.BestMove, 2);
                }
                await RecordMessageBoxDisplay();
            }
            LoseMessageBoxDisplay();
        }
예제 #2
0
        private async void getDataFromService()
        {
            var topScores = await _rankService.getTopScores();

            UpdateLists(topScores);
        }