// Shows the rewarding ad on the screen. public void Show() { if (prefabAd != null) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); AdBehaviour.PauseGame(); CreateButtonBehavior(); AddClickBehavior(dummyAd); dummyAd.AddComponent <Countdown>(); if (OnAdDidPresentFullScreenContent != null) { OnAdDidPresentFullScreenContent.Invoke(this, EventArgs.Empty); } } else { if (OnAdFailedToPresentFullScreenContent != null) { OnAdFailedToPresentFullScreenContent.Invoke(this, new AdErrorClientEventArgs() { AdErrorClient = new AdErrorClient() }); } } }
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()); } }); }
// Shows the banner view on the screen. public void ShowBannerView() { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); dummyAd = AdBehaviour.ShowAd(prefabAd, getRectTransform(prefabAd).anchoredPosition); ButtonBehaviour buttonBehaviour = dummyAd.GetComponentInChildren <ButtonBehaviour>(); buttonBehaviour.OnAdOpening += OnAdOpening; buttonBehaviour.OnLeavingApplication += OnAdLeavingApplication; }
// Shows the InterstitialAd. public void ShowInterstitial() { if (IsLoaded() == true) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); CreateButtonBehavior(); AddClickBehavior(dummyAd); AdBehaviour.PauseGame(); } else { Debug.Log("No Ad Loaded"); } }
// Shows the InterstitialAd. public void ShowInterstitial() { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); if (IsLoaded() == true) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); AddClickBehavior(dummyAd); AdBehaviour.PauseGame(); } else { Debug.Log("No Ad Loaded"); } }
// Start is called before the first frame update void Start() { saveManager = FindObjectOfType(typeof(SaveController)) as SaveController; adManager = FindObjectOfType(typeof(AdBehaviour)) as AdBehaviour; bestTime = saveManager.LoadTime(); //FIRST TIME PLAYING, SHOW PRIVACY CONTENT if (saveManager.GetPrivacy()) { CallMainMenu_UI(); } else { CallPrivacy_UI(); } }
// Shows the InterstitialAd. public void ShowInterstitial() { if (IsLoaded() == true) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); CreateButtonBehavior(); AddClickBehavior(dummyAd); AdBehaviour.PauseGame(); if (OnAdOpening != null) { OnAdOpening.Invoke(this, EventArgs.Empty); } } else { Debug.Log("No Ad Loaded"); } }
// Shows the InterstitialAd. public void Show() { if (prefabAd != null) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); CreateButtonBehavior(); AddClickBehavior(dummyAd); AdBehaviour.PauseGame(); if (OnAdDidPresentFullScreenContent != null) { OnAdDidPresentFullScreenContent.Invoke(this, EventArgs.Empty); } } else { Debug.Log("No Ad Loaded"); } }
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(); }); }
// Shows the rewarded ad on the screen. public void Show() { if (IsLoaded() == true) { dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1)); AdBehaviour.PauseGame(); CreateButtonBehavior(); AddClickBehavior(dummyAd); dummyAd.AddComponent <Countdown>(); } else { if (OnAdFailedToShow != null) { OnAdFailedToShow.Invoke(this, new AdErrorEventArgs() { Message = "No Ad Loaded" }); } } }
private 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>(); innerButtons[1].onClick.AddListener(() => { DestroyInterstitial(); if (OnAdDidDismissFullScreenContent != null) { OnAdDidDismissFullScreenContent.Invoke(this, new EventArgs()); } AdBehaviour.ResumeGame(); }); }
// Destroys a banner view. public void DestroyBannerView() { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); AdBehaviour.DestroyAd(dummyAd); }
// Destroys a banner view. public void DestroyBannerView() { AdBehaviour.DestroyAd(dummyAd); prefabAd = null; }
// Hides the banner view from the screen. public void HideBannerView() { AdBehaviour.DestroyAd(dummyAd); }
// Shows the banner view on the screen. public void ShowBannerView() { dummyAd = AdBehaviour.ShowAd(prefabAd, getRectTransform(prefabAd).anchoredPosition); CreateButtonBehavior(); AddClickBehavior(dummyAd); }
// Destroys an InterstitialAd. public void DestroyInterstitial() { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); AdBehaviour.DestroyAd(dummyAd); }
// Destroys an InterstitialAd. public void DestroyInterstitial() { AdBehaviour.DestroyAd(dummyAd); prefabAd = null; }
// Shows the banner view on the screen. public void ShowBannerView() { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); dummyAd = AdBehaviour.ShowAd(prefabAd, getRectTransform(prefabAd).anchoredPosition); AddClickBehavior(dummyAd); }