Beispiel #1
0
    public void UpdateStreakAchievements(int streak)
    {
        if (!Achievements.GetRookie() && streak >= achieve1Streak)
        {
            Achievements.SetRookie(1);
            PlayGamesController.UnlockRookieAchievement();
        }

        if (!Achievements.GetStudent() && streak >= achieve2Streak)
        {
            Achievements.SetStudent(1);
            PlayGamesController.UnlockStudentAchievement();
        }

        if (!Achievements.GetMathematician() && streak >= achieve3Streak)
        {
            Achievements.SetMathematician(1);
            PlayGamesController.UnlockMathematicianAchievement();
        }

        if (!Achievements.GetGeometer() && streak >= achieve4Streak)
        {
            Achievements.SetGeometer(1);
            PlayGamesController.UnlockGeometerAchievement();
        }

        if (!Achievements.GetEngineer() && streak >= achieve5Streak)
        {
            Achievements.SetEngineer(1);
            PlayGamesController.UnlockEngineerAchievement();
        }
    }
    public void OnButtonPostToLeaderboard()
    {
        Debug.Log("Posting score to leaderboard");
        errorText.text = "";

        //If there is no value in the score input field
        if (string.IsNullOrEmpty(scoreInputField.text))
        {
            errorText.text = "Error: Could not post score to leaderboard. Please enter a value in the score input field.";
            return;
        }
        else
        {
            long scoreToPost;
            //Convert the value in the input field from string to long
            if (long.TryParse(scoreInputField.text, out scoreToPost))
            {
                PlayGamesController.PostToLeaderboard(scoreToPost);
            }
            else
            {
                errorText.text = "Error: Could not post score to leaderboard. Please enter a valid score value.";
            }
        }
    }
Beispiel #3
0
    public void UpdateFitsAchievements(int fits)
    {
        if (!Achievements.GetFitter() && fits >= achieve1Fits)
        {
            Achievements.SetFitter(1);
            PlayGamesController.UnlockFitterAchievement();
        }

        if (!Achievements.GetBossFitter() && fits >= achieve2Fits)
        {
            Achievements.SetBossFitter(1);
            PlayGamesController.UnlockBossFitterAchievement();
        }

        if (!Achievements.GetBlockManager() && fits >= achieve3Fits)
        {
            Achievements.SetBlockManager(1);
            PlayGamesController.UnlockBlockManagerAchievement();
        }

        if (!Achievements.GetGoodShot() && fits >= achieve4Fits)
        {
            Achievements.SetGoodShot(1);
            PlayGamesController.UnlockGoodShotAchievement();
        }

        if (!Achievements.GetMasterCalculator() && fits >= achieve5Fits)
        {
            Achievements.SetMasterCalculator(1);
            PlayGamesController.UnlockMasterCalculatorAchievement();
        }
    }
Beispiel #4
0
    public void UpdateTimeAchievements(float time)
    {
        if (!Achievements.GetWalker() && time >= achieve1Time)
        {
            Achievements.SetWalker(1);
            PlayGamesController.UnlockWalkerAchievement();
        }

        if (!Achievements.GetHurried() && time >= achieve2Time)
        {
            Achievements.SetHurried(1);
            PlayGamesController.UnlockHurriedAchievement();
        }

        if (!Achievements.GetRunner() && time >= achieve3Time)
        {
            Achievements.SetRunner(1);
            PlayGamesController.UnlockRunnerAchievement();
        }

        if (!Achievements.GetSurvivor() && time >= achieve4Time)
        {
            Achievements.SetSurvivor(1);
            PlayGamesController.UnlockSurvivorAchievement();
        }

        if (!Achievements.GetTimeTraveller() && time >= achieve5Time)
        {
            Achievements.SetTimeTraveller(1);
            PlayGamesController.UnlockTimeTravellerAchievement();
        }
    }
