コード例 #1
0
    public void showVideoAd()
    {
        if (HZIncentivizedAd.isAvailable())
        {
            HZIncentivizedAd.show();

            HZIncentivizedAd.setDisplayListener(listener);
        }
    }
コード例 #2
0
//	void queryInventorySucceededEvent( List<GooglePurchase> purchases, List<GoogleSkuInfo> skus )
//	{
//		Debug.Log( string.Format( "queryInventorySucceededEvent. total purchases: {0}, total skus: {1}", purchases.Count, skus.Count ) );
//		Prime31.Utils.logObject( purchases );
//		Prime31.Utils.logObject( skus );
//		for(int i = 0; i < purchases.Count; i++)
//		{
//			Debug.Log("Order id = " + purchases[i].productId +"   State = "+ purchases[i].purchaseState);
//			if(purchases[i].purchaseState == GooglePurchase.GooglePurchaseState.Purchased)
//			{
//				//Can Restore purchse
//				Debug.Log("Can Restore purchse");
//				canRestored = true;
//			}
//		}
//
//	}
//
//
//	void queryInventoryFailedEvent( string error )
//	{
//		Debug.Log( "queryInventoryFailedEvent: " + error );
//	}
//
//	void purchaseSucceededEvent( GooglePurchase purchase )
//	{
//		Debug.Log( "purchaseSucceededEvent: " + purchase );
//		if(purchase.productId == Constants.PRODUCT_ID)
//		{
//			Debug.Log("No ads purchased");
//			HZBannerAd.hide();
//			Main.Instance.isNoAdsPurchased = true;
//			PlayerPrefs.SetBool(Constants.KEY_NOADS, Main.Instance.isNoAdsPurchased);
//			PlayerPrefs.Flush();
//
//
//			if(isRestoring)
//			{
//				#if UNITY_ANDROID
//				EtceteraAndroid.showAlert("Purchase Restored", "Ads removed", "Ok");
//				#elif UNITY_IPHONE
//				CreateAlertForRestore("Purchase Restored","Ads removed", "Ok");
//				#endif
//
//			}
//
//			if(Main.Instance.isNoAdsPurchased)
//			{
//				if(noAddButtonHome != null)
//				{
//					noAddButtonHome.interactable = false;
//				}
//			}
//
//			if(Main.Instance.isNoAdsPurchased)
//			{
//				if(noAddButtonGameOver != null)
//				{
//					noAddButtonGameOver.interactable = false;
//				}
//			}
//		}
//
//
//	}
        #endif
    #endregion



    #region Reward Video
    public void ShowRewardVideo()
    {
        if (HZIncentivizedAd.isAvailable())
        {
            GameData.isFreeGift = true;
            Main.Instance.MuteSounds();
            HZIncentivizedAd.show();
        }
    }
コード例 #3
0
 public void ContinueYES()
 {
     isReviveBreaked = true;
     CancelInvoke("CntDown");
     StopCoroutine(Timer());
     Main.Instance.PlayButtonClickSound();
     if (HZIncentivizedAd.isAvailable())
     {
         HZIncentivizedAd.Show();
     }
 }
コード例 #4
0
    public void Die()
    {
        if (!isRevived && HZIncentivizedAd.isAvailable())
        {
//			Debug.Log("Set revive");
            SetState(BirdState.WaitForRevive);
        }
        else
        {
            SetState(BirdState.Died);
        }
    }
コード例 #5
0
    public void GameOver()
    {
        GameData.isComingFromGameOverStore = true;
        Main.Instance.gameCount++;
        Main.Instance.sessionGameCount++;
        PlayerPrefs.SetInt(Constants.KEY_TOTAL_GAMES, Main.Instance.gameCount);
        Main.Instance.totalScoreOfSession += gameScore;
//		Debug.Log("GameOver");

        if (hudPanel.gameObject.activeSelf)
        {
            hudPanel.gameObject.SetActive(false);
        }



        if (!gameOverPanel.gameObject.activeSelf)
        {
            if (HZIncentivizedAd.isAvailable())
            {
                rewardButton.gameObject.SetActive(true);
            }
            else
            {
                rewardButton.gameObject.SetActive(false);
            }
            rewardConfirmImg.gameObject.SetActive(false);

            gameOverScoreText.text = "" + gameScore;
            if (gameScore > bestScore)
            {
                bestScore = gameScore;
                Main.Instance.PlayBestScoreSound();
                newBestText.gameObject.SetActive(true);
                PlayerPrefs.SetInt(Constants.KEY_BEST, bestScore);
                bestScoreText.text = "" + bestScore;
            }
            else
            {
//				Main.Instance.PlayGameOverSound();
                newBestText.gameObject.SetActive(false);
                bestScoreText.text = "" + bestScore;
            }

            //Add total eggs
            if (gameScore > 0)
            {
                Main.Instance.totalEggs += gameScore;
                PlayerPrefs.SetInt(Constants.KEY_TOTAL_EGGS, Main.Instance.totalEggs);

                GameData.lifeTimeEggs += gameScore;
                PlayerPrefs.SetInt(Constants.KEY_LIFE_TIME_EGGS, GameData.lifeTimeEggs);
            }

            totalEggs.text = "" + Main.Instance.totalEggs;


            if (Main.Instance.isNoAdsPurchased)
            {
                if (noAddButtonGameOver != null)
                {
                    noAddButtonGameOver.interactable = false;
                }
            }

            //Save Data
            PlayerPrefs.Flush();

            Main.Instance.PostScoreToLeaderBoard(gameScore);
//			gameOverInstText.text = GameData.gameOverInstructionText;
            gameOverPanel.gameObject.SetActive(true);


            if (!tutorialReplay.gameObject.activeSelf)
            {
                tutorialReplay.gameObject.SetActive(true);
            }
        }

        CheckForQuests();

        if (Main.Instance.gameCount > 1 && Main.Instance.gameCount % 3 == 0)
        {
            if (!Main.Instance.isNoAdsPurchased)
            {
                HZInterstitialAd.show();

                                #if UNITY_IOS
                AppTrackerIOS.loadModule("inapp");
                                #endif
            }
        }

        UniRate.Instance.LogEvent(true);
    }