示例#1
0
    public void SaveCurrentLevelWin(int Stars)
    {
        string currentScene;
        int    currentSceneNo;

        currentScene = SceneManager.GetActiveScene().name;

        currentSceneNo = Convert.ToInt32(currentScene.Substring(currentScene.IndexOf("_") + 1, currentScene.Length - Convert.ToInt32(currentScene.IndexOf("_") + 1)));

        if (currentSceneNo == PlayerPrefs.GetInt("UnlockedScenes"))
        {
            PlayerPrefs.SetInt("UnlockedScenes", PlayerPrefs.GetInt("UnlockedScenes") + 1);
            GooglePlay.IncrementAchievement(GPGSIds.leaderboard_high_scores, 10);
            GooglePlayManager.Instance.View5WinsIncrementalAchievment();
            GooglePlayManager.Instance.View10WinsIncrementalAchievment();
            GooglePlayManager.Instance.View15WinsIncrementalAchievment();
            GooglePlayManager.Instance.View20WinsIncrementalAchievment();

            PlayerPrefs.SetInt("WinsInARow", PlayerPrefs.GetInt("WinsInARow") + 1);

            GooglePlayManager.Instance.ViewWins3LevelsInARowIncrementalAchievment();
            GooglePlayManager.Instance.ViewWins5LevelsInARowIncrementalAchievment();
        }


        if (PlayerPrefs.HasKey("Stars_" + currentSceneNo.ToString()))
        {
            if (PlayerPrefs.GetInt("Stars_" + currentSceneNo.ToString()) < Stars)
            {
                PlayerPrefs.SetInt("TotalStars", PlayerPrefs.GetInt("TotalStars") + Stars - PlayerPrefs.GetInt("Stars_" + currentSceneNo.ToString()));
                PlayerPrefs.SetInt("Stars_" + currentSceneNo.ToString(), Stars);
            }
        }
        else
        {
            PlayerPrefs.SetInt("Stars_" + currentSceneNo.ToString(), Stars);
            PlayerPrefs.SetInt("TotalStars", PlayerPrefs.GetInt("TotalStars") + Stars);
        }

        GooglePlay.AddScoreToLeaderboard(GPGSIds.leaderboard_high_scores, PlayerPrefs.GetInt("TotalStars") * 10);
    }
 public void IncrementAchievement(string achievementID)
 {
     googlePlay.IncrementAchievement(achievementID);
 }