Exemple #1
0
        public void StartLeaderboard(bool autoStart = false)
        {
            if (!Network.IsInternetConnection() && !autoStart)
            {
                Core.Utility.Popup.PopupMessages.Me.InternetConnectionMessgae();
                return;
            }
#if UNITY_IOS && GAMECENTER
            if (!GameCenterBinding.isPlayerAuthenticated())
            {
                GameCenterBinding.authenticateLocalPlayer();
            }
#endif
#if UNITY_ANDROID
#if GPGSERVIES && !AMAZONSTORE
            GPGManager.authenticationFailedEvent += (string error) => {
                MyDebug.Log("Prime[31] Google Play service authenticate fail with error:\n" + error);
            };
            GPGManager.authenticationSucceededEvent += (string data) => {
                MyDebug.Log("Prime[31] Google Play service authenticate compelete with data:\n" + data);
            };
            if (!PlayGameServices.isSignedIn())
            {
#if MYDEBUG
                PlayGameServices.enableDebugLog(true);
#endif
                PlayGameServices.authenticate();
            }
#endif
#endif
        }
Exemple #2
0
        public void ShowLeaderboard(ButtonEventArgs args)
        {
#if UNITY_IOS
#if GAMECENTER
            if (GameCenterBinding.isPlayerAuthenticated())
            {
                GameCenterBinding.showLeaderboardWithTimeScope(GameCenterLeaderboardTimeScope.AllTime);
            }
            else
            {
                StartLeaderboard();
            }
#else
            Core.Utility.Popup.PopupMessages.Me.NativeFuncionNonAvailableMessage();
#endif
#endif

#if UNITY_ANDROID
#if GPGSERVIES
            if (!PlayGameServices.isSignedIn())
            {
                StartLeaderboard(false);
            }
            else
            {
                PlayGameServices.showLeaderboards();
            }
#else
            Core.Utility.Popup.PopupMessages.Me.NativeFuncionNonAvailableMessage();
#endif
#endif
        }
Exemple #3
0
 // Se o usuario esta autenticado
 // Apos ser a classe ser isntanciada, é necessario autenticar o usuario com a Apple para fazer as checagens
 public static bool UserIsAuthenticated()
 {
             #if UNITY_IPHONE
     return(GameCenterBinding.isPlayerAuthenticated());
             #else
     return(false);
             #endif
 }
        public static bool IsSingedIn()
        {
#if UNITY_IOS
            return(GameCenterBinding.isPlayerAuthenticated());
#elif UNITY_ANDROID
            return(PlayGameServices.isSignedIn());
#endif
            return(false);
        }
Exemple #5
0
 public void Login()
 {
                 #if UNITY_IPHONE && API_SCORE_GAMECENTER
     if (!GameCenterBinding.isPlayerAuthenticated())
     {
         ZedLogger.Log("trying to authenticate local player");
         GameCenterBinding.authenticateLocalPlayer(false);
         GameCenterBinding.showCompletionBannerForAchievements();
     }
                 #endif
 }
Exemple #6
0
 void hitByRayCast()
 {
     if (GameCenterBinding.isPlayerAuthenticated())
     {
         GameCenterBinding.showLeaderboardWithTimeScope(GameCenterLeaderboardTimeScope.AllTime);
     }
     else
     {
         EtceteraBinding.showAlertWithTitleMessageAndButtons("Oops!", "You have to be logged into Game Center to do that!", new string[] { "OK" });
     }
 }
Exemple #7
0
    void onEnemyStatsChange(EnemyStats stats, EnemyBase._EnemyState state)
    {
        if (state == EnemyBase._EnemyState.Dead)
        {
            GameState = _GameState.Results;

            onUIUpdate(DBAccess.instance.userPrefs.userGun, GameState, null, stats);

            DBAccess.instance.userPrefs.wins++;

            if (GameCenterBinding.isPlayerAuthenticated())
            {
                GameCenterBinding.reportScore((long)DBAccess.instance.userPrefs.wins, "Leaderboard_Win");
            }
        }
    }
Exemple #8
0
        void ReportAchievement(string achievementID)
        {
#if UNITY_IOS && GAMECENTER
            if (!GameCenterBinding.isPlayerAuthenticated())
            {
                GameCenterBinding.authenticateLocalPlayer();
            }
            GameCenterBinding.reportAchievement(achievementID, 100f);
            GameCenterBinding.showCompletionBannerForAchievements();
#endif

#if UNITY_ANDROID
#if GPGSERVIES && !AMAZONSTORE
            PlayGameServices.unlockAchievement(achievementID, true);
#endif
#endif
        }
Exemple #9
0
    IEnumerator deathRoutine()
    {
        yield return(new WaitForSeconds(cameraAnimNode.animation["CameraDeath"].length));

        cameraFades[0].enabled = true;
        cameraFades[0].SetScreenOverlayColor(Color.clear);
        cameraFades[0].StartFade(new Color(0.725f, 0f, 0f, 1f), 2f);

        yield return(new WaitForSeconds(2f));

        cameraFades[0].enabled = false;

        DBAccess.instance.userPrefs.losses++;

        if (GameCenterBinding.isPlayerAuthenticated())
        {
            GameCenterBinding.reportScore((long)DBAccess.instance.userPrefs.losses, "Leaderboard_Loss");
        }
    }
