Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using AppodealAds.Unity.Api;
- using AppodealAds.Unity.Common;
- public class AppodealManager : MonoBehaviour, IInterstitialAdListener, IRewardedVideoAdListener, IBannerAdListener
- {
- private string app_key = "2ecf45cbd688ba44119874ea51ced30cbbaa2c5e01802f05";
- private void Start()
- {
- Initialize(true);
- StartCoroutine(LoadBanner());
- }
- private void Initialize(bool isTesting)
- {
- Appodeal.setTesting(isTesting);
- Appodeal.disableWriteExternalStoragePermissionCheck();
- Appodeal.muteVideosIfCallsMuted(true);
- Appodeal.initialize(app_key, Appodeal.INTERSTITIAL | Appodeal.REWARDED_VIDEO | Appodeal.BANNER_VIEW);
- Appodeal.setInterstitialCallbacks(this);
- Appodeal.setRewardedVideoCallbacks(this);
- }
- public void ShowInterstitial()
- {
- if (Appodeal.isLoaded(Appodeal.INTERSTITIAL))
- {
- Appodeal.show(Appodeal.INTERSTITIAL);
- }
- }
- public void ShowNonSkippable()
- {
- if (Appodeal.isLoaded(Appodeal.REWARDED_VIDEO))
- {
- Appodeal.show(Appodeal.REWARDED_VIDEO);
- }
- }
- public void ShowBanner()
- {
- if (Appodeal.isLoaded(Appodeal.BANNER))
- {
- Appodeal.show(Appodeal.BANNER_BOTTOM);
- }
- }
- public void onInterstitialLoaded(bool isPrecache)
- {
- throw new System.NotImplementedException();
- }
- public void onInterstitialFailedToLoad()
- {
- throw new System.NotImplementedException();
- }
- public void onInterstitialShowFailed()
- {
- throw new System.NotImplementedException();
- }
- public void onInterstitialShown()
- {
- Dictionary<string, object> eventParameters = new Dictionary<string, object>
- {
- {"AdNetwork","Appodeal" },
- {"Type", "Interstitial" }
- };
- AppMetrica.Instance.ReportEvent("ShowAd", eventParameters);
- }
- public void onInterstitialClosed()
- {
- throw new System.NotImplementedException();
- }
- public void onInterstitialClicked()
- {
- throw new System.NotImplementedException();
- }
- public void onInterstitialExpired()
- {
- throw new System.NotImplementedException();
- }
- public void onBannerLoaded(int height, bool isPrecache)
- {
- throw new System.NotImplementedException();
- }
- public void onBannerFailedToLoad()
- {
- throw new System.NotImplementedException();
- }
- public void onBannerShown()
- {
- throw new System.NotImplementedException();
- }
- public void onBannerClicked()
- {
- throw new System.NotImplementedException();
- }
- public void onBannerExpired()
- {
- throw new System.NotImplementedException();
- }
- IEnumerator LoadBanner()
- {
- yield return new WaitForSeconds(3f);
- ShowBanner();
- }
- public void onRewardedVideoLoaded(bool precache)
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoFailedToLoad()
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoShowFailed()
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoShown()
- {
- Dictionary<string, object> eventParameters = new Dictionary<string, object>
- {
- {"AdNetwork","Appodeal" },
- {"Type", "Rewarded" }
- };
- AppMetrica.Instance.ReportEvent("ShowAd", eventParameters);
- }
- public void onRewardedVideoFinished(double amount, string name)
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoClosed(bool finished)
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoExpired()
- {
- throw new System.NotImplementedException();
- }
- public void onRewardedVideoClicked()
- {
- throw new System.NotImplementedException();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement