Пример #1
0
 // UNITY ADS
 public void ShowRewardedAd()
 {
     if (Advertisement.IsReady("rewardedVideo")) {
         var options = new ShowOptions { resultCallback = HandleShowResult };
         Advertisement.Show("rewardedVideo", options);
     }
 }
Пример #2
0
    public void YesButton()
    {
        switch(whichMenu) {
            case CONF_RESET:
                PlayerPrefs.DeleteAll();
                //Destroy(GameObject.FindObjectOfType<SoundController>());
                SceneManager.LoadScene(0);
                break;
            case CONF_WATCH:
                if (Advertisement.IsReady("rewardedVideo")) {
                    Debug.Log("Showing ad");
                    ShowOptions options = new ShowOptions { resultCallback = HandleShowResult };
                    Advertisement.Show("rewardedVideo", options);
                } else {
                    Debug.Log("Ad not ready");
                }
                //PrefsController.AddTotalCoins(5000);
                //GameObject.FindObjectOfType<ShaderMenuController>().PopulateBallShaders();
                break;
            default:
                break;
        }

        confirmMenu.SetActive(false);
    }
Пример #3
0
    public void ShowAd(string zone = null)
    {
        // If the value for zone is an empty, set it to null.
        //  When the zone value is null, the default zone will be used.
        if (string.IsNullOrEmpty(zone)) zone = null;

        ShowOptions options = new ShowOptions();

        // With the pause option set to true, the timeScale and AudioListener
        //  volume for your game is set to 0 while the ad is shown.
        // NOTE: The current version of Unity Ads always pauses the app.
        options.pause = true;

        // Use the resultCallback action to call a method when an ad is closed.
        //  The method assigned should accept a parameter of type ShowResult.
        if (zone == "rewardedVideoZone" || zone == "incentivisedVideoZone")
        {
            options.resultCallback = HandleShowResultWithReward;
        }
        else
        {
            options.resultCallback = HandleShowResult;
        }

        // Show the ad with the specified zone and options.
        Advertisement.Show(zone,options);
    }
    public void ShowAd(string zoneId)
    {
        if (!Advertisement.isInitialized)
        {
            Log(0, "Not initialized!");
            return;
        }

        if (!Advertisement.IsReady(zoneId))
        {
            if (zoneId != null)
            {
                Log(0, string.Format("Not ready (zone '{0}')!", zoneId));
            }
            else
            {
                Log(0, "Not ready!");
            }
            return;
        }

        var options = new ShowOptions
        {
            resultCallback = result => Log(0, string.Format("Result: {0}", result))
        };

        Advertisement.Show(zoneId, options);
    }
Пример #5
0
    void OnGUI()
    {
        //Available count lets us know  how many interstitials we have to show. If this is zero, you will get an error upon calling show
        GUILayout.Label("availableCount: " + Advertisement.availableCount);

        //Setting prefetch lets you tell us how many interstitials to queue up in advance. This can be useful to avoid loading times. Default is 1.
        GUILayout.Label("prefetchCount: " + Advertisement.prefetchCount);
        if (GUILayout.Button("+"))
            Advertisement.prefetchCount++;
        if (GUILayout.Button("-"))
            Advertisement.prefetchCount--;

        if (GUILayout.Button("show"))
        {
            showCount++;
            int localCount = showCount;

            //ShowOptions has two values: resultCallback, a callback which returns one of Closed, Failed or Clicked
            //  and pause, which tells us whether or not to pause the app while showing an interstitial.
            //  pause is true by default
            ShowOptions opts = new ShowOptions
            {
                resultCallback = result => Debug.Log("show " + localCount + ": " + result)
            };

            //Ensure an interstitial is ready
            if (Advertisement.availableCount > 0)
                Advertisement.Show(opts);
            //When calling show, if any errors were received by failed downloads, wrong urls, etc.
            //It will iterate through those errors until it finds an interstitial to show.
        }
    }
Пример #6
0
 public static void ShowAdForRevive()
 {
     if (Advertisement.IsReady ("rewardedVideo"))
     {
         var options = new ShowOptions { resultCallback = AdResults };
         Advertisement.Show("rewardedVideo", options);
     }
 }
Пример #7
0
 public static void ShowVideoAd()
 {
     if (IsVideoAdLoaded())
     {
         ShowOptions options = new ShowOptions { resultCallback = HandleShowResult };
         Advertisement.Show(videoAdZone, options);
     }
 }
