Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameManager.instance.playerData.matchPlayed++;
        GameConfig.CheckScoreSkin(GameManager.instance.lastLevel);
        Server.instance.UpdateHighScore(GameManager.instance.finalScore);

        if (GameManager.instance.playerData.matchPlayed == 1)
        {
            GameManager.instance.AFTrackRichEvent("af_tutorial_completion");
        }

        GameManager.instance.AFTrackRichEvent("sendScore", score: GameManager.instance.finalScore);

        GameConfig.CheckMatchSkin();
        GameManager.instance.playerData.SaveData();

        adsCoin         = Random.Range(20, 50);
        finalScore.text = GameManager.instance.finalScore.ToString();
        bestScore.text  = LocalizedString.GetString("best").ToUpper() + " " + Server.instance.playerBestScore;
        todayBest.text  = LocalizedString.GetString("today").ToUpper() + " " + Server.instance.playerDailyScore;
        playerCoin.text = GameManager.instance.playerData.playerCoin.ToString();
        level.text      = GameManager.instance.lastLevel.ToString();

        bool hasAds = GameManager.instance.IsAdsReady();

        if (hasAds)
        {
            //got ads
            adsButton.interactable = true;
            adsText.text           = LocalizedString.GetString("watchAdsCoin").ToUpper();
        }
        else
        {
            // no ads
            adsButton.interactable = false;
            adsText.text           = LocalizedString.GetString("noAdsToWatch").ToUpper();
        }

        StartCoroutine(FadeController.FadeIn(adsObject));
    }