Example #1
0
    /// <summary>
    /// Create a banner 
    /// </summary>
    public void RequestBanner()
    {
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
		string adUnitId = androidBanner;
#elif UNITY_IPHONE
		string adUnitId = iosBanner;
#else
		string adUnitId = "unexpected_platform";
#endif
        try
        {
            // Create a 320x50 banner at the top of the screen.
            bannerView = new BannerView(adUnitId, adSize, adPosition);
            // Create an empty ad request.
            AdRequest request = new AdRequest.Builder().Build();
            // Load the banner with the request.
            bannerView.LoadAd(request);
            // Register for ad events.
            //bannerView.AdLoaded += HandleAdLoaded;
            // bannerView.AdFailedToLoad += HandleAdFailedToLoad;
            //  bannerView.AdOpened += HandleAdOpened;
            // bannerView.AdClosing += HandleAdClosing;
            // bannerView.AdClosed += HandleAdClosed;
            //    bannerView.AdLeftApplication += HandleAdLeftApplication;
            // Load a banner ad.
            //bannerView.LoadAd(createAdRequest());
        }
        catch { }
    }
    private void RequestInterstitial()
    {
#if UNITY_ANDROID
        string adUnitId = "ca-app-pub-7413680112188055/9660693727";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "unexpected_platform";
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);


        //interstitial.OnAdLoaded += HandleOnAdLoaded;
        // Called when an ad request failed to load.
        // interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;        
        // Called when the user returned from the app after an ad click.
        //interstitial.OnAdClosed += HandleOnAdClosed;
        // Called when the ad click caused the user to leave the application.
        //interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);


        rewardBasedVideo = RewardBasedVideoAd.Instance;
    }
    void Start()
    {
        // Create a 250x250 banner.
        AdSize adSize = new AdSize(250, 250);
        bannerView = new BannerView(
                "ca-app-pub-8082064498416450/8145076128", adSize, AdPosition.Bottom);

        // Register for ad events.
        bannerView.AdLoaded += HandleAdLoaded;
        bannerView.AdFailedToLoad += HandleAdFailedToLoad;
        bannerView.AdOpened += HandleAdOpened;
        bannerView.AdClosing += HandleAdClosing;
        bannerView.AdClosed += HandleAdClosed;
        bannerView.AdLeftApplication += HandleAdLeftApplication;

        // Request
        AdRequest request = new AdRequest.Builder()
        .AddTestDevice(AdRequest.TestDeviceSimulator)       // Simulator.
        .AddTestDevice("3BD361B306BE5D37")  // My test device.
        .Build();

        // Load the banner
        bannerView.LoadAd(request);

        // Request the interstitial
        RequestInterstitial();
    }
Example #4
0
	void Start () {
	
		// Keep this object around for entire game
		DontDestroyOnLoad(transform.gameObject);
		
		AdRequest request = new AdRequest.Builder().Build();
		
		// Banner view ad always present at bottom of screen
		//bannerView = new BannerView("ca-app-pub-6877754457671498/9780611568", AdSize.Banner, AdPosition.Bottom);
		//bannerView.LoadAd(request);
		
		// Interstitial ad only present before play begins
		interstitial = new InterstitialAd("ca-app-pub-6877754457671498/4235971961");

		// Register for ad events.
		interstitial.AdLoaded += delegate(object sender, System.EventArgs args) {};
		interstitial.AdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) {};
		interstitial.AdOpened += delegate(object sender, System.EventArgs args) {};
		interstitial.AdClosing += delegate(object sender, System.EventArgs args) {};
		interstitial.AdClosed += delegate(object sender, System.EventArgs args) {};
		interstitial.AdLeftApplication += delegate(object sender, System.EventArgs args) {};
		
		interstitial.LoadAd(request);		
		
	}
	public void BuildInterstitial(){
		failedLoading = false;
		interstitial = new InterstitialAd(adUnitID);
		// Events
		interstitial.OnAdClosed += HandleInterstitialClosed;
		interstitial.OnAdFailedToLoad += HandleInterstitialFailedToLoad;
		interstitial.OnAdLeavingApplication += HandleLeftApplication;
		interstitial.OnAdLoaded += HandleLoaded;
		interstitial.OnAdOpening += HandleOpened;
		// AdRequest
		AdRequest.Builder builder = new AdRequest.Builder ();
		if (useEmulatorAsATestDevice) {
			builder.AddTestDevice(AdRequest.TestDeviceSimulator);
		}
		if (testDeviceIDs != null && testDeviceIDs.Length > 0) {
			foreach(string testDeviceID in testDeviceIDs){
				builder.AddTestDevice(testDeviceID);
			}
		}
		if (keywords != null && keywords.Length > 0) {
			foreach (string keyword in keywords) {
				builder.AddKeyword (keyword);
			}
		}
		if (gender.HasValue) {
			builder.SetGender (gender.Value);
		}
		if (childDirectedTreatment.HasValue) {
			builder.TagForChildDirectedTreatment (childDirectedTreatment.Value);
		}
		AdRequest request = builder.Build();
		interstitial.LoadAd(request);
	}
