Exemplo n.º 1
0
    private void Awake()
    {
        if (Instance == null)
        {
            countRestart = 0;
            nextShowAd   = Random.Range(2, 4);
            Instance     = this;
            rewardAd     = RewardBasedVideoAd.Instance;
            LoadRewardAd();
            //rewardAd.OnAdLoaded += HandleOnRewardAdLoaded;

            gameOverAd = new InterstitialAd(gameOverAdId);
            LoadGameOverAd();
            //gameOverAd.OnAdLoaded += HandleOnGameOverAdLoaded;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        ad = RewardBasedVideoAd.Instance;

        //광고 요청이 성공적으로 로드되면 호출됩니다.
        ad.OnAdLoaded += OnAdLoaded;
        //광고 요청을 로드하지 못했을 때 호출됩니다.
        ad.OnAdFailedToLoad += OnAdFailedToLoad;
        //광고가 표시될 때 호출됩니다.
        ad.OnAdOpening += OnAdOpening;
        //광고가 재생되기 시작하면 호출됩니다.
        ad.OnAdStarted += OnAdStarted;
        //사용자가 비디오 시청을 통해 보상을 받을 때 호출됩니다.
        ad.OnAdRewarded += OnAdRewarded;
        //광고가 닫힐 때 호출됩니다.
        ad.OnAdClosed += OnAdClosed;
        //광고 클릭으로 인해 사용자가 애플리케이션을 종료한 경우 호출됩니다.
        ad.OnAdLeavingApplication += OnAdLeavingApplication;

        LoadAd();
    }
Exemplo n.º 3
0
        private void Awake()
        {
            if (Instance == null)
            {
                Instance = this;
            }

#if OG_ADMOB
#if UNITY_ANDROID
            MobileAds.Initialize(androidAdmobAppId);
#elif UNITY_IOS
            MobileAds.Initialize(iOSAdmobAppId);
#endif
            // Get singleton reward based video ad reference.
            rewardBasedVideo = RewardBasedVideoAd.Instance;

            // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
            rewardBasedVideo.OnAdClosed   += HandleRewardBasedVideoClosed;
            rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
#endif
        }
Exemplo n.º 4
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }

        #if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
        #elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
        #else
        string appId = "unexpected_platform";
        #endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;
    }
Exemplo n.º 5
0
    public void RefreshReward()
    {
        rewardAd = RewardBasedVideoAd.Instance;
        AdRequest request = new AdRequest.Builder()
                            .AddTestDevice(AdRequest.TestDeviceSimulator)
                            .AddTestDevice(deviceID) // Remove on Release
                            .Build();

        rewardAd.LoadAd(request, adRewardID);


        if (rewardAd.IsLoaded())
        {
            rewardAd.Show();
            debugText.text = "Loaded";
        }
        else
        {
            debugText.text = "Reward Not loaded";
        }
    }
    IEnumerator Start()
    {
        // Get singleton reward based video ad reference.
        rewardBasedVideo = RewardBasedVideoAd.Instance;

        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        rewardBasedVideo.OnAdLoaded             += HandleRewardBasedVideoLoaded;
        rewardBasedVideo.OnAdFailedToLoad       += HandleRewardBasedVideoFailedToLoad;
        rewardBasedVideo.OnAdOpening            += HandleRewardBasedVideoOpened;
        rewardBasedVideo.OnAdStarted            += HandleRewardBasedVideoStarted;
        rewardBasedVideo.OnAdRewarded           += HandleRewardBasedVideoRewarded;
        rewardBasedVideo.OnAdClosed             += HandleRewardBasedVideoClosed;
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

        RequestBanner();
        RequestInterstitial();

        yield return(new WaitForSeconds(2));

        bannerView.Show();
    }
Exemplo n.º 7
0
    void Start()
    {
        Debug.Log("interstitialCounter is: " + interstitialCounter);

        RequestInterstitial();

        rewardBasedVideo = RewardBasedVideoAd.Instance;

        //	rewardBasedVideo.OnAdClosed += HandleOnAdClosed;
        //	rewardBasedVideo.OnAdFailedToLoad += HandleOnAdFailedToLoad;
        //	rewardBasedVideo.OnAdLeavingApplication += HandleOnAdLeavingApplication;
        //	rewardBasedVideo.OnAdLoaded += HandleOnAdLoaded;
        //	rewardBasedVideo.OnAdOpening += HandleOnAdOpening;
        rewardBasedVideo.OnAdRewarded += HandleOnAdRewarded;
        //	rewardBasedVideo.OnAdStarted += HandleOnAdStarted;

        if (!(rewardBasedVideo.IsLoaded()))
        {
            RequestRewardBased();
        }
    }
