コード例 #1
2
ファイル: admobScript.cs プロジェクト: Milton761/SRM
	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();
	}
コード例 #2
0
    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();
    }
コード例 #3
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 { }
    }
コード例 #4
0
	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());
	}
コード例 #5
0
ファイル: CAdmobTest.cs プロジェクト: Astharoshe/Repository
    // 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;
    }
コード例 #6
0
 public Admob()
 {
     config = Resources.Load<Configuration>("FrispGames/Ads/Configuration");
     banner = new BannerView (AdMobID (), AdSize.SmartBanner, AdPosition.Bottom);
     banner.AdLoaded += OnBannerLoaded;
     RequestBanner ();
 }
コード例 #7
0
ファイル: AdManager.cs プロジェクト: jieverson/PixelRoad
 private static void CheckBannerExists()
 {
     if (_bannerView == null)
     {
         _bannerView = new BannerView(
                 "ca-app-pub-9013851829730737/3873391606", AdSize.SmartBanner, AdPosition.Bottom);
     }
 }
コード例 #8
0
	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
	}
コード例 #9
0
ファイル: ad_creation.cs プロジェクト: pauladam316/SpaceCadet
	// 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);

	}
コード例 #10
0
ファイル: DeathManager.cs プロジェクト: ryandicenzo/Cubei
 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);
 }
コード例 #11
0
ファイル: ADMobStatic.cs プロジェクト: dvsonic/AmazingNinjia
 public static void Init()
 {
     banner = new BannerView(
        banerUnitId, AdSize.Banner, AdPosition.Bottom);
     interstitial = new InterstitialAd(interstitialId);
     interstitialReq = new AdRequest.Builder().Build();
     interstitial.LoadAd(interstitialReq);
 }
コード例 #12
0
ファイル: AdControl.cs プロジェクト: yizhengtutu/snakeX
 public static void destroyBanner()
 {
     if(bannerView != null)
     {
         bannerView.Destroy();
         bannerView = null;
     }
 }
コード例 #13
0
ファイル: AdmobService.cs プロジェクト: hothanhhung/Android
 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);
 }
コード例 #14
0
ファイル: AdsManager.cs プロジェクト: TapTapTapps/WayPath
 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();
 }
コード例 #15
0
ファイル: StartManager.cs プロジェクト: LEE-JUN-HEE/Unithon2
    // 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();  // 배너 광고 출력
    }
コード例 #16
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);
    }
コード例 #17
0
    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();
    }
コード例 #18
0
ファイル: AdHandler.cs プロジェクト: jreala/Numbers
    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();
    }
コード例 #19
0
ファイル: GoogleAds.cs プロジェクト: GameWorthy/ChompRabbit
    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);
    }
コード例 #20
0
    // 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();
    }
コード例 #21
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();
    }
コード例 #22
0
ファイル: AdManager.cs プロジェクト: nicholasal/starside
 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);
 }
コード例 #23
0
ファイル: ADMob.cs プロジェクト: dvsonic/AmazingNinjia
 public void DestroyAD()
 {
     if (banner != null)
     {
         banner.Destroy();
         banner = null;
     }
     if (interstitial != null)
     {
         interstitial.Destroy();
         interstitial = null;
     }
 }
コード例 #24
0
	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);

	}
コード例 #25
0
	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");
	}
コード例 #26
0
ファイル: GoogleAds.cs プロジェクト: konohazukux/Tower2048
    // 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);
    }
コード例 #27
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

    }
コード例 #28
0
    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();

    }
コード例 #29
0
ファイル: Ads.cs プロジェクト: GameWorthy/DontSock
	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);
	}
コード例 #30
0
    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);
    }
コード例 #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());
     });
 }