Example #6
0
    // Use this for initialization
    void Start()
    {
        // 초기화
        // 앱아이디, 배너 사이즈, 배너 위치
        m_BannerView = new BannerView("ca-app-pub-3215701313685151/6171564220", AdSize.SmartBanner, AdPosition.Bottom);

        // 전면광고
        m_InterstitialAd = new InterstitialAd("ca-app-pub-3215701313685151/7648297427");

        // 테스트 단말기 등록
        //
        AdRequest.Builder adBuilder = new AdRequest.Builder();

        // 테스트기기가 많으면 .AddTestDevice(""). 으로 계속 추가
        AdRequest adRequst = adBuilder.AddTestDevice("3AEB4134537BE358").AddTestDevice(AdRequest.TestDeviceSimulator).Build();
        // 광고 요청
        m_BannerView.LoadAd(adRequst);
        // 광고 출력
        m_BannerView.Show();

        // 광고 요청
        m_InterstitialAd.LoadAd(adRequst);
        // 이벤트 종료후 callback함수 호출 추가
        m_InterstitialAd.AdClosed += AdCloseCallback;
    }
Example #7
0
	// Use this for initialization
	void Start () {

		bannerView = new BannerView ("ca-app-pub-1387683089487019/9667976282", AdSize.Banner, AdPosition.Bottom);
		//Debug.Log("requesting ad :)");
		AdRequest request = new AdRequest.Builder().Build();
		bannerView.LoadAd (request);

	}
Example #8
0
 void ShowBanner()
 {
     BannerView bannerView = new BannerView(
         "ca-app-pub-9688313728956513/8544995983", AdSize.SmartBanner, AdPosition.Bottom);
     // Create an empty ad request.
     AdRequest adrequest = new AdRequest.Builder().Build();	// Load the banner with the request.
     bannerView.LoadAd(adrequest);
 }
Example #9
0
 public void LoadAdmobInterstial()
 {
     interstialAd = new InterstitialAd (INTERSTIAL_ID);
     AdRequest request = new AdRequest.Builder ().Build ();
     if (!interstialAd.IsLoaded ()) {
         interstialAd.LoadAd (request);
     }
 }
Example #10
0
 public void LoadAd()
 {
     Debug.Log("Load Ad");
     MainCamera.isBreakAdLoaded = true;
     breakAd = new InterstitialAd ("YOUR_ADD_ID");
     AdRequest adrequest = new AdRequest.Builder ().Build ();
     breakAd.LoadAd (adrequest);
 }
Example #11
0
 public static void RequestBanner()
 {
     // Create a 320x50 banner at the top of the screen.
     BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);
 }
	void CreatFullScreenBanner() {

		interstitialBanner = new InterstitialAd( GameConsts.AdIdGameOver );
		// Create an empty ad request.
		AdRequest request = new AdRequest.Builder().Build();

		// Load the interstitial with the request.
		interstitialBanner.LoadAd(request);

	}
Example #13
0
    // Use this for initialization
    void Awake()
    {
        bannerView = new BannerView("ca-app-pub-5325622833123971/2069584440", AdSize.SmartBanner, AdPosition.Bottom);
        AdRequest.Builder builder = new AdRequest.Builder();
        //AdRequest request = builder.AddTestDevice(AdRequest.TestDeviceSimulator).AddTestDevice(SystemInfo.deviceUniqueIdentifier).Build();
        AdRequest request = builder.Build();// 실제 빌드

        bannerView.LoadAd(request); //배너 광고 요청
        bannerView.Show();  // 배너 광고 출력
    }
    public static void ShowInterstital()
    {
        AdRequest request1 = new AdRequest.Builder ().Build ();
                // Load the banner with the request.
                interstitialView.LoadAd (request1);

                if (interstitialView.IsLoaded ()) {
                        interstitialView.Show ();
                }
    }
    void Start()
    {
        if (string.IsNullOrEmpty(c_addMobID)) return;

        bannerView = new BannerView(c_addMobID, m_type, m_postion);

        AdRequest request = new AdRequest.Builder().Build();
        bannerView.LoadAd(request);

        HideView();
    }