Exemplo n.º 8
0
 void Start()
 {
     //init kittyz
     kittyzText = GameObject.Find("KittyzText").GetComponentInChildren <Text> ();
     //kittyzText.text = ApplicationController.ac.playerData.kittyz.ToString ();
     //init ad
     adText           = GetComponentInChildren <Text> ();
     rewardBasedVideo = RewardBasedVideoAd.Instance;
     //init ad button
     adButton = GetComponent <Button> ();
     if (rewardBasedVideo.IsLoaded())
     {
         //enableButton ();
         RequestRewardBasedVideo();
     }
     else
     {
         enableButton(false);
     }
     isStarted = true;
 }
    public void Start()
    {
        MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(AppID);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        this.rewardBasedVideo.OnAdLoaded             += this.HandleRewardBasedVideoLoaded;
        this.rewardBasedVideo.OnAdFailedToLoad       += this.HandleRewardBasedVideoFailedToLoad;
        this.rewardBasedVideo.OnAdOpening            += this.HandleRewardBasedVideoOpened;
        this.rewardBasedVideo.OnAdStarted            += this.HandleRewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded           += this.HandleRewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed             += this.HandleRewardBasedVideoClosed;
        this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;
        RequestInterstitial();
        RequestRewardBasedVideo();
    }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Called when an ad request has successfully loaded.
        rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

        RequestRewardedVideo();
    }
Exemplo n.º 11
0
    private void RequestRewardedVideo()
    {
                #if UNITY_EDITOR
        string adUnitId = "ca-app-pub-3940256099942544/5224354917";                 // test ad rewarded id
                #elif UNITY_ANDROID
        string adUnitId = RewardedId;
                #elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
                #else
        string adUnitId = "unexpected_platform";
                #endif

        // Initialize an RewardedVideoAd.
        rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Create am empty ad request.
        AdRequest request = new AdRequest.Builder().Build();

        // Load the rewarded video ad with the request.
        rewardBasedVideo.LoadAd(request, adUnitId);
    }
Exemplo n.º 12
0
        // Use this for initialization
        void Start()
        {
            if (appConfig == null)
            {
                Debug.LogError("Error: AppConfig undefined on ShareManager.cs . Check ShareManager on scene");
            }
            string AdmobAppId      = appConfig.AdmobAppId;
            string BannerId        = appConfig.BannerId;
            string InterstitialId  = appConfig.InterstitialId;
            string RewardedVideoId = appConfig.RewardedVideoId;

            //
            foreach (ShowAdConfig o in listShowInterstitialAdConfig)
            {
                listShowAdCount.Add(o.GameStateCountForShowAd);
            }
            Advertisement.Initialize(unityAdsId);
            MobileAds.Initialize(AdmobAppId);

            #region rewardInitialization
            // Get singleton reward based video ad reference.
            rewardBasedVideo = RewardBasedVideoAd.Instance;

            // RewardBasedVideoAd is a singleton, so handlers should only be registered once.
            rewardBasedVideo.OnAdClosed   += HandleRewardBasedVideoClosed;
            rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
            //Added to additional inspection
            rewardBasedVideo.OnAdCompleted          += RewardBasedVideo_OnAdCompleted;
            rewardBasedVideo.OnAdFailedToLoad       += RewardBasedVideo_OnAdFailedToLoad;
            rewardBasedVideo.OnAdLeavingApplication += RewardBasedVideo_OnAdLeavingApplication;
            rewardBasedVideo.OnAdLoaded             += RewardBasedVideo_OnAdLoaded;
            rewardBasedVideo.OnAdOpening            += RewardBasedVideo_OnAdOpening;
            rewardBasedVideo.OnAdStarted            += RewardBasedVideo_OnAdStarted;
            #endregion

            //Request banner, interstitial and rewarded base video ads
            RequestAdmobBanner();
            RequestAdmobInterstitial();
            RequestAdmobRewardBasedVideo();
        }