Пример #8
0
    void ShowAdPlacement()
    {
        if (string.IsNullOrEmpty(zoneId)) zoneId = null;

        ShowOptions options = new ShowOptions();
        options.resultCallback = HandleShowResult;

        Advertisement.Show(zoneId, options);
    }
Пример #9
0
 public void ShowRewardedAd()
 {
     if (Advertisement.IsReady())
     {
         ShowOptions options = new ShowOptions();
         options.resultCallback = HandleShowResult;
         Advertisement.Show(null, options);
     }
 }
Пример #10
0
 public void EarnMoneyAction()
 {
     if (Advertisement.IsReady ("rewardedVideo")) {
         var options = new ShowOptions { resultCallback = HandleShowResult };
         Advertisement.Show ("rewardedVideo", options);
     } else {
         print ("addNotReady");
     }
 }
Пример #11
0
	public void ShowAd ()
	{
		
		ShowOptions options = new ShowOptions ();

		options.resultCallback = HandleShowResult;
			
		Advertisement.Show (zoneId, options);

	}
Пример #12
0
 public void ShowAd()
 {
     if (Advertisement.IsReady()) {
         var options = new ShowOptions{resultCallback = HandleShowResult };
         Advertisement.Show("video", options);
     }
     else {
         Debug.Log("we have no ads to show");
         adsFinished = true;
     }
 }
Пример #13
0
 // 0 == show me
 public static void ShowRewardedAd(int origin)
 {
     if (Advertisement.IsReady("rewardedVideo"))
     {
     if (origin == 0)
     {
         var options = new ShowOptions { resultCallback = HandleShowResult_0 };
         Advertisement.Show("rewardedVideo", options);
     }
     }
 }
Пример #14
0
	IEnumerator InitializeAd () {

		while (!Advertisement.IsReady(placementId)) {
			SetGodButtonText("Waiting ...");
			yield return new WaitForSeconds(0.5f);
		}

		ShowOptions options = new ShowOptions();
		options.resultCallback = HandleShowResult;

		Advertisement.Show (placementId, options);
	}
Пример #15
0
 public void ShowRewardedAd()
 {
     if (--m_adCounter <= 0)
     {
         if (Advertisement.IsReady("video"))
         {
             var options = new ShowOptions { resultCallback = HandleShowResult };
             Advertisement.Show("video", options);
             m_adCounter = AdCounter;
         }
     }
 }
Пример #16
0
 public void PlayVideo()
 {
     if (Advertisement.IsReady ("rewardedVideo")) {
         var options = new ShowOptions { resultCallback = HandleShowResult };
         Advertisement.Show ("rewardedVideo", options);
         toggleGroup (videoPopupGroup, false);
         toggleGroup (menuGroup, true);
     } else {
         toggleGroup (videoPopupGroup, false);
         toggleGroup (noInternetGroup, true);
     }
 }
Пример #17
0
    public void ShowRewardedAd()
    {
        if (Advertisement.IsReady("rewardedVideo"))
        {
            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show("rewardedVideo", options);

        }
        else
        {
            levelManger.checkEndGame();
        }
    }
Пример #18
0
    public void ShowRewardedAd()
    {
        if (Advertisement.IsReady("rewardedVideo")) {
            Debug.Log("ShowRewardedAd is starting");

            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show("rewardedVideo", options);
        }
        else {
            Debug.Log("we have no ads to show");
            adsFinished = true;
        }
    }
Пример #19
0
    IEnumerator CallShow()
    {
        //광고 준비 여부
        while (Advertisement.IsReady() == false)
        {
            yield return null;
        }

        // 광고 출력 옵션 설정
        ShowOptions Options = new ShowOptions();
        Options.resultCallback = CallbackAD;
        Advertisement.Show("", Options);
    }
Пример #20
0
    public void View()
    {
       
        if (Advertisement.IsReady())
        {
            StopCoroutine("WaitingUser");

            Debug.Log("view die");
            ShowOptions options = new ShowOptions();
            options.resultCallback = ViewEnd;
            Advertisement.Show(null, options);
        }
        flag = false;
    }
Пример #21
0
    public void ShowRewardedAds()
    {
        beijingMusic.Stop ();

        if (Globe.adsType.Equals (AdsType.UnityAds))
        {
            var options = new ShowOptions { resultCallback = HandleShowResult };
            Advertisement.Show (zoneID, options);
        }else
        {
            Debug.Log("Show YouMiAds...");
            JoyArtisan.UnityUtil.Instance.ShowVideoAds ();
        }
    }