Example #16
0
    void Start()
    {
        GetComponent<AudioSource>().Play();
        startAd = new InterstitialAd ("YOUR_ADD_ID");
        isBreakAdLoaded = false;
        AdRequest adrequest =new AdRequest.Builder().Build();

        startAd.LoadAd(adrequest);
        startAd.AdLoaded += HandleAdLoaded;
        //googleAnalytics.StartSession ();
    }
Example #17
0
 public void StartInterstitial()
 {
     #if SIMULATOR
     return;
     #endif
     #if UNITY_ANDROID || UNITY_IPHONE
     interstitial = new InterstitialAd(adUnitId);
     AdRequest request = new AdRequest.Builder().Build();
     interstitial.LoadAd(request);
     #endif
 }
Example #18
0
    void ShowInterstitial()
    {
        // Initialize an InterstitialAd.
        InterstitialAd interstitial = new InterstitialAd("ca-app-pub-9688313728956513/9454822785");
        // Create an empty ad request.
        AdRequest intrequest = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(intrequest);

        interstitial.Show ();
    }
Example #19
0
 public static void RequestInterstitial(bool isShow)
 {
     // Initialize an InterstitialAd.
     interstitial = new InterstitialAd(adUnitIdInterstitial);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder().Build();
     // Load the interstitial with the request.
     interstitial.LoadAd(request);
     if(isShow)
         interstitial.AdLoaded += HandleAdLoaded;
 }