Exemplo n.º 13
0
    public void Start()
    {
        if (instancia == null)
        {
            instancia = this;
        }
#if UNITY_ANDROID
        string appId = "ca-app-pub-1343647000894788~1193651346";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-1343647000894788~1193651346";
#else
        string appId = "unexpected_platform";
#endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        this.RequestBanner();
    }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        game = GameManager.Instance;
#if UNITY_ANDROID
        string appId = "ca-app-pub-3698875051105618~6819407412";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);


        obj = new GameManager();
        this.RequestBanner();
        this.RequestInterstitial();
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        this.RequestRewardBasedVideo();
    }
Exemplo n.º 15
0
    public void Start()
    {
//        AndroidNativeFunctions.ShowToast("ca-app-pub-8325729314474996~5932340612");

#if UNITY_ANDROID
        string appId = "ca-app-pub-8793311481503149~5085937771";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-7911348052455769~5649252046";
#else
        string appId = "unexpected_platform";
#endif

        // MobileAds.SetiOSAppPauseOnBackground(true);

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
        rewardBasedVideoAd = RewardBasedVideoAd.Instance;

        this.CreateAndLoadRewardedAd();
        // this.RequestBanner();
        // this.RequestInterstitial();
    }
Exemplo n.º 16
0
    public void Start()
    {
        if (PlayerPrefs.GetInt("Ads Removed") == 0)
        {
            MobileAds.Initialize(appId);
            //Request Ads
            RequestBanner();
            RequestInterstitial();
        }
        else
        {
            return;
        }

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Called when the user should be rewarded for watching a video.
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;

        RequestRewardedVideo();
    }
    public void ShowRewardBasedVideo()
    {
        if (this.rewardBasedVideo != null)
        {
            if (this.rewardBasedVideo.IsLoaded())
            {
                this.rewardBasedVideo.Show();
            }
            else
            {
                RequestRewardBasedVideo();
                Debug.Log("Reward based video ad is not ready yet");
            }
        }
        else
        {
            this.rewardBasedVideo = RewardBasedVideoAd.Instance;

            RequestRewardBasedVideo();
            ShowRewardBasedVideo();
        }
    }
Exemplo n.º 18
0
    // Start is called before the first frame update
    void Awake()
    {
        ShowABtn.onClick.AddListener(() => ShowABtnHandler());
        //ShowABtn.gameObject.SetActive(false);


        #if UNITY_ANDROID
        string appId = "ca-app-pub-3940256099942544~3347511713";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-3940256099942544~1458002511";
#else
        string appId = "unexpected_platform";
#endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Called when an ad request has successfully loaded.
        rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

        this.RequestRewardBasedVideo();
        //UserOptToWatchAd();
    }
Exemplo n.º 19
0
    private void RequestVideoReward(bool firstTime)
    {
        #if UNITY_ANDROID
        //string adUnitId = "ca-app-pub-3940256099942544/5224354917";//test
        string adUnitId = "ca-app-pub-1267802095563724/9018604422";    //real deal
#elif UNITY_IPHONE
        string adUnitId = "ca-app-pub-3940256099942544/1712485313";
#else
        string adUnitId = "unexpected_platform";
#endif

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the rewarded video ad with the request.
        this.rewardBasedVideo.LoadAd(request, adUnitId);
        if (firstTime)
        {
            // Called when an ad request has successfully loaded.
            rewardBasedVideo.OnAdLoaded += RewardBasedVideo_OnAdLoaded;
            // Called when an ad request failed to load.
            rewardBasedVideo.OnAdFailedToLoad += RewardBasedVideo_OnAdFailedToLoad;
            // Called when an ad is shown.
            rewardBasedVideo.OnAdOpening += RewardBasedVideo_OnAdOpening;
            // Called when the ad starts to play.
            rewardBasedVideo.OnAdStarted += RewardBasedVideo_OnAdStarted;
            // Called when the user should be rewarded for watching a video.
            rewardBasedVideo.OnAdRewarded += RewardBasedVideo_OnAdRewarded;
            // Called when the ad is closed.
            rewardBasedVideo.OnAdClosed += RewardBasedVideo_OnAdClosed;
            // Called when the ad click caused the user to leave the application.
            rewardBasedVideo.OnAdLeavingApplication += RewardBasedVideo_OnAdLeavingApplication;

            rewardBasedVideo.OnAdCompleted += RewardBasedVideo_OnAdCompleted;
        }
    }
