Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        inst      = this;
        _coinText = coinText;
        MainMenu.RefreshCoinAmount();

        this.mainPanelRectTransform     = mainPanel.GetComponent <RectTransform>();
        this.mainMenuPanelRectTransform = startPanel.GetComponent <RectTransform>();
        this.gameTypePanelRectTransform = gameTypePanel.GetComponent <RectTransform>();
        this.itemPanelRectTransform     = itemPanel.GetComponent <RectTransform>();
        this.canvasRectTransform        = canvas.GetComponent <RectTransform>();
        this.devPanelTransform          = devPanel.GetComponent <RectTransform>();
        //PlayerPrefs.SetInt("Coins", 0); //Used to reset the coins when they get out of hand.

        this.spaceButtonsOnGameTypePanel();
        this.checkHash();

        if (startedOnce)
        {
        }

        if (GPGFunctions.isAuthenticated())
        {
            this.loginGoogleButton.gameObject.SetActive(false);
        }

        if (NetChecker.connection == NetChecker.Connection.NoInternet)
        {
            this.loginGoogleButton.interactable = false;
            this.leaderboardButton.interactable = false;
            this.videoAdButton.interactable     = false;
            this.interAdButton.interactable     = false;
        }

        if (!GPGFunctions.isAuthenticated())
        {
            this.leaderboardButton.interactable = false;
            MainMenu.inst.loginGoogleButton.transform.GetChild(0).GetComponent <Text>().text = "Log In to \n Google Play";
        }
        else
        {
            this.leaderboardButton.interactable = true;
            this.loginGoogleButton.transform.GetChild(0).GetComponent <Text>().text = "Log Out of \n Google Play";
        }

        if (!Debug.isDebugBuild)
        {
            GameObject.Find("Dev").SetActive(false);
            GameObject.Find("DevPanel").SetActive(false);
        }

        startedOnce = true;

        currPanel = mainMenuPanelRectTransform;
    }
Exemplo n.º 2
0
    public void ShowHighScore()
    {
        string boardName = "";
        string boardID   = "";

        if (levelType == LevelType.Normal)
        {
            boardID   = "CgkIzpi-qqMDEAIQBg";
            boardName = "Normal_Highscore";
        }
        else if (levelType == LevelType.Angled)
        {
            boardID   = "CgkIzpi-qqMDEAIQCg";
            boardName = "Angled_Highscore";
        }
        else if (levelType == LevelType.Double)
        {
            boardID   = "CgkIzpi-qqMDEAIQCw";
            boardName = "Double_Highscore";
        }

        //Get the previous highscore
        int previousHighscore = PlayerPrefs.GetInt(boardName);

        //Display the highscores
        this.oldScore.text = "" + previousHighscore;
        this.newScore.text = "" + overallScore;

        //If the new score is not higher than the old one, hide the "NEW HIGH SCORE!" text.
        if (overallScore <= previousHighscore)
        {
            highScorePanel.transform.GetChild(0).gameObject.SetActive(false);
        }
        else
        {
            //Set the new highscore
            PlayerPrefs.SetInt(boardName, overallScore);
        }

        //If we're authenticated, submit score!
        GPGFunctions.submitScore(overallScore, boardID);
    }
    public void Play(string type)
    {
        if (type == "normal")
        {
            GameLevel.levelType = GameLevel.LevelType.Normal;
            GPGFunctions.incrementEvent("CgkIzpi-qqMDEAIQBw", 1);
        }
        if (type == "angled")
        {
            GameLevel.levelType = GameLevel.LevelType.Angled;
            GPGFunctions.incrementEvent("CgkIzpi-qqMDEAIQCA", 1);
        }
        if (type == "double")
        {
            GameLevel.levelType = GameLevel.LevelType.Double;
            GPGFunctions.incrementEvent("CgkIzpi-qqMDEAIQCQ", 1);
        }

        SceneManager.LoadScene("Game");

        //GameAnalytics.NewDesignEvent("play:mode:" + type);
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        GPGFunctions.start();
        AdFunctions.instance().init();

        //NetChecker.Test(null);
        //StartCoroutine(NetChecker.checkInternetConnection((isConnected) => {
        //    if (isConnected)
        //    {
        //        NetChecker.connection = NetChecker.Connection.Connected;
        //        //foreach (Button button in buttonsToDisable)
        //        //    button.interactable = false;
        //    }
        //    else
        //    {
        //        NetChecker.connection = NetChecker.Connection.NoInternet;
        //        //foreach (Button button in buttonsToDisable)
        //        //    button.interactable = false;
        //    }
        //}));

        StartCoroutine(loadGame());
    }
 public void OpenLeaderboards()
 {
     GPGFunctions.openLeaderboards();
 }