Exemplo n.º 1
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Start()
    {
        //Required
        GoogleMobileAd.Init();


        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGenger.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the device log output after creating a new ad
        GoogleMobileAd.AddTestDevice("733770c317dcbf4675fe870d3df9ca42");



        //More eventts ot explore under GoogleMobileAdEvents class
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_LOADED, OnInterstisialsLoaded);
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_OPENED, OnInterstisialsOpen);

        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.addEventListener(GoogleMobileAdEvents.ON_AD_IN_APP_REQUEST, OnInAppRequest);

        InitStyles();
    }
Exemplo n.º 2
0
    //--------------------------------------
    //  Initalization
    //--------------------------------------

    public static void Init()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            else
            {
                iAdBannerController.InterstitialAdDidLoadAction        += InterstitialLoadedHandler;
                iAdBannerController.InterstitialDidFailWithErrorAction += InterstitialLoadFailHandler;
                iAdBannerController.InterstitialAdDidFinishAction      += InterstitialClosedHandler;
            }
            break;

        case RuntimePlatform.Android:
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;
        }

        _IsInited = true;
    }
Exemplo n.º 3
0
    // --------------------------------------
    // Unity Events
    // --------------------------------------

    void Awake()
    {
        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
        }
    }
Exemplo n.º 4
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Start()
    {
        //Required
        GoogleMobileAd.Init();


        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGender.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the device log output after creating a new ad
        //Fill your test device in the plugin setting, or you can add your device using example code bellow

        GoogleMobileAd.AddTestDevice("733770c317dcbf4675fe870d3df9ca42");



        GoogleMobileAd.OnInterstitialLoaded += OnInterstisialsLoaded;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;


        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.OnAdInAppRequest += OnInAppRequest;
        InitStyles();
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        rewardedVideoZoneCount   = 0;
        requestInterstitialCount = 0;
        mIsShow = false;

        //Required
        GoogleMobileAd.Init();
    }
    void Start()
    {
        GoogleMobileAd.Init();

        GoogleMobileAd.OnInterstitialLoaded += HandleOnInterstitialLoaded;
        GoogleMobileAd.OnInterstitialClosed += OnInterstisialsClosed;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;


        //loadin ad:
        GoogleMobileAd.LoadInterstitialAd();
    }
Exemplo n.º 7
0
 private GoogleAds()
 {
     GoogleMobileAd.Init();
     GoogleMobileAd.SetBannersUnitID("ca-app-pub-7468307217611497/1999630365", "", "");
     GoogleMobileAd.SetInterstisialsUnitID("ca-app-pub-7468307217611497/5313023562", "", "");
     GoogleMobileAd.SetGender(GoogleGender.Male);
     //GoogleMobileAd.AddKeyword("girl");
     //GoogleMobileAd.AddKeyword("sexy");
     //GoogleMobileAd.AddKeyword("big");
     //GoogleMobileAd.AddKeyword("hot");
     //GoogleMobileAd.AddKeyword("ass");
     GoogleMobileAd.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.SMART_BANNER);
 }
    void Start()
    {
        GoogleMobileAd.Init();


        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_LOADED, OnInterstisialsLoaded);
        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_OPENED, OnInterstisialsOpen);

        GoogleMobileAd.controller.addEventListener(GoogleMobileAdEvents.ON_INTERSTITIAL_AD_CLOSED, OnInterstisialsClosed);

        //loadin ad:
        GoogleMobileAd.LoadInterstitialAd();
    }
Exemplo n.º 9
0
    void Awake()
    {
        Inst = this;

        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
        }
        banner            = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperCenter, GADBannerSize.SMART_BANNER);
        banner.ShowOnLoad = false;
        DontDestroyOnLoad(transform.gameObject);
        LoadFullScreen();
        GoogleMobileAd.OnInterstitialClosed += OnInterstitialClosed;
    }
Exemplo n.º 10
0
    //--------------------------------------
    //  Initalization
    //--------------------------------------

    public static void Init()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                SA_AmazonAdsManager.Instance.Create();
                SA_AmazonAdsManager.Instance.Init(AmazonNativeSettings.Instance.AppAPIKey, AmazonNativeSettings.Instance.IsTestMode);

                SA_AmazonAdsManager.Instance.OnInterstitialDataReceived += AmazonInterstitialDataReceived;
                SA_AmazonAdsManager.Instance.OnInterstitialDismissed    += AmazonInterstitialDismissed;
            }
            else
            {
                GoogleMobileAd.Init();
                GoogleMobileAdInterstitialSubscribe();
            }
            break;

                #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
        case RuntimePlatform.WP8Player:
                #else
        case RuntimePlatform.WSAPlayerARM:
        case RuntimePlatform.WSAPlayerX64:
        case RuntimePlatform.WSAPlayerX86:
                #endif
            GoogleMobileAd.Init();
            GoogleMobileAdInterstitialSubscribe();
            break;
        }

        _IsInited = true;
    }
