Exemple #1
2
	private void RequestBanner()
	{
		#if UNITY_EDITOR
		string adUnitId = "unused";
		#elif UNITY_ANDROID
		string adUnitId = "ca-app-pub-6450638975031579/7991664041";
		#elif UNITY_IPHONE
		string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
		#else
		string adUnitId = "unexpected_platform";
		#endif
		
		// Create a smartBanner banner
		bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top);
		// 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());

		bannerView.Hide();
	}
    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();
    }
    /// <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 { }
    }
	void OnEnable(){
		// Destroy the banner if exists (This can happen. I don't know why)
		destroyAd();
		
		// Select the proper Ad ID by build platform
#if UNITY_ANDROID
		adUnitID = adUnitIDAndroid;
#elif UNITY_IPHONE
		adUnitID = adUnitIDIOS;
#else
		adUnitID = string.Empty;
#endif

		// Create banner
		bannerView = new BannerView(adUnitID, getAdSize(), adPosition);

		// Register for events
		bannerView.OnAdLoaded += HandleAdLoaded;
		bannerView.OnAdFailedToLoad += HandleAdFailedToLoad;
		bannerView.OnAdOpening += HandleAdOpened;
		bannerView.OnAdClosed += HandleAdClosed;
		bannerView.OnAdLeavingApplication += HandleAdLeftApplication;

        // Load the banner with the request.
        bannerView.LoadAd(getAdRequest());
	}
Exemple #5
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;
    }
 public Admob()
 {
     config = Resources.Load<Configuration>("FrispGames/Ads/Configuration");
     banner = new BannerView (AdMobID (), AdSize.SmartBanner, AdPosition.Bottom);
     banner.AdLoaded += OnBannerLoaded;
     RequestBanner ();
 }
Exemple #7
0
 private static void CheckBannerExists()
 {
     if (_bannerView == null)
     {
         _bannerView = new BannerView(
                 "ca-app-pub-9013851829730737/3873391606", AdSize.SmartBanner, AdPosition.Bottom);
     }
 }
	private void requestNewBanner() {
		bannerView = new BannerView ("YOUR_AD_UNIT_ID", AdSize.SmartBanner, AdPosition.Bottom);
		requestBanner = new AdRequest.Builder ()
			.AddTestDevice ("<YOUR_HASHED_DEVICE_ID>") // Add a test device
				.Build ();

		bannerView.LoadAd (requestBanner); // Load the Banner
	}
	// 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);

	}
Exemple #10
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);
 }
Exemple #11
0
 public static void Init()
 {
     banner = new BannerView(
        banerUnitId, AdSize.Banner, AdPosition.Bottom);
     interstitial = new InterstitialAd(interstitialId);
     interstitialReq = new AdRequest.Builder().Build();
     interstitial.LoadAd(interstitialReq);
 }
Exemple #12
0
 public static void destroyBanner()
 {
     if(bannerView != null)
     {
         bannerView.Destroy();
         bannerView = null;
     }
 }
Exemple #13
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);
 }
Exemple #14
0
 void Start()
 {
     // Creacion del banner
     bannerView = new BannerView("ca-app-pub-9453927455644163/4445153938", AdSize.Banner, AdPosition.Bottom);
     // Creacion de la peticion de anuncio
     request = new AdRequest.Builder().Build();
     bannerView.LoadAd(request);
     bannerView.Hide();
 }
Exemple #15
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();  // 배너 광고 출력
    }
    // 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);
    }
    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();
    }
Exemple #18
0
    void Awake()
    {
        // Banner
        string adUnitId = "ca-app-pub-8299109678258685/4687466858";

        AdSize adSize = new AdSize(250, 50);
        bannerView = new BannerView(adUnitId, adSize, AdPosition.Bottom);
        //bannerView.LoadAd(new AdRequest.Builder().AddTestDevice(deviceId).Build());
        bannerView.LoadAd(new AdRequest.Builder().Build());
        bannerView.Show();
    }
Exemple #19
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);
    }
    // Use this for initialization
    void Start()
    {
        PlayGamesPlatform.Activate ();

        Social.localUser.Authenticate((bool success) => {

        });

        bannerView = new BannerView(bannerId, AdSize.SmartBanner, AdPosition.Top);
        bannerView.LoadAd(new AdRequest.Builder().AddKeyword("unity").Build());
        bannerView.Show();
    }
    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();
    }
Exemple #22
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);
 }
Exemple #23
0
 public void DestroyAD()
 {
     if (banner != null)
     {
         banner.Destroy();
         banner = null;
     }
     if (interstitial != null)
     {
         interstitial.Destroy();
         interstitial = null;
     }
 }
	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);

	}
	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");
	}
Exemple #26
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);
    }
    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

    }
    void RequestHomeBannerView()
    {
#if UNITY_ANDROID
        string adUnitID = "ca-app-pub-8295605020027148/4775531117";
#elif UNITY_IPHONE
        string adUnitID = "ca-app-pub-8295605020027148/4855719914";
#endif
        //AdSize size = new AdSize(900, 300);
        bannerHome = new BannerView(adUnitID, AdSize.Banner, AdPosition.BottomLeft);
        AdRequest request = new AdRequest.Builder().Build();
        bannerHome.LoadAd(request);
        bannerHome.AdFailedToLoad += Banner_AdFailedToLoad;
        bannerHome.Hide();

    }
Exemple #29
0
	void Start () {

		string adId = androidAdId;
		if (Application.platform == RuntimePlatform.IPhonePlayer) {
			adId = iosAdId;
		}
		
		// Create a 320x50 banner at the top of the screen.
		bannerView = new BannerView(
			adId, AdSize.Banner, AdPosition.Bottom);
		// Create an empty ad request.
		AdRequest request = new AdRequest.Builder().Build();
		// Load the banner with the request.
		bannerView.LoadAd(request);
	}
    public void ShowBanner()
    {
        //Banner is called from InAppController when checked for in app purchase

        //Initialize AdUnitId if not set
        if (adUnitBannerId == ""){
            InitializeAdUnitId();
        }

        // Create a 320x50 banner at the top of the screen.
        bannerView = new BannerView(adUnitBannerId, AdSize.SmartBanner, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }
Exemple #31
0
 private void LoadBannerAdmob()
 {
     this.bannerView = new GoogleMobileAds.Api.BannerView(admob.banner, GoogleMobileAds.Api.AdSize.SmartBanner, AdPosition.Top);
     if (this.bannerView != null)
     {
         bn = "Banner inited";
     }
     this.bannerView.LoadAd(new AdRequest.Builder().Build());
     this.bannerView.OnAdLoaded += (delegate(System.Object sender, EventArgs args) {
         this.isBannerAdmobLoaded = true;
         this.bannerView.Hide();
         this.ShowBanner();
         bn = "Banner Loaded";
     });
     this.bannerView.OnAdFailedToLoad += (delegate(System.Object sender, AdFailedToLoadEventArgs args) {
         bn = "Banner fail to load";
         this.bannerView.LoadAd(new AdRequest.Builder().Build());
     });
 }