Beispiel #5
0
    public static void AddNewScoreTest2(int score)
    {
        completedTest2 = true;
        scoreTest2     = score;
        if (score > highScoreTest2)
        {
            highScoreTest2 = score;
        }
        if (currUser != "GUEST")
        {
            PlayGamesController.PostToLeaderboardTest2((long)score);
        }

        for (int i = 1; i <= 10; ++i)
        {
            string keyStr = "test2Score" + i;
            if (!PlayerPrefs.HasKey(keyStr))
            {
                PlayerPrefs.SetInt(keyStr, score);
                return;
            }
        }

        for (int i = 1; i < 10; ++i)
        {
            string keyStr1 = "test2Score" + i;
            string keyStr2 = "test2Score" + (i + 1);
            PlayerPrefs.SetInt(keyStr1, PlayerPrefs.GetInt(keyStr2));
        }
        PlayerPrefs.SetInt("test2Score10", score);
    }
Beispiel #6
0
 public void UpdateLevel4Achievement()
 {
     if (!Achievements.GetLevel4())
     {
         Achievements.SetLevel4(1);
         PlayGamesController.UnlockLevel4Achievement();
     }
 }
Beispiel #7
0
 public void UpdateMaxLevelAchievement()
 {
     if (!Achievements.GetMaxLevel())
     {
         Achievements.SetMaxLevel(1);
         PlayGamesController.UnlockMaxLevelAchievement();
     }
 }
Beispiel #8
0
    private IEnumerator UpdateLeaderboard()
    {
        while (!playGamesController.authenticated)
        {
            yield return(null);
        }

        PlayGamesController.PostToHighScoreLeaderboard(PlayerPrefManager.GetTopScore());
    }
 private void Awake()
 {
     if (!Instance)
     {
         Instance = this;
         DontDestroyOnLoad(this);
         return;
     }
     Destroy(this);
 }
Beispiel #10
0
    // Update is called once per frame
    void Update()
    {
        ScoreText.text = "" + Score;

        if (Score >= 10)
        {
            inter.ShowInter();
        }
        else if (Score >= 420)
        {
            PlayGamesController.unlockAchievment("CgkIkYqNutcYEAIQBg");
        }
    }
 public void GoToScoresLeaderboard()
 {
     if (GlobalController.currUser != "GUEST")
     {
         PlayGamesController.ShowLeaderboardUI();
     }
     else
     {
         infoText.SetActive(true);
         c.a = 1;
         infoTextComp.color = c;
     }
 }
Beispiel #12
0
    private void ShowTopScore(int speed = 1)
    {
        if (PlayerPrefManager.GetLastScore() < PlayerPrefManager.GetTopScore())
        {
            topScoreText.GetComponent <Animator>().SetFloat("Speed", speed);
            topScoreText.GetComponent <Animator>().Play("TopScoreShow");
            return;
        }

        newBestScoreText.GetComponent <Animator>().SetFloat("Speed", speed);
        newBestScoreText.GetComponent <Animator>().Play("NewBestScoreShow");

        PlayGamesController.PostToHighScoreLeaderboard(PlayerPrefManager.GetTopScore());
    }
Beispiel #13
0
    public override void OnActivate()
    {
        Managers.Game.isGameActive = false;

        if (Managers.Score.currentScore > StatsController.Instance.highScore)
        {
            StatsController.Instance.highScore = Managers.Score.currentScore;
        }

        StatsController.Instance.numberOfGames++;
        Managers.UI.popUps.ActivateGameOverPopUp();
        Managers.Audio.PlayLoseSound();
        // Update the PlayGames highscore
        PlayGamesController.AddScoreToLeaderboard(GPGSIds.leaderboard_highscores, StatsController.Instance.highScore);
    }
Beispiel #14
0
 public void EndGame()
 {
     if (!gameHasEnded)
     {
         bool gameHasEnded = true;
         int  currentScore = (int)FindObjectOfType <Score>().score;
         if (PlayerPrefs.GetInt("HighScore") < currentScore)
         {
             PlayerPrefs.SetInt("HighScore", currentScore);
             newHighScore = true;
         }
         gameOverScreen.startGameOverAnimation(currentScore, newHighScore);
         PlayGamesController.PostToLeaderBoard((long)PlayerPrefs.GetInt("HighScore"));
     }
 }