Exemplo n.º 11
0
    void Start()
    {
        Tickets.text = RS_PlayerData.Instance.MultiplayerTickets.ToString() + "/" + RS_PlayerData.MAX_TICKETS.ToString();
        Wins.text    = RS_PlayerData.Instance.MultiplayerWins.ToString();

        if (UM_GameServiceManager.Instance.ConnectionSate == UM_ConnectionState.CONNECTED)
        {
            PlayerName.text = UM_GameServiceManager.Instance.Player.Name;
            LoadPlayerAvatar();
        }
        else
        {
            UM_GameServiceManager.OnPlayerConnected += HandleOnPlayerConnected;
        }

        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
            GoogleMobileAd.LoadInterstitialAd();
        }
    }
    public void Init()
    {
        GoogleMobileAd.Init();
        //Optional, add data for better ad targeting
        GoogleMobileAd.SetGender(GoogleGender.Male);
        GoogleMobileAd.AddKeyword("game");
        GoogleMobileAd.SetBirthday(1989, AndroidMonth.MARCH, 18);
        GoogleMobileAd.TagForChildDirectedTreatment(false);

        //Causes a device to receive test ads. The deviceId can be obtained by viewing the logcat output after creating a new ad
        //AndroidAdMobController.instance.AddTestDevice("6B9FA8031AEFDC4758B7D8987F77A5A6");

        GoogleMobileAd.OnInterstitialLoaded += OnInterstisialsLoaded;
        GoogleMobileAd.OnInterstitialOpened += OnInterstisialsOpen;

        AndroidAdMobController.Instance.OnRewardedVideoLoaded   += HandleOnRewardedVideoLoaded;
        AndroidAdMobController.Instance.OnRewardedVideoAdClosed += HandleOnRewardedVideoAdClosed;

        //listening for InApp Event
        //You will only receive in-app purchase (IAP) ads if you specifically configure an IAP ad campaign in the AdMob front end.
        GoogleMobileAd.OnAdInAppRequest += OnInAppRequest;
    }
Exemplo n.º 13
0
    public void Init()
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd)
            {
                GoogleMobileAd.Init();
            }
            break;

        case RuntimePlatform.Android:
            GoogleMobileAd.Init();
            break;

        case RuntimePlatform.WP8Player:
            GoogleMobileAd.Init();
            break;
        }



        _IsInited = true;
    }
