Advertisement
OwlyOwl

appodeal

Jan 25th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.13 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using AppodealAds.Unity.Api;
  5. using AppodealAds.Unity.Common;
  6.  
  7.  
  8. public class AppodealManager : MonoBehaviour, IInterstitialAdListener, IRewardedVideoAdListener, IBannerAdListener
  9. {
  10.     private string app_key = "2ecf45cbd688ba44119874ea51ced30cbbaa2c5e01802f05";
  11.  
  12.     private void Start()
  13.     {
  14.         Initialize(true);
  15.         StartCoroutine(LoadBanner());
  16.     }
  17.  
  18.     private void Initialize(bool isTesting)
  19.     {
  20.         Appodeal.setTesting(isTesting);
  21.         Appodeal.disableWriteExternalStoragePermissionCheck();
  22.         Appodeal.muteVideosIfCallsMuted(true);
  23.         Appodeal.initialize(app_key, Appodeal.INTERSTITIAL | Appodeal.REWARDED_VIDEO | Appodeal.BANNER_VIEW);
  24.         Appodeal.setInterstitialCallbacks(this);
  25.         Appodeal.setRewardedVideoCallbacks(this);
  26.     }
  27.  
  28.     public void ShowInterstitial()
  29.     {
  30.         if (Appodeal.isLoaded(Appodeal.INTERSTITIAL))
  31.         {
  32.             Appodeal.show(Appodeal.INTERSTITIAL);
  33.         }
  34.     }
  35.  
  36.     public void ShowNonSkippable()
  37.     {
  38.         if (Appodeal.isLoaded(Appodeal.REWARDED_VIDEO))
  39.         {
  40.             Appodeal.show(Appodeal.REWARDED_VIDEO);
  41.         }
  42.     }
  43.  
  44.     public void ShowBanner()
  45.     {
  46.         if (Appodeal.isLoaded(Appodeal.BANNER))
  47.         {
  48.             Appodeal.show(Appodeal.BANNER_BOTTOM);
  49.         }
  50.     }
  51.  
  52.     public void onInterstitialLoaded(bool isPrecache)
  53.     {
  54.         throw new System.NotImplementedException();
  55.     }
  56.  
  57.     public void onInterstitialFailedToLoad()
  58.     {
  59.         throw new System.NotImplementedException();
  60.     }
  61.  
  62.     public void onInterstitialShowFailed()
  63.     {
  64.         throw new System.NotImplementedException();
  65.     }
  66.  
  67.     public void onInterstitialShown()
  68.     {
  69.         Dictionary<string, object> eventParameters = new Dictionary<string, object>
  70.         {
  71.             {"AdNetwork","Appodeal" },
  72.             {"Type", "Interstitial" }
  73.         };
  74.  
  75.         AppMetrica.Instance.ReportEvent("ShowAd", eventParameters);
  76.     }
  77.  
  78.     public void onInterstitialClosed()
  79.     {
  80.         throw new System.NotImplementedException();
  81.     }
  82.  
  83.     public void onInterstitialClicked()
  84.     {
  85.         throw new System.NotImplementedException();
  86.     }
  87.  
  88.     public void onInterstitialExpired()
  89.     {
  90.         throw new System.NotImplementedException();
  91.     }
  92.  
  93.     public void onBannerLoaded(int height, bool isPrecache)
  94.     {
  95.         throw new System.NotImplementedException();
  96.     }
  97.  
  98.     public void onBannerFailedToLoad()
  99.     {
  100.         throw new System.NotImplementedException();
  101.     }
  102.  
  103.     public void onBannerShown()
  104.     {
  105.         throw new System.NotImplementedException();
  106.     }
  107.  
  108.     public void onBannerClicked()
  109.     {
  110.         throw new System.NotImplementedException();
  111.     }
  112.  
  113.     public void onBannerExpired()
  114.     {
  115.         throw new System.NotImplementedException();
  116.     }
  117.  
  118.     IEnumerator LoadBanner()
  119.     {
  120.         yield return new WaitForSeconds(3f);
  121.         ShowBanner();
  122.     }
  123.  
  124.     public void onRewardedVideoLoaded(bool precache)
  125.     {
  126.         throw new System.NotImplementedException();
  127.     }
  128.  
  129.     public void onRewardedVideoFailedToLoad()
  130.     {
  131.         throw new System.NotImplementedException();
  132.     }
  133.  
  134.     public void onRewardedVideoShowFailed()
  135.     {
  136.         throw new System.NotImplementedException();
  137.     }
  138.  
  139.     public void onRewardedVideoShown()
  140.     {
  141.         Dictionary<string, object> eventParameters = new Dictionary<string, object>
  142.          {
  143.            {"AdNetwork","Appodeal" },
  144.             {"Type", "Rewarded" }
  145.          };
  146.  
  147.         AppMetrica.Instance.ReportEvent("ShowAd", eventParameters);
  148.     }
  149.  
  150.     public void onRewardedVideoFinished(double amount, string name)
  151.     {
  152.         throw new System.NotImplementedException();
  153.     }
  154.  
  155.     public void onRewardedVideoClosed(bool finished)
  156.     {
  157.         throw new System.NotImplementedException();
  158.     }
  159.  
  160.     public void onRewardedVideoExpired()
  161.     {
  162.         throw new System.NotImplementedException();
  163.     }
  164.  
  165.     public void onRewardedVideoClicked()
  166.     {
  167.         throw new System.NotImplementedException();
  168.     }
  169. }
  170.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement