private void Start()
 {
     MobileAds.settings.isExecuteEventsOnUnityThread = true;
     if (!CASFactory.TryGetManagerByIndexAsync(OnManagerReady, managerId.index))
     {
         OnAdFailedToLoad.Invoke("Manager not initialized yet");
     }
 }
Exemple #2
0
 public void onLoaded()
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onLoaded " + adType.ToString());
     }
     CASFactory.ExecuteEvent(OnAdLoaded);
 }
Exemple #3
0
 public void onComplete()
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onComplete " + adType.ToString());
     }
     CASFactory.ExecuteEvent(OnAdCompleted);
 }
Exemple #4
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
     DetachAdView();
     CASFactory.UnsubscribeReadyManagerAsync(OnManagerReady, managerId.index);
 }
 private void OnDestroy()
 {
     if (manager != null)
     {
         manager.OnLoadedAd                   -= OnInterstitialAdLoaded;
         manager.OnFailedToLoadAd             -= OnInterstitialAdFailedToLoad;
         manager.OnInterstitialAdFailedToShow -= OnAdFailedToShow.Invoke;
         manager.OnInterstitialAdShown        -= OnAdShown.Invoke;
         manager.OnInterstitialAdClicked      -= OnAdClicked.Invoke;
         manager.OnInterstitialAdClosed       -= OnAdClosed.Invoke;
     }
     CASFactory.UnsubscribeReadyManagerAsync(OnManagerReady, managerId.index);
 }
Exemple #6
0
 public void onInitialization(bool success, string error)
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onInitialization " + success);
     }
     manager.initializationListener = null;
     if (initCompleteAction != null)
     {
         CASFactory.ExecuteEvent(() =>
         {
             initCompleteAction(success, error);
             initCompleteAction = null;
         });
     }
 }
Exemple #7
0
 public void onShowFailed(string message)
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onShowFailed " + adType.ToString() + " with error: " + message);
     }
     if (OnAdFailedToShow != null)
     {
         CASFactory.ExecuteEvent(() =>
         {
             if (OnAdFailedToShow != null)
             {
                 OnAdFailedToShow(message);
             }
         });
     }
 }
Exemple #8
0
 public void onFailed(int error)
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onFailed " + adType.ToString() + " error: " + Enum.GetName(typeof(AdError), error));
     }
     if (OnAdFailed != null)
     {
         CASFactory.ExecuteEvent(() =>
         {
             if (OnAdFailed != null)
             {
                 OnAdFailed(( AdError )error);
             }
         });
     }
 }
Exemple #9
0
 public void onOpening(int net, double cpm, int accuracy)
 {
     if (CASFactory.isDebug)
     {
         Debug.Log("[CleverAdsSolutions] onOpening " + adType.ToString() + " net: " + net + " cpm: " + cpm + " accuracy: " + accuracy);
     }
     CASFactory.ExecuteEvent(OnAdShown);
     if (OnAdOpening != null)
     {
         CASFactory.ExecuteEvent(() =>
         {
             if (OnAdOpening != null)
             {
                 OnAdOpening(new AdMetaData(adType, ( AdNetwork )net, cpm, ( PriceAccuracy )accuracy));
             }
         });
     }
 }
 private static void RewardedLoadedAdCallback(IntPtr manager)
 {
     try
     {
         if (MobileAds.settings.isDebugMode)
         {
             Debug.Log("[CleverAdsSolutions] Rewarded Loaded");
         }
         var instance = IntPtrToManagerClient(manager);
         if (instance != null)
         {
             CASFactory.ExecuteEvent(instance.OnRewardedLoadedCallback);
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }
        private static void InitializationCompleteCallback(IntPtr client, bool success, string error)
        {
            if (MobileAds.settings.isDebugMode)
            {
                Debug.Log("[CleverAdsSolutions] InitializationComplete " + success);
            }
            var instance = IntPtrToManagerClient(client);

            if (instance != null && instance._initCompleteAction != null)
            {
                CASFactory.ExecuteEvent(() =>
                {
                    if (instance._initCompleteAction != null)
                    {
                        instance._initCompleteAction(success, error);
                    }
                });
            }
        }
 private static void RewardedFailedAdCallback(IntPtr manager, int error)
 {
     try
     {
         var adError = ( AdError )error;
         if (MobileAds.settings.isDebugMode)
         {
             Debug.Log("[CleverAdsSolutions] Rewarded Failed with error: " + adError.ToString());
         }
         var instance = IntPtrToManagerClient(manager);
         if (instance != null)
         {
             CASFactory.ExecuteEvent(() => instance.OnFailedCallback(AdType.Rewarded, adError));
         }
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }