예제 #1
0
 // Initialize rate popup
 public void InitRateUS()
 {
     #if UNITY_IPHONE
     IOSRateUsPopUp rate = IOSRateUsPopUp.Create(title, message, yes, later, no);
     rate.appleId = appleId;
     #endif
 }
예제 #2
0
    public void GameOver()
    {
        gameOver = true;
        GA.API.Design.NewEvent("Game.End");
        PlayerPrefs.SetInt("GamesPlayed", PlayerPrefs.GetInt("GamesPlayed") + 1);
        if (PlayerPrefs.GetInt("GamesPlayed") % 4 == 0)
        {
            if (Advertisement.isReady())
            {
                Advertisement.Show();
                GA.API.Design.NewEvent("Advertisement.Shown");
            }
        }
        if (PlayerPrefs.GetInt("GamesPlayed") % 9 == 0)
        {
            IOSRateUsPopUp rate = IOSRateUsPopUp.Create();
            GA.API.Design.NewEvent("RateBox.Shown");
        }
        gameOverScreen.SetActive(true);

        PlayerPrefs.SetInt("RoundScore", levelScore);
        PlayerPrefs.SetInt("TotalScore", PlayerPrefs.GetInt("TotalScore") + levelScore);
        PlayerPrefs.SetInt("TotalCoinsCollected", PlayerPrefs.GetInt("TotalCoinsCollected") + collectedCoins);
        PlayerPrefs.SetInt("TotalAsteroidsDestroyed", PlayerPrefs.GetInt("TotalAsteroidsDestroyed") + PlayerPrefs.GetInt("RoundAsteroidsDestroyed"));

        GA.API.Design.NewEvent("Game.Round.Score", levelScore);
        GA.API.Design.NewEvent("Game.Round.Coins", PlayerPrefs.GetInt("CoinsCollected"));
        GA.API.Design.NewEvent("Game.Round.Asteroids", PlayerPrefs.GetInt("RoundAsteroidsDestroyed"));
        GA.API.Design.NewEvent("Game.Round.Distance", PlayerPrefs.GetInt("RoundDistance"));

        Debug.Log("New Round Score: " + levelScore);
        Debug.Log("New Total Score: " + PlayerPrefs.GetInt("TotalScore"));
        Debug.Log("New Total Coins: " + PlayerPrefs.GetInt("TotalCoinsCollected"));
        Debug.Log("New Total Asteroids: " + PlayerPrefs.GetInt("TotalAsteroidsDestroyed"));
        Debug.Log("New Round Distance: " + PlayerPrefs.GetInt("RoundDistance"));

        //TODO: More stat tracking!


        //Highscore Checking
        if (PlayerPrefs.GetInt("RoundScore") > PlayerPrefs.GetInt("HighScore"))
        {
            PlayerPrefs.SetInt("HighScore", levelScore);
            Debug.Log("New High Score Set: " + levelScore);
            GA.API.Design.NewEvent("Game.High.Score", levelScore);
        }
        if (PlayerPrefs.GetInt("RoundDistance") > PlayerPrefs.GetInt("HighDistance"))
        {
            PlayerPrefs.SetInt("HighDistance", PlayerPrefs.GetInt("RoundDistance"));
            Debug.Log("New High Distance Set: " + PlayerPrefs.GetInt("HighDistance"));
            GA.API.Design.NewEvent("Game.High.Distance", PlayerPrefs.GetInt("HighDistance"));
        }
        GameObject gameCenter = GameObject.Find("GameCenterManager");

        gameCenter.SendMessage("UpdateLeaderboard");
        //GameCenterScript gameCenter = new GameCenterScript();
        //gameCenter.UpdateLeaderboard();
    }
예제 #3
0
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------


    void OnGUI()
    {
        UpdateToStartPos();

        GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Native Pop-ups", style);

        StartY += YLableStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Rate Pop-up with events"))
        {
            IOSRateUsPopUp rate = IOSRateUsPopUp.Create("Like this game?", "Please rate to support future updates!");
            rate.OnComplete += onRatePopUpClose;
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dialog Pop-up"))
        {
            IOSDialog dialog = IOSDialog.Create("Dialog Title", "Dialog message");
            dialog.OnComplete += onDialogClose;
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Message Pop-up"))
        {
            IOSMessage msg = IOSMessage.Create("Message Title", "Message body");
            msg.OnComplete += onMessageClose;
        }


        StartX  = XStartPos;
        StartY += YButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dismissed Pop-up"))
        {
            Invoke("dismissAlert", 2f);
            IOSMessage.Create("Hello", "I will die in 2 sec");
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Open App Store"))
        {
            IOSNativeUtility.RedirectToAppStoreRatingPage();
        }


        StartX  = XStartPos;
        StartY += YButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Preloader "))
        {
            IOSNativeUtility.ShowPreloader();
            Invoke("HidePreloader", 3f);
        }


        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Hide Preloader"))
        {
            HidePreloader();
        }

        StartX += XButtonStep;
        if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Locale"))
        {
            IOSNativeUtility.OnLocaleLoaded += GetLocale;
            IOSNativeUtility.Instance.GetLocale();
        }
    }