Example #20
0
    // Use this for initialization
    void Start()
    {
        // Create a 320x50 banner at the top of the screen.
        BannerView bannerView = new BannerView(
            "ca-app-pub-5646032163335107/7915187477", AdSize.Banner, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();

        // Load the banner with the request.
        bannerView.LoadAd(request);
    }
Example #21
0
    void Start()
    {
        if(Application.platform == RuntimePlatform.IPhonePlayer) {
            AD_UNIT_ID = "ca-app-pub-3865236618689243/6154612613";
        }

        self = this;

        banner = new BannerView(AD_UNIT_ID, AdSize.Banner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();
        banner.LoadAd(request);
    }
Example #22
0
    void Start()
    {
        UpdateLanguage();

        bannerView = new BannerView("ca-app-pub-5734115412286766/9250985339", AdSize.Banner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();
        bannerView.LoadAd(request);

        //interstitial = new InterstitialAd("ca-app-pub-5734115412286766/5423314134");
        //interstitial.AdLoaded += new System.EventHandler<System.EventArgs>((sender,e) =>{
        //    interstitial.Show();
        //});
        //AdRequest request = new AdRequest.Builder().Build();
        //interstitial.LoadAd(request);
        //if (interstitial.IsLoaded())
        //{
        //    interstitial.Show();
        //}

        Debug.Log("GmeOverScript Start");

        RawImage leftImage = GameObject.Find("/Canvas/RawImageLeft").GetComponent<RawImage>();
        RawImage rightImage = GameObject.Find("/Canvas/RawImageRight").GetComponent<RawImage>();

        // for debug data
        //PersistentObjectScript persistentScript = new PersistentObjectScript();
        //persistentScript.UpColors.Add(new Phoenix.HSB96(0, 0.5f, 0.5f));
        //persistentScript.UpColors.Add(new Phoenix.HSB96(60, 0.5f, 0.5f));
        //persistentScript.UpColors.Add(new Phoenix.HSB96(120, 0.5f, 0.5f));
        //persistentScript.UpColors.Add(new Phoenix.HSB96(180, 0.5f, 0.5f));
        //persistentScript.UpColors.Add(new Phoenix.HSB96(240, 0.5f, 0.5f));
        //persistentScript.UpColors.Reverse();

        Rect leftRect = new Rect(0, 0, 100, 261);
        Texture2D leftTexture = new Texture2D((int)leftRect.width, (int)leftRect.height);
        Texture2D rightTexture = new Texture2D((int)leftRect.width, (int)leftRect.height);
        var leftRects = leftRect.Splite(GameGlobalScript.Instance.UpColors.Count);
        leftRects.Reverse();
        for (int i = 0; i < GameGlobalScript.Instance.UpColors.Count; i++)
        {
            leftTexture.DrawSolidRect(leftRects[i], GameGlobalScript.Instance.UpColors[i]);
            rightTexture.DrawSolidRect(leftRects[i], GameGlobalScript.Instance.PickedColors[i]);
        }
        leftTexture.Apply();
        rightTexture.Apply();
        leftImage.texture = leftTexture;
        rightImage.texture = rightTexture;

        Score = GameGlobalScript.Instance.FinalScore;

        GameGlobalScript.Instance.UpColors.Clear();
        GameGlobalScript.Instance.PickedColors.Clear();
    }
Example #23
0
 public void RequestBanner()
 {
     // Create a 320x50 banner at the top of the screen.
     bannerView = new BannerView(
         BANNER_ID, AdSize.SmartBanner, AdPosition.Top);
     // Create an empty ad request.
     AdRequest request = new AdRequest.Builder()
         //.AddTestDevice("A4D94C6CCCC78F95136843C5B0579088")
         .Build();
     // Load the banner with the request.
     bannerView.LoadAd(request);
 }
	void CreatSmallBanner() {

		smallBannerBottom = new BannerView(
			GameConsts.AdIdBanner, AdSize.SmartBanner, AdPosition.Bottom );

		// Create an empty ad request.
		AdRequest request = new AdRequest.Builder()
			.Build();
		
		// Load the banner with the request.
		smallBannerBottom.LoadAd(request);

	}
Example #25
0
    public static void ShowAds()
    {
        #if UNITY_ANDROID
        CheckBannerExists();
        _bannerView.Show();
        AdRequest request = new AdRequest.Builder().Build();
        _bannerView.LoadAd(request);
        #endif

        #if UNITY_WP8
        if (AdsChanged != null) AdsChanged.Invoke(true);
        #endif
    }
Example #26
0
 private AdRequest CreateAdRequest()
 {
     // リクエストの生成
     // テスト端末設定があった場合は取得
     var builder = new AdRequest.Builder ();
     builder.AddTestDevice (AdRequest.TestDeviceSimulator);
     if (Android_TestDevices != null) {
         foreach(var str in Android_TestDevices){
             builder.AddTestDevice(str);//MyAndroid
         }
     }
     return builder.Build ();
 }
	public void Ads ()
	{
		#if UNITY_ANDROID
		string adUnitId = "ca-app-pub-8112894826901791/9216328060";
		#elif UNITY_IPHONE
		string adUnitId = "ca-app-pub-8112894826901791/6194189263";
		#else
		string adUnitId = "unexpected_platform";
		#endif
		banner = new BannerView (adUnitId, AdSize.Banner, AdPosition.Bottom);
		AdRequest request = new AdRequest.Builder ().Build ();
		banner.LoadAd (request); 
		print ("load ads");
	}
    public void LoadInterstitial()
    {
        //Initialize AdUnitId if not set
        if (adUnitInterstitialId == ""){
            InitializeAdUnitId();
        }

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitInterstitialId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }
Example #29
0
    // Banner
    public void Request()
    {
        #if UNITY_ANDROID
        string adUnitId = "INSERT_ANDROID_BANNER_AD_UNIT_ID_HERE";
        #elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-9144026334547134/6098852008";
        #else
        string adUnitId = "ca-app-pub-9144026334547134/6098852008";
        #endif

        bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top);
        AdRequest request = new AdRequest.Builder().Build();
        bannerView.LoadAd(request);
    }
Example #30
0
    public void CreateBanner()
    {
#if UNITY_IPHONE
        BannerView bannerView = new BannerView(ios_banner_bottom, AdSize.SmartBanner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();
        bannerView.LoadAd(request);
#endif

#if UNITY_ANDROID
        BannerView bannerView = new BannerView(andorid_banner_bottom, AdSize.SmartBanner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();
        bannerView.LoadAd(request);
#endif

    }
Example #31
0
 private void requestInterstitial()
 {
     GoogleMobileAds.Api.AdRequest request = new GoogleMobileAds.Api.AdRequest.Builder().Build();
     interstitialAd.LoadAd(request);
 }