Exemplo n.º 20
0
    private void Start()
    {
        ui       = FindObjectOfType <UIManager>();
        bs       = FindObjectOfType <BattleScript>();
        es       = FindObjectOfType <PedometerU.Tests.ExploreStep>();
        counter1 = counter2 = counter3 = 0;

        Scene  currentScene = SceneManager.GetActiveScene();
        string sceneName    = currentScene.name;

        if (sceneName == "StepCounter" || sceneName == "Battle")
        {
            this.RequestBanner();
        }


        this.RequestInterstitial();

        videoAd = RewardBasedVideoAd.Instance;

        // Called when an ad request has successfully loaded.
        videoAd.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        videoAd.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        videoAd.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        videoAd.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        videoAd.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        videoAd.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        videoAd.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

        this.RequestVideo();
        videoAdClosed = false;
    }
Exemplo n.º 21
0
    public void Start()
    {
        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            if (instance != null)
            {
                Destroy(gameObject);
            }
            else
            {
                instance = this;
                DontDestroyOnLoad(gameObject);
            }
        }
        string appId = "ca-app-pub-8685854447544440~2926976393";

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
        RequestBanner();
        rewardVideoAD = RewardBasedVideoAd.Instance;
        // Called when an ad request has successfully loaded.
        rewardVideoAD.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        rewardVideoAD.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        rewardVideoAD.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        rewardVideoAD.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        rewardVideoAD.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        rewardVideoAD.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        rewardVideoAD.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
        Display_Banner();
        RequestInt();
        RequestReward();
    }
Exemplo n.º 22
0
    private void Awake()
    {
        //Optional
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;
        DontDestroyOnLoad(this);

        rewardedAd = RewardBasedVideoAd.Instance;


        // Banner Ad

        Banner();

        // Requiest interstitial ad and reward ad

        requestInterstital();
        loadRewardVideo();
    }
Exemplo n.º 23
0
        private void Start()
        {
#if UNITY_ANDROID
            _appId = "ca-app-pub-3346638026613039~7552764882";
#elif UNITY_IPHONE
            _appId = "ca-app-pub-3940256099942544~1458002511";
        #else
            _appId = "unexpected_platform";
        #endif

            MobileAds.Initialize(_appId);
            _rewardBasedVideo = RewardBasedVideoAd.Instance;

            _rewardBasedVideo.OnAdLoaded             += HandleRewardBasedVideoLoaded;
            _rewardBasedVideo.OnAdFailedToLoad       += HandleRewardBasedVideoFailedToLoad;
            _rewardBasedVideo.OnAdOpening            += HandleRewardBasedVideoOpened;
            _rewardBasedVideo.OnAdStarted            += HandleRewardBasedVideoStarted;
            _rewardBasedVideo.OnAdRewarded           += HandleRewardBasedVideoRewarded;
            _rewardBasedVideo.OnAdClosed             += HandleRewardBasedVideoClosed;
            _rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

            RequestRewardBasedVideo();
        }
Exemplo n.º 24
0
    private void Start()
    {
        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;
        this.RequestRewardBasedVideo();

        //Event Declarations//

        // Called when an ad request has successfully loaded.
        rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
    }
Exemplo n.º 25
0
    public void Update()
    {
        if (rewardBasedVideoAd == null)
        {
            rewardBasedVideoAd = RewardBasedVideoAd.Instance;
        }
        else if (rewardBasedVideoAd.IsLoaded())
        {
            watchAdButton.interactable = true;
            timeSinceLastRequest       = 0.0f;
        }
        else
        {
            watchAdButton.interactable = false;
            timeSinceLastRequest      += Time.deltaTime;

            if (timeSinceLastRequest > 1.0f)
            {
                TryLoadingAd();
                timeSinceLastRequest = 0.0f;
            }
        }
    }
Exemplo n.º 26
0
 // Use this for initialization
 void Start()
 {
     MobileAds.Initialize(ID);
     lastTimeShowAds = DateTime.Now;
     requestFullAdmob();
     RequestBanner();
     if (PlayerPrefs.GetInt(Contants.LevelLock, 1) < 3)
     {
         if (bannerView != null)
         {
             HideBanner();
         }
     }
     if (isHasReward)
     {
         this.rewardBasedVideo              = RewardBasedVideoAd.Instance;
         rewardBasedVideo.OnAdRewarded     += RewardBasedVideo_OnAdRewarded;
         rewardBasedVideo.OnAdClosed       += HandleRewardBasedVideoClosed;
         rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
         requestRewardBasedVideo();
     }
     timeBetweenShowAds = delay;
 }
Exemplo n.º 27
0
        private void RequestRewardAd()
        {
            if (typeOfAds.Contains(TypeOfID.Reward))
            {
                this.rewardBasedVideo = RewardBasedVideoAd.Instance;

                rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
                // Called when an ad request failed to load.
//				rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
                // Called when an ad is shown.
                rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
                // Called when the ad starts to play.
                rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
                // Called when the user should be rewarded for watching a video.
                rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
                // Called when the ad is closed.
                rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
                // Called when the ad click caused the user to leave the application.
                rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

                this.RequestRewardBasedVideo();
            }
        }
Exemplo n.º 28
0
    public void Start()
    {
        /* Needed
         *
         * string appId = "ca-app-pub-6338977167328988~3985994970";
         *
         * MobileAds.Initialize(appId);
         */

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        //  RewardBasedVideoAd is a singleton, so handlers should only be registered once.
        //  this.rewardBasedVideo.OnAdLoaded += this.HandleRewardBasedVideoLoaded;
        //  this.rewardBasedVideo.OnAdFailedToLoad += this.HandleRewardBasedVideoFailedToLoad;
        //  this.rewardBasedVideo.OnAdOpening += this.HandleRewardBasedVideoOpened;
        //  this.rewardBasedVideo.OnAdStarted += this.HandleRewardBasedVideoStarted;
        this.rewardBasedVideo.OnAdRewarded += this.HandleRewardBasedVideoRewarded;
        this.rewardBasedVideo.OnAdClosed   += this.HandleRewardBasedVideoClosed;
        //  this.rewardBasedVideo.OnAdLeavingApplication += this.HandleRewardBasedVideoLeftApplication;

        this.RequestRewardBasedVideo();
    }
Exemplo n.º 29
0
    public void RequestRewardBasedVideo()
    {
        if (isVideoLoaded)
        {
            return;
        }

        rewardBasedVideo = RewardBasedVideoAd.Instance;

        AdRequest request = new AdRequest.Builder()
                            .AddTestDevice(AdRequest.TestDeviceSimulator)      // Simulator.
                            .AddTestDevice("2077ef9a63d2b398840261c8221a0c9b") // My test device.
                            .Build();

        rewardBasedVideo.LoadAd(request, _videorewardId);

        if (!handleRewardedVideoSet)
        {
            // Ad event fired when the rewarded video ad
            // has been received.
            rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
            // has failed to load.
            rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
            // is opened.
            rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
            // has started playing.
            rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
            // has rewarded the user.
            rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
            // is closed.
            rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
            // is leaving the application.
            rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

            handleRewardedVideoSet = true;
        }
    }
    //public static StartRewardButton instance;

    /* private void Awake()
     * {
     *  instance = this;
     * }*/


    private void Start()
    {
#if UNITY_ANDROID
        string appId = "ca-app-pub-6404957345030488~2409666371";
#elif UNITY_IPHONE
        string appId = "ca-app-pub-6404957345030488~6749844982";
#else
        string appId = "unexpected_platform";
#endif

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);

        // Get singleton reward based video ad reference.
        this.rewardBasedVideo = RewardBasedVideoAd.Instance;

        // Called when an ad request has successfully loaded.
        rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
        // Called when an ad request failed to load.
        rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
        // Called when an ad is shown.
        rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
        // Called when the ad starts to play.
        rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
        // Called when the user should be rewarded for watching a video.
        rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
        // Called when the ad is closed.
        rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
        // Called when the ad click caused the user to leave the application.
        rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;

        this.RequestRewardBasedVideo();


        RequestInterstitial();
        RequestRewardBasedVideo();
    }