Пример #22
0
    public void ShowAd(string zone = "")
    {
        #if UNITY_EDITOR
        StartCoroutine(WaitForAd());	// simulate modality
        #endif

        if (string.Equals (zone, ""))
            zone = null;

        ShowOptions options = new ShowOptions();
        options.resultCallback = AdCallbackHandler;

        if (Advertisement.IsReady (zone))
            Advertisement.Show(zone, options);
    }
Пример #23
0
 public IEnumerator ShowAdWhenReady()
 {
     //#if UNITY_EDITOR
     //yield return 0;
     //AdCallbackhandler(ShowResult.Finished);
     //#else
     while (!Advertisement.isReady())
         yield return null;
     Debug.Log("video ready");
     ShowOptions options = new ShowOptions ();
     options.resultCallback = AdCallbackhandler;
     Debug.Log("Try to show video");
     Advertisement.Show (null, options);
     //#endif
 }
Пример #24
0
    public void Pressed()
    {
        if(status == State.Ready){

            status = State.Active;
            ts.maxFingers++;
        }

        if(status == State.Charging){

            if(Advertisement.IsReady("rewardedVideo")){
                var options = new ShowOptions { resultCallback = HandleShowResult };
                Advertisement.Show ("rewardedVideo", options);
            }
        }
    }
Пример #25
0
 public void ShowAd(string zone = "")
 {
     Debug.Log ("show Ad");
     if (zone.Equals (REWARDED_VIDEO)) {
         if (Advertisement.IsReady(zone))
         {
             var options = new ShowOptions { resultCallback = HandleShowResult };
             Advertisement.Show(zone, options);
         }
     } else {
         if (Advertisement.IsReady())
         {
             Advertisement.Show();
         }
     }
 }
Пример #26
0
    public void ShowAd(string zone = "")
    {
        Debug.Log("Show");
        #if UNITY_EDITOR
        StartCoroutine(WaitForAd());
        #endif

        if (string.Equals(zone, ""))
            zone = null;

        ShowOptions options = new ShowOptions();
        options.resultCallback = AdCallbackhandler;

        if (Advertisement.IsReady(zone))
            Advertisement.Show(zone, options);
    }
Пример #27
0
	public void ShowAd ()
	{
		if (Application.internetReachability != NetworkReachability.NotReachable && ControlAd.m_useAd) {
			if (Advertisement.IsReady ()) {
				string zone = "defaultZone";
				//string zone = "rewardedVideoZone";

				ShowOptions options = new ShowOptions ();
				options.resultCallback = HandleShowResult;

				Advertisement.Show (zone, options);

				Log.log ("Show Unity Ads");
			}
		} else {
			StartCoroutine (DelaySend (DELAY_TIME));
		}
	}
Пример #28
0
 public void Restart()
 {
     GamePlayManager.restartCount++;
     if (GamePlayManager.restartCount == 3)
     {
         // Reset Restart counter
         GamePlayManager.restartCount = 0;
         // Reload Scene
         SceneManager.LoadScene(1);
         Time.timeScale = 0f;
         // Allows logic to check if ad has finished
         var options = new ShowOptions {
             resultCallback = HandleShowResult
         };
         Advertisement.Show(options);
     }
     else
     {
         Time.timeScale = 1f;
         SceneManager.LoadScene(1);
     }
 }
Пример #29
0
    public static bool ShowAd(string zone = null)
    {
        #if UNITY_IOS || UNITY_ANDROID
        if (string.IsNullOrEmpty(zone)) zone = null;

        if (!Advertisement.IsReady(zone))
        {
            Debug.LogWarning(string.Format("Unable to show ad. The ad placement zone ($0) is not ready.",
                                           zone == null ? "default" : zone));
            return false;
        }

        ShowOptions options = new ShowOptions();
        options.resultCallback = HandleShowResult;

        Advertisement.Show(zone,options);

        return true;
        #else
        Debug.LogError("Failed to show ad. Unity Ads is not supported on the current build platform.");
        return false;
        #endif
    }
Пример #30
0
 public void Add(ShowOptions option)
 {
   this.show.Add(option);
 }
	void  show_reward_unity_ads(){
		Dictionary<string,string> dic = new Dictionary<string,string>();
		dic[tongji.NEXT_GATE_ADS] = tongji.UNITY_ADS;
		GA.Event(tongji.ADS,dic);
		if(Advertisement.IsReady("rewardedVideo")){
			UnityEngine.Advertisements.ShowOptions op = new ShowOptions();
			op.resultCallback = result_suc;


			Advertisement.Show("rewardedVideo",op);
		}else {
			Debug.Log("tangjie noready play ads");

		}
	}