12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using UnityEngine;
- public class AdwareRequest : MonoBehaviour
- {
- public static bool HasAdware { get; private set; }
- #if UNITY_ANDROID
- const string BannerAdUnitId = "1a553046db6a4cb2816f1f837c79fa19";
- #endif
- #if UNITY_IPHONE
- const string BannerAdUnitId = "134c4c4a1a3f4522b01eecb07cc5e82c";
- //[SerializeField]
- // private MoPubManager _manager;
- #endif
- internal void Start()
- {
- #if UNITY_ANDROID
- //MoPubAndroidManager.onInterstitialLoadedEvent += OnDone;
- // MoPubAndroidManager.onInterstitialFailedEvent += OnFail;
- // MoPubAndroid.requestInterstitalAd(BannerAdUnitId);
- #endif
- #if UNITY_IPHONE
- // MoPubManager.interstitialDidLoadAdEvent += OnDone;
- // MoPubManager.interstitialDidFailToLoadAdEvent += OnFail;
- //MoPubManager.interstitialDidDismissEvent += OnDismiss;
- // MoPubBinding.requestInterstitialAd(BannerAdUnitId, null);
- #endif
- }
- private void OnFail()
- {
- #if UNITY_ANDROID
- // MoPubAndroid.requestInterstitalAd(BannerAdUnitId);
- #endif
- #if UNITY_IPHONE
- //MoPubBinding.requestInterstitialAd(BannerAdUnitId,null);
- #endif
- }
- private void OnDone()
- {
- HasAdware = true;
- }
- #if UNITY_IPHONE
- private void OnDismiss()
- {
- //MoPubBinding.requestInterstitialAd(BannerAdUnitId, null);
- }
- #endif
- public static void Show()
- {
- if (HasAdware)
- {
- #if UNITY_ANDROID
- //MoPubAndroid.showInterstitalAd();
- #endif
- #if UNITY_IPHONE
- // MoPubBinding.showInterstitialAd(BannerAdUnitId);
- #endif
- HasAdware = false;
- #if UNITY_ANDROID
- ////MoPubAndroid.requestInterstitalAd(BannerAdUnitId);
- #endif
- #if UNITY_IPHONE
- // MoPubBinding.requestInterstitialAd(BannerAdUnitId, null);
- #endif
- }
- }
- }
|