Exemplo n.º 14
0
    /// <summary>
    /// Show admob banner on android (if define, please refere to ADS_INTEGRATION_DOCUMENTATION.PDF), and iAd banner on iOS
    /// </summary>
    public void ShowBanner()
    {
        if (NO_ADS)
        {
            return;
        }

                #if UNITY_IOS
                #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
        if (!useAdmob)
        {
                #endif
        ShowIAdBanner();
                #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
    }
                #endif
                #endif

                #if UNITY_IOS
                #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
        if (useAdmob)
        {
                #endif
                #endif
                        #if GOOGLE_MOBILE_ADS
//			if(Application.isMobilePlatform)
        {
            bannerView.LoadAd(requestBanner);
            bannerView.Show();


            bannerView.OnAdLoaded             -= HandleAdLoaded;
            bannerView.OnAdFailedToLoad       -= HandleAdFailedToLoad;
            bannerView.OnAdOpening            -= HandleAdOpened;
            bannerView.OnAdClosed             -= HandleAdClosed;
            bannerView.OnAdLeavingApplication -= HandleAdLeftApplication;



            // Called when an ad request has successfully loaded.
            bannerView.OnAdLoaded += HandleAdLoaded;
            // Called when an ad request failed to load.
            bannerView.OnAdFailedToLoad += HandleAdFailedToLoad;
            // Called when an ad is clicked.
            bannerView.OnAdOpening += HandleAdOpened;
            // Called when the user returned from the app after an ad click.
            bannerView.OnAdClosed += HandleAdClosed;
            // Called when the ad click caused the user to leave the application.
            bannerView.OnAdLeavingApplication += HandleAdLeftApplication;
//			}
                        #endif


                        #if UNITY_IOS
                        #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
    }
                        #endif
                        #endif

                #if STAN_ASSET_GOOGLEMOBILEADS
        if (!GoogleMobileAd.IsInited)
        {
            GoogleMobileAd.Init();
        }
        else
        {
            GoogleMobileAdBanner banner;

            if (registerdBanners.ContainsKey(sceneBannerId))
            {
                banner = registerdBanners [sceneBannerId];
            }
            else
            {
                banner = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.SMART_BANNER);

                registerdBanners.Add(sceneBannerId, banner);
            }

            if (banner.IsLoaded && !banner.IsOnScreen)
            {
                banner.Show();
            }
        }
                #endif

                #if STAN_ASSET_ANDROIDNATIVE
        if (!AndroidAdMobController.Instance.IsInited)
        {
            //			AndroidAdMobController.Init ();
            Set();
        }
        else
        {
            GoogleMobileAdBanner banner;

            if (registerdBanners.ContainsKey(sceneBannerId))
            {
                banner = registerdBanners [sceneBannerId];
            }
            else
            {
                banner = AndroidAdMobController.Instance.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.SMART_BANNER);

                registerdBanners.Add(sceneBannerId, banner);
            }

            if (banner.IsLoaded && !banner.IsOnScreen)
            {
                banner.Show();
            }
        }
                #endif
    }

    void ShowIAdBanner()
    {
        if (NO_ADS)
        {
            return;
        }

                #if UNITY_IOS
        CancelInvoke("ShowIAdBanner");
                #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
        if (!useAdmob)
        {
                #endif
        if (banner == null)
        {
            banner         = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.BottomCenter);
            banner.visible = true;
            ADBannerView.onBannerWasClicked -= OnBannerClicked;
            ADBannerView.onBannerWasLoaded  -= OnBannerLoaded;

            ADBannerView.onBannerWasClicked += OnBannerClicked;
            ADBannerView.onBannerWasLoaded  += OnBannerLoaded;

                #if !UNITY_4_6 && !UNITY_5_0 && !UNITY_5_1
            ADBannerView.onBannerFailedToLoad -= OnBannerFailedToLoad;
            ADBannerView.onBannerFailedToLoad += OnBannerFailedToLoad;
                #endif
        }
        else
        {
            banner.visible = true;
        }
                #if STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS
    }
                #endif
                #endif
    }
Exemplo n.º 15
0
    IEnumerator Start()
    {
        yield return(0);

        GC.Collect();

        Resources.UnloadUnusedAssets();

        Application.targetFrameRate = 60;

        if (!NO_ADS)
        {
                        #if UNITY_IOS && (STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS)
            if (!useAdmob)
            {
                        #endif
                                #if UNITY_IOS
            fullscreenAd = new ADInterstitialAd();
            ADInterstitialAd.onInterstitialWasLoaded += OnFullscreenLoaded;
                                #if !UNITY_4_6 && !UNITY_5_0 && !UNITY_5_1
            ADInterstitialAd.onInterstitialWasViewed += OnFullscreenViewed;
                                #endif
                                #endif

                                #if UNITY_IOS && (STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS)
        }
                                #endif

                        #if STAN_ASSET_GOOGLEMOBILEADS
            if (!GoogleMobileAd.IsInited)
            {
                GoogleMobileAd.Init();
            }
                        #endif

                        #if STAN_ASSET_ANDROIDNATIVE
            if (!AndroidAdMobController.Instance.IsInited)
            {
                Set();
            }
                        #endif

                        #if CHARTBOOST
            Chartboost.setAutoCacheAds(true);

            Chartboost.cacheInterstitial(CBLocation.Default);

            Chartboost.cacheRewardedVideo(CBLocation.Default);
                        #endif

            yield return(new WaitForSeconds(1));

            ShowBanner();

            yield return(new WaitForSeconds(1));

            if (ShowIntertitialAtStart)
            {
                _ShowInterstitial();
            }
        }
    }
Exemplo n.º 16
0
 void Start()
 {
     GoogleMobileAd.OnInterstitialClosed += GoogleMobileAd_OnInterstitialClosed;
     GoogleMobileAd.Init();
     SceneManager.LoadScene("Menu");
 }