예제 #1
0
    IEnumerator ShowingAds()
    {
        yield return(new WaitForSeconds(1));

        Debug.LogError("showing=" + UnityEngine.Advertisements.Advertisement.isShowing);
        while (UnityEngine.Advertisements.Advertisement.isShowing)
        {
            yield return(null);
        }

        PlayAdsState playAdResult = GameDataManager.unityAdsResult;

        if (playAdResult == PlayAdsState.NOTENOUGHTIME)
        {
            dialogBox.Show("Info", "Please wait...", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.SKIPPED)
        {
            dialogBox.Show("Info", "Skipping ads will not give you any GemuGold.", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.FINISHED)
        {
            GiveCoinToUserAfterWatchingAds();
        }
        else if (playAdResult == PlayAdsState.FAILED)
        {
            dialogBox.Show("Info", "Failed playing ads", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.NOTREADY)
        {
            dialogBox.Show("Info", "Ad is not ready", false, "", this.gameObject);
        }
    }
예제 #2
0
    IEnumerator ShowingAds()
    {
        yield return(new WaitForSeconds(1));

        Debug.LogError("showing=" + UnityEngine.Advertisements.Advertisement.isShowing);
        while (UnityEngine.Advertisements.Advertisement.isShowing)
        {
            yield return(null);
        }

        PlayAdsState playAdResult = GameDataManager.unityAdsResult;

        if (playAdResult == PlayAdsState.NOTENOUGHTIME)
        {
            //GemuDialogBoxController.GetInstance ().Show ("Info", "Please wait...", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.SKIPPED)
        {
            //GemuDialogBoxController.GetInstance ().Show ("Info", "Skipping ads will not give you any coin.", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.FINISHED)
        {
            /*
             * int jmlCoinsNow = PlayerPrefs.GetInt(PlayerPrefHandler.keyCoin);
             * jmlCoinsNow += 5;
             * PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, jmlCoinsNow);
             *
             * CoinTimerHandler.instance.countCoin = jmlCoinsNow;
             *
             * GameDataManager.instance.SendPlayResult(
             *      GameDataManager.GEMU_APP_ID,"0",
             *      jmlCoinsNow.ToString(),
             *      "0",
             *      "1");
             *
             * GemuDialogBoxController.GetInstance ().Show ("Info", "You got 5 coins.", false, "", this.gameObject);
             */
        }
        else if (playAdResult == PlayAdsState.FAILED)
        {
            //GemuDialogBoxController.GetInstance ().Show ("Info", "Failed playing ads", false, "", this.gameObject);
        }
        else if (playAdResult == PlayAdsState.NOTREADY)
        {
            //GemuDialogBoxController.GetInstance ().Show ("Info", "Ad is not ready", false, "", this.gameObject);
        }
        bWatchedAds = true;
        continue_game();
    }
예제 #3
0
	public static bool PlayUnityVideoAd()
	{
		Debug.LogError("[GameDataManager] PlayUnityVideoAd");
		unityAdsResult = PlayAdsState.NOTREADY;
		// check timer
		//int iDiff = GetTimerToWatchAds ();
		//if ( iDiff > TIMER_TO_WATCH_ADS ) // TODO : Set the value using static var
		//{
			// user can now watch the ad
			string adName = "";
			string adString = PlayerPrefs.GetString ("UnityAds" + adName);
			if (Advertisement.IsReady (adString)) 
			{

				
				PlayerPrefs.SetInt("timerads",GameManager.getEpochTime());
				ShowOptions options = new ShowOptions();
				//options.resultCallback = HandleShowResult;
				Advertisement.Show(adString, options);
				
				Debug.LogError("show");
				return true;
				
			}
			else
			{
			
			Debug.LogError("not ready");
			}
		//}
		//else
		//{
		//	Debug.LogError("not enough time");
			// user must wait 
		//	unityAdsResult = PlayAdsState.NOTENOUGHTIME;
		//	return false;
		//}
		return false;
	}