Beispiel #15
0
    /* void CheckHighScore(): loads and shows banners, then checks if player has made new high score and shows related panel */
    public void CheckHighScore()
    {
        //this.GoogleAdMobBanners.LoadBanners();
        this.GoogleAdMobBanners.ShowBanners();

        if (this.CurrentScore > this.HighScore)
        {
            PlayerPrefs.SetInt("high_score", this.CurrentScore);
            this.HighScore = PlayerPrefs.GetInt("high_score");

            PlayGamesController.PostPlayerScoreToLeaderboard(this.HighScore);

            ShowNewHighScoreBox();
        }
        else
        {
            ShowLosingBox();
        }
    }
Beispiel #16
0
    private static void UpdateScore()
    {
        if (PlayerPrefs.GetInt("NewHighScore") == default(int))
        {
            PlayerPrefs.SetInt("NewHighScore", 0);
        }

        var currentHighScoreInMemory = PlayerPrefs.GetInt("NewHighScore");
        var currentGameScore         = PlayerPrefs.GetInt("Score");

        if (currentHighScoreInMemory < currentGameScore)
        {
            PlayerPrefs.SetInt("NewHighScore", currentGameScore);
        }

        if (GameObject.FindGameObjectsWithTag("CurrentScore").Length > 0)
        {
            var scoreText = GameObject.FindGameObjectsWithTag("CurrentScore")[0].GetComponent <TMPro.TextMeshProUGUI>();
            if (scoreText != null)
            {
                scoreText.text = currentGameScore.ToString();
            }
        }

        if (GameObject.FindGameObjectsWithTag("FinalScore").Length > 0)
        {
            var scoreText = GameObject.FindGameObjectsWithTag("FinalScore")[0].GetComponent <TMPro.TextMeshProUGUI>();
            if (scoreText != null)
            {
                scoreText.text = currentGameScore.ToString();
            }
        }

        if (GameObject.FindGameObjectsWithTag("HighScore").Length > 0)
        {
            var scoreText = GameObject.FindGameObjectsWithTag("HighScore")[0].GetComponent <TMPro.TextMeshProUGUI>();
            if (scoreText != null)
            {
                scoreText.text = PlayerPrefs.GetInt("NewHighScore").ToString();
            }
            PlayGamesController.AddScoreToLeaderBoard(GPGSIds.leaderboard_top_defenders, PlayerPrefs.GetInt("NewHighScore"));
        }
    }
Beispiel #17
0
    void Start()
    {
        /*
         * Singleton
         */
        if (instance)
        {
            Destroy(instance);
        }

        instance = this;

        //Configura biblioteca do google
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.Activate();

        SignIn();
    }
Beispiel #18
0
    public void UpdateScoreAchievements(int score)
    {
        if (!Achievements.GetICanDoIt() && score >= achieve1Score)
        {
            Achievements.SetICanDoIt(1);
            PlayGamesController.UnlockICanDoItAchievement();
        }

        if (!Achievements.GetImImproving() && score >= achieve2Score)
        {
            Achievements.SetImImproving(1);
            PlayGamesController.UnlockImImprovingAchievement();
        }

        if (!Achievements.GetBlocksAreMyFriend() && score >= achieve3Score)
        {
            Achievements.SetBlocksAreMyFriend(1);
            PlayGamesController.UnlockBlocksAreMyFriendsAchievement();
        }

        if (!Achievements.GetThisIsActuallyEasy() && score >= achieve4Score)
        {
            Achievements.SetThisIsActuallyEasy(1);
            PlayGamesController.UnlockThisIsActuallyEasyAchievement();
        }

        if (!Achievements.GetTheMaster() && score >= achieve5Score)
        {
            Achievements.SetTheMaster(1);
            PlayGamesController.UnlockTheMasterAchievement();
        }

        if (!Achievements.GetTheProfessional() && score >= achieve6Score)
        {
            Achievements.SetTheProfessional(1);
            PlayGamesController.UnlockTheProfessionalAchievement();
        }
    }
