Esempio n. 1
0
    void Start()
    {
        DataStorer.InitFile("game", 0.ToString());

        start = Time.time;
        //check if the best score is beat, if yes post it to gplay if authenticated
        int currentBest  = int.Parse(DataStorer.Read("prout"));
        int currentScore = FindObjectOfType <ScoreCounter>().score;

        if (currentScore > currentBest)
        {
            currentBest = currentScore;
            DataStorer.Store("prout", currentScore.ToString());
            GPlay gplay = FindObjectOfType <GPlay>();
            if (gplay.authenticated)
            {
                gplay.PostScoreToLeaderboard(currentScore);
            }
        }
        transform.FindChild("Best score").GetComponent <Text>().text = "Best : " + currentBest;

        int game = int.Parse(DataStorer.Read("game"));

        if (game >= 4)
        {
            DataStorer.Store("game", 0.ToString());
            StartCoroutine(AdManager.instance.ShowGoogleAd());
        }
        else
        {
            game++;
            DataStorer.Store("game", game.ToString());
        }
    }
Esempio n. 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
         GooglePlayGames.PlayGamesPlatform.Activate();
         ((GooglePlayGames.PlayGamesPlatform)Social.Active).SetDefaultLeaderboardForUI(GPGConst.leaderboard_score);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 3
0
    public void ClickLeaderBoard()
    {
        GPlay gplay = GPlay.instance;

        if (gplay != null)
        {
            if (!gplay.authenticated)
            {
                gplay.Authenticate((bool success) =>
                {
                    if (success)
                    {
                        gplay.ShowLeaderboard();
                    }
                });
            }
            else
            {
                gplay.ShowLeaderboard();
            }
        }
    }