Exemple #10
0
    void OnGUI()
    {
        //PAUSE MENU
        if (displayMainMenu)
        {
            gameOver = false;
            GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, sW, sH), mainMenuBackground, new Rect(0f, 0f, 5f, 5f));
            GUI.DrawTexture(new Rect(sW * 0.2f, sH * 0.1f, sW * 0.6f, sH * 0.1f), gamelogo);

            if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.3f, buttonWidth, buttonHeight), "RESUME GAME", customHighlightStyle))
            {
                displayMainMenu       = false;
                displayMainMenuPaused = false;
                Camera.main.GetComponent <beeGUI>().dispMenu = true;
                Time.timeScale = 1;
            }

            if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.4f, buttonWidth, buttonHeight), "LEADERBOARD", customButtonStyle))
            {
                if (GameCenterBinding.isPlayerAuthenticated())
                {
                    if (_hasLeaderboardData)
                    {
                        GameCenterBinding.showGameCenterViewController(GameCenterViewControllerState.Leaderboards);
                    }
                }
                else
                {
                    GameCenterBinding.authenticateLocalPlayer();
                    GameCenterBinding.loadLeaderboardTitles();
                }
            }


            if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.5f, buttonWidth, buttonHeight), "RATE", customHighlightStyle))
            {
                Application.OpenURL("itms-apps://itunes.apple.com/app/id875911453");
            }


            if (EncryptedPlayerPrefs.GetInt("10xtralives") != 1)
            {
                if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.6f, buttonWidth, buttonHeight), "EXTRA LIVES", customButtonStyle))
                {
                    displayExtraLives = true;
                    displayMainMenu   = false;
                }
            }


            if (EncryptedPlayerPrefs.GetInt("removeadverts") != 1)
            {
                if (EncryptedPlayerPrefs.GetInt("10xtralives") != 1)
                {
                    if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.7f, buttonWidth, buttonHeight), "REMOVE ADS", customHighlightStyle))
                    {
                        displayRemoveAds = true;
                        displayMainMenu  = false;
                    }
                }
                else
                {
                    if (GUI.Button(new Rect((sW - buttonWidth) / 2, sH * 0.6f, buttonWidth, buttonHeight), "REMOVE ADS", customButtonStyle))
                    {
                        displayRemoveAds = true;
                        displayMainMenu  = false;
                    }
                }
            }
        }


        //EXTRA LIVES
        if (displayExtraLives)
        {
            GUI.DrawTextureWithTexCoords(rRect(0f, 0f, 1f, 1f), mainMenuBackground, new Rect(0f, 0f, 5f, 5f));
            GUI.DrawTexture(rRect(0.2f, 0.1f, 0.6f, 0.1f), gamelogo);


            if (EncryptedPlayerPrefs.GetInt("10xtralives") != 1)
            {
                GUI.Label(rRect(0.25f, 0.3f, 0.5f, 0.05f), "BUY EXTRA LIVES", customHighlightStyle);
                GUI.Label(rRect(0.125f, 0.35f, 0.75f, 0.25f), "Survive longer each game by buying extra life options. You can buy an extra 3 or a whopping 10 extra lives!", customPaddedStyle);

                if (GUI.Button(rRect(0.125f, 0.6f, 0.375f, 0.05f), "3 EXTRA LIVES", customHighlightStyle))
                {
                    BuyExtraLives();
                }

                if (GUI.Button(rRect(0.5f, 0.6f, 0.375f, 0.05f), "RESTORE", customHighlightStyle))
                {
                    RestoreButtonPressed();
                }

                if (GUI.Button(rRect(0.125f, 0.65f, 0.375f, 0.05f), "10 EXTRA LIVES", customHighlightStyle))
                {
                    Buy10ExtraLives();
                }

                if (GUI.Button(rRect(0.5f, 0.65f, 0.375f, 0.05f), "CANCEL", customHighlightStyle))
                {
                    CancelButtonPressed();
                }
            }
        }


        //GAME OVER
        if (displayGameOver)
        {
            gameOver = true;

            if (showAds && AdBinding.isInterstitalLoaded())
            {
                AdBinding.destroyAdBanner();
                AdBinding.showInterstitial();
            }

            GUI.DrawTextureWithTexCoords(rRect(0f, 0f, 1f, 1f), mainMenuBackground, new Rect(0f, 0f, 5f, 5f));
            GUI.DrawTexture(rRect(0.2f, 0.1f, 0.6f, 0.1f), gamelogo);

            GUI.Label(rRect(0.3f, 0.25f, 0.4f, 0.05f), "GAME OVER", customHighlightStyle);
            GUI.Label(rRect(0.3f, 0.3f, 0.4f, 0.05f), "SCORE", customButtonStyle);
            GUI.Label(rRect(0.3f, 0.35f, 0.4f, 0.05f), ((int)Camera.main.GetComponent <beeGUI>().score).ToString(), customButtonStyle);
            GUI.Label(rRect(0.3f, 0.4f, 0.4f, 0.05f), "HIGH", customButtonStyle);
            GUI.Label(rRect(0.3f, 0.45f, 0.4f, 0.05f), EncryptedPlayerPrefs.GetInt("highScoore").ToString(), customButtonStyle);

            if (GUI.Button(rRect(0.3f, 0.52f, 0.4f, 0.05f), "RATE", customHighlightStyle))
            {
                Application.OpenURL("itms-apps://itunes.apple.com/app/id875911453");
            }

            if (GUI.Button(rRect(0.3f, 0.59f, 0.4f, 0.05f), "LEADERBOARD", customHighlightStyle))
            {
                if (GameCenterBinding.isPlayerAuthenticated())
                {
                    if (_hasLeaderboardData)
                    {
                        GameCenterBinding.showGameCenterViewController(GameCenterViewControllerState.Leaderboards);
                    }
                }
                else
                {
                    GameCenterBinding.authenticateLocalPlayer();
                    GameCenterBinding.loadLeaderboardTitles();
                }
            }

            float yoffset = 0f;

            if (EncryptedPlayerPrefs.GetInt("10xtralives") != 1)
            {
                if (GUI.Button(rRect(0.3f, 0.66f, 0.4f, 0.05f), "EXTRA LIVES", customHighlightStyle))
                {
                    displayExtraLives = true;
                    displayGameOver   = false;
                }
            }
            else
            {
                yoffset -= 0.07f;
            }

            if (showAds == true)
            {
                if (GUI.Button(rRect(0.3f, 0.73f + yoffset, 0.4f, 0.05f), "REMOVE ADS", customHighlightStyle))
                {
                    displayRemoveAds = true;
                    displayGameOver  = false;
                }
            }
            else
            {
                yoffset -= 0.07f;
            }

            if (GUI.Button(rRect(0.3f, 0.80f + yoffset, 0.4f, 0.05f), "TRY AGAIN", customHighlightStyle))
            {
                displayMainMenu = false;
                displayGameOver = false;
                Camera.main.GetComponent <beeGUI>().dispMenu = true;
                Time.timeScale = 1;
                if (showAds)
                {
                    AdBinding.createAdBanner(true);
                    AdBinding.initializeInterstitial();
                }
                Application.LoadLevel("game");
            }
        }


        //REMOVE ADS PURCHASE
        if (displayRemoveAds)
        {
            GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, sW, sH), mainMenuBackground, new Rect(0f, 0f, 5f, 5f));
            GUI.DrawTexture(new Rect(sW * 0.2f, sH * 0.1f, sW * 0.6f, sH * 0.1f), gamelogo);


            if (EncryptedPlayerPrefs.GetInt("removeadverts") != 1)
            {
                GUI.Label(rRect(0.25f, 0.3f, 0.5f, 0.05f), "REMOVE ADVERTS", customHighlightStyle);
                GUI.Label(rRect(0.125f, 0.35f, 0.75f, 0.25f), "Have and advert-free experience by purchasing the option below. Then experience uninterrupted gameplay!", customPaddedStyle);


                if (GUI.Button(rRect(0.125f, 0.6f, 0.25f, 0.05f), "NO ADS!", customHighlightStyle))
                {
                    BuyRemoveAds();
                }

                if (GUI.Button(rRect(0.375f, 0.6f, 0.25f, 0.05f), "RESTORE", customHighlightStyle))
                {
                    RestoreButtonPressed();
                }

                if (GUI.Button(rRect(0.625f, 0.6f, 0.25f, 0.05f), "CANCEL", customHighlightStyle))
                {
                    CancelButtonPressed();
                }
            }
        }


        //PROBLEM WITH IN-APP PURCHASE
        if (displayProblem)
        {
            GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, sW, sH), mainMenuBackground, new Rect(0f, 0f, 5f, 5f));
            GUI.DrawTexture(new Rect(sW * 0.2f, sH * 0.1f, sW * 0.6f, sH * 0.1f), gamelogo);

            GUI.Label(rRect(0.25f, 0.3f, 0.5f, 0.05f), "PROBLEM", customHighlightStyle);
            GUI.Label(rRect(0.125f, 0.35f, 0.75f, 0.25f), "There appears to be a problem in doing that action. Please can you try again later?", customPaddedStyle);


            if (GUI.Button(rRect(0.375f, 0.6f, 0.25f, 0.05f), "HOME", customHighlightStyle))
            {
                if (gameOver)
                {
                    displayGameOver = true;
                }
                else
                {
                    displayMainMenu = true;
                }
                displayProblem = false;
            }
        }
    }
Exemple #11
0
 // Checks to see if the current player is authenticated.
 public bool IsPlayerAuthenticated()
 {
     //Debug.Log ("GameCenter::IsPlayerAuthenticated");
     return(GameCenterBinding.isPlayerAuthenticated());
 }