Beispiel #19
0
    public void UpdateTheCompletionist()
    {
        if (Achievements.GetTheCompletionist())
        {
            return;
        }

        if (Achievements.GetLevel1() &&
            Achievements.GetLevel2() &&
            Achievements.GetLevel3() &&
            Achievements.GetLevel4() &&
            Achievements.GetMaxLevel() &&
            Achievements.GetICanDoIt() &&
            Achievements.GetBlocksAreMyFriend() &&
            Achievements.GetImImproving() &&
            Achievements.GetThisIsActuallyEasy() &&
            Achievements.GetTheMaster() &&
            Achievements.GetTheProfessional() &&
            Achievements.GetRookie() &&
            Achievements.GetStudent() &&
            Achievements.GetMathematician() &&
            Achievements.GetGeometer() &&
            Achievements.GetEngineer() &&
            Achievements.GetWalker() &&
            Achievements.GetHurried() &&
            Achievements.GetRunner() &&
            Achievements.GetSurvivor() &&
            Achievements.GetTimeTraveller() &&
            Achievements.GetFitter() &&
            Achievements.GetBossFitter() &&
            Achievements.GetBlockManager() &&
            Achievements.GetGoodShot() &&
            Achievements.GetMasterCalculator())
        {
            Achievements.SetTheCompletionist(1);
            PlayGamesController.UnlockTheCompletionistAchievement();
        }
    }
Beispiel #20
0
 void Start()
 {
     PlayGamesController.PostToLeaderBoard((long)PlayerPrefs.GetInt("HighScore"));
 }
Beispiel #21
0
 public void GoogleConnect()
 {
     PlayGamesController.AuthenticateUser();
 }
Beispiel #22
0
 public void ShowLeaderBoard()
 {
     PlayGamesController.AuthenticateUserFromgamemanager();
     PlayGamesController.ShowLeaderboardUI();
 }
Beispiel #23
0
 public void ShowAchievementsWindow()
 {
     Close();
     PlayGamesController.ShowAchievementsUI();
 }
Beispiel #24
0
 public void ShowRankingsWindow()
 {
     Close();
     PlayGamesController.ShowHighScoreLeaderboardUI();
 }
 public void PostToLeaderBoard()
 {
     ScoreToPost = GetComponent <Game>().Score;
     PlayGamesController.PostToLeaderboard(ScoreToPost);
 }
 public void ShowLeaderBoard()
 {
     PlayGamesController.ShowLeaderboard();
 }
Beispiel #27
0
 public void OnLeaderboardClick()
 {
     PlayGamesController.ShowLeaderboardUI();
 }
Beispiel #28
0
 /* void ShowRanking(): show google play games "global leaderboard" */
 public void ShowGlobalLeaderboard()
 {
     PlayGamesController.ShowGlobalLeaderboard();
 }
 public void OnButtonShowLeaderboard()
 {
     Debug.Log("Showing leaderboard");
     PlayGamesController.ShowLeaderboardUI();
 }
Beispiel #30
0
    public void OnTriggerEnter2D(Collider2D collision)
    {
        #region

        /*
         *  implementação lógica de perda e ganhos
         */

        if (collision.gameObject.tag == "Obstacle")
        {
            if (lives > 0)
            {
                if (!superPower)
                {
                    Destroy(GameObject.Find("Life" + lives.ToString()));
                    lives -= 1;
                }
            }
            else
            {
                if (score > bestScore)
                {
                    bestScore = score;
                    PlayerPrefs.SetInt("BestScore", bestScore);
                }


                PlayGamesController.AddScoreToRanking(GPGSIds.leaderboard_ranking, (long)score);


                PlayerPrefs.SetInt("CltdIdeias", cltdIdeias);
                PlayerPrefs.SetInt("CltdLux", cltdLuxes);
                PlayerPrefs.SetInt("MindsReleased", mindsReleased);
                gpgCtrl.GameOver();
            }
        }
        else if (collision.gameObject.tag == "Ideia")
        {
            score      += 1000;
            cltdIdeias += 1;
            StartCoroutine("ExplodeSynapse", collision.gameObject.transform);
            Destroy(collision.gameObject);
        }
        else if (collision.gameObject.tag == "Lux")
        {
            score     += 10000;
            cltdLuxes += 1;

            //Jogador recebe um Mind
            if (cltdLuxes == freeMindInterval)
            {
                mindsReleased   += 1;
                freeMindInterval = cltdLuxes + 10;
                //Debug.Log("Muito bem! Você libertou uma mente!");
            }
            StartCoroutine("ExplodeLux", collision.gameObject.transform);
            Destroy(collision.gameObject);
        }

        #endregion
    }