internal void AddClickBehavior(GameObject dummyAd)
        {
            Image[] images  = dummyAd.GetComponentsInChildren <Image>();
            Image   adImage = images[1];
            Button  button  = adImage.GetComponentInChildren <Button>();

            button.onClick.AddListener(() =>
            {
                buttonBehaviour.OpenURL();
            });
            Button[] innerButtons = adImage.GetComponentsInChildren <Button>();

            if (innerButtons.Length < 2)
            {
                Debug.Log("Invalid Prefab");
                return;
            }

            Button closeButton = innerButtons[1];

            closeButton.onClick.AddListener(() =>
            {
                AdBehaviour.DestroyAd(dummyAd);
                prefabAd = null;
                if (OnAdDidDismissFullScreenContent != null)
                {
                    OnAdDidDismissFullScreenContent.Invoke(this, EventArgs.Empty);
                }
                AdBehaviour.ResumeGame();
                if (OnUserEarnedReward != null)
                {
                    OnUserEarnedReward.Invoke(this, GetRewardItem());
                }
            });
        }
Esempio n. 2
0
        private void AddClickBehavior(GameObject dummyAd)
        {
            Image  myImage = dummyAd.GetComponentInChildren <Image>();
            Button button  = myImage.GetComponentInChildren <Button>();

            button.onClick.AddListener(() => {
                buttonBehaviour.OpenURL();
            });
            Button[] innerButtons = dummyAd.GetComponentsInChildren <Button>();

            innerButtons[1].onClick.AddListener(() =>
            {
                AdBehaviour.DestroyAd(dummyAd);
                if (OnAdClosed != null)
                {
                    OnAdClosed.Invoke(this, new EventArgs());
                }
                AdBehaviour.ResumeGame();
            });
        }
Esempio n. 3
0
 // Destroys a banner view.
 public void DestroyBannerView()
 {
     AdBehaviour.DestroyAd(dummyAd);
     prefabAd = null;
 }
Esempio n. 4
0
 // Hides the banner view from the screen.
 public void HideBannerView()
 {
     AdBehaviour.DestroyAd(dummyAd);
 }
 // Destroys an InterstitialAd.
 public void DestroyInterstitial()
 {
     AdBehaviour.DestroyAd(dummyAd);
     prefabAd = null;
 }
Esempio n. 6
0
 // Destroys a banner view.
 public void DestroyBannerView()
 {
     Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name);
     AdBehaviour.DestroyAd(dummyAd);
 }
Esempio n. 7
0
 // Destroys an InterstitialAd.
 public void DestroyInterstitial()
 {
     Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name);
     AdBehaviour.DestroyAd(dummyAd);
 }