void setUpBuyButton(GameShopCell cell, int row)
    {
        GameFairyModel cellData = fairiesDataSource.dataArray[row];

        cell.fairyButton.onClick.RemoveAllListeners();
        cell.fairyButton.onClick.AddListener(() => {
            if (_playerData.playerFairies.Contains(row) == false)
            {
                if (_playerData.playerScore >= cellData.fairyPrice)
                {
                    _playerData.playerFairies.Add(row);
                    _playerData.playerScore -= cellData.fairyPrice;
                    uncheckPreviousFairy();
                    selectFairyOnIndexWithCell(row, cell);
                    _playerData.savePlayerData();
                    cell.price.gameObject.SetActive(false);

                    GameAnaliticsController analiticsController = GameObject.FindObjectOfType <GameAnaliticsController>();
                    analiticsController.buyFairyPressed();
                }
                else
                {
                    inAppPurchasesPopUp.SetActive(true);
                }
            }
            else
            {
                uncheckPreviousFairy();
                selectFairyOnIndexWithCell(row, cell);
            }
        });
    }
Ejemplo n.º 2
0
 void onVKLogin()
 {
     if (_playerData.logInVk == false)
     {
         _playerData.playerScore += gameSettings.logInReward;
         _playerData.logInVk      = true;
         _playerData.savePlayerData();
     }
 }
Ejemplo n.º 3
0
 void getPlayerRewardForLogIn()
 {
     if (_playerData.logInFb == false)
     {
         _playerData.playerScore += gameSettings.logInReward;
         _playerData.logInFb      = true;
         _playerData.savePlayerData();
     }
 }
Ejemplo n.º 4
0
    void inviteFriendHandler(VKRequest request)
    {
        if (request.error != null)
        {
            return;
        }

        _playerData.playerScore += gameSettings.inviteFriendReward;
        _playerData.savePlayerData();
        Action callback = request.data[0] as Action;

        callback();
    }
Ejemplo n.º 5
0
 void buyBonusForIndex(int aIndex)
 {
     blockAdButton.SetActive(false);
     _playerData.blockAdsInAppBought = true;
     _playerData.playerScore        += fairiesDataSource.inAppsDataArray[aIndex].scoresCount;
     _playerData.savePlayerData();
 }
    void Update()
    {
        if (_activeTutorial == true)
        {
            gameLogicController._swipeDirectionController.getTouchDirection();

            if (_currentTutorialIndex == 0 && gameLogicController._swipeDirectionController.mMessageIndex == 2)
            {
                goToNextTutorial();
            }

            if (_currentTutorialIndex == 1 && gameLogicController._swipeDirectionController.mMessageIndex == 1)
            {
                goToNextTutorial();
            }

            if (_currentTutorialIndex == 2 && gameLogicController._swipeDirectionController.mMessageIndex == 3)
            {
                goToNextTutorial();
            }

            if (_currentTutorialIndex == 3 && gameLogicController._swipeDirectionController.mMessageIndex == 4)
            {
                _activeTutorial = false;
                tutorialParts[_currentTutorialIndex].SetActive(false);
                _playerData.completedTutorial = true;
                gameLogicController.resumeGame();
                _playerData.savePlayerData();
                GameAnaliticsController analiticsController = GameObject.FindObjectOfType <GameAnaliticsController>();
                analiticsController.finishGameTutorial();
            }
        }
    }
 public void getAdditionalScores()
 {
     _playerData.playerScore  += gameLogicController._score;
     gameResultScoreLabel.text = _playerData.playerScore.ToString();
     doubleScoreButton.gameObject.SetActive(false);
     _playerData.savePlayerData();
 }
    public void OnGetUserInfo(VKRequest request)
    {
        if (request.error != null)
        {
            return;
        }

        _playerData.playerScore += gameGlobalSettings.logInReward;
        _playerData.logInVk      = true;
        _playerData.savePlayerData();
        vkButton.SetActive(false);

        if (fbButton.activeSelf == false)
        {
            _playerData.notNowPressed = true;
            _playerData.savePlayerData();
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 9
0
    void createNewPlayer()
    {
        GamePlayerDataController playerData = ServicesLocator.getServiceForKey(typeof(GamePlayerDataController).Name) as GamePlayerDataController;

        if (playerData.playerExist == false)
        {
            playerData.createNewPlayer();
            playerData.savePlayerData();
        }
    }
 public void checkPromoCode()
 {
     if (_playerData.playerUsePromocode == false)
     {
         if (promoCodeField.text == gameSettings.promoCode)
         {
             _playerData.playerUsePromocode = true;
             _playerData.playerScore       += gameSettings.promoCodeReward;
             _playerData.savePlayerData();
             analiticsController.playerUsePromoCode();
             rightCodeSign.SetActive(true);
             wrongCodeSign.SetActive(false);
             doneButton.SetActive(false);
             promoCodeField.gameObject.SetActive(false);
         }
         else
         {
             rightCodeSign.SetActive(false);
             wrongCodeSign.SetActive(true);
         }
     }
 }
Ejemplo n.º 11
0
    public void saveCollectedPlayerScore()
    {
        GamePlayerDataController playerData = ServicesLocator.getServiceForKey(typeof(GamePlayerDataController).Name) as GamePlayerDataController;
        int scoreCount = 0;

        if (playerData.selectedLevelIndex == 0)
        {
            scoreCount = _score;
        }

        if (playerData.selectedLevelIndex == 1)
        {
            scoreCount = _score * 2;
        }

        if (playerData.selectedLevelIndex == 2)
        {
            scoreCount = _score * 3;
        }

        playerData.playerScore += scoreCount;
        playerData.savePlayerData();
    }
Ejemplo n.º 12
0
 public void gameMusicVolumeChanged(float aVolume)
 {
     _playerData.gameMusicVolume = aVolume;
     _playerData.savePlayerData();
 }
 public void easyGameSelected()
 {
     _playerData.selectedLevelIndex = 0;
     _playerData.savePlayerData();
     fadingController.startFade(gameSettings.mainGameScreenName, false);
 }