Facebook
From TERIX, 2 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 492
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class videoAd : MonoBehaviour
  7. {
  8.  
  9.  
  10.  
  11.     void Start()
  12.     {
  13.  
  14.  
  15.         AppLovin.SetSdkKey("0UoiuyQNova9_hmqJTnIb2hmvFHUxn35qz0CeWauTwiNZXNUny6i34lyUQwczNDe5tT-b2vz6VmB6IXueuxI4e");
  16.  
  17.         AppLovin.SetUnityAdListener("ApplovinRewarded");
  18.         AppLovin.LoadRewardedInterstitial();
  19.  
  20.     }
  21.  
  22.  
  23.  
  24.     void onAppLovinEventReceived(string ev)
  25.     {
  26.         if (ev.Contains("REWARDAPPROVEDINFO"))
  27.         {
  28.             //rewand
  29.         }
  30.         else if (ev.Contains("LOADEDREWARDED"))
  31.         {
  32.             Debug.Log("A rewarded video was successfully loaded.");
  33.         }
  34.         else if (ev.Contains("LOADREWARDEDFAILED"))
  35.         {
  36.             Debug.Log("A rewarded video failed to load.");
  37.         }
  38.         else if (ev.Contains("HIDDENREWARDED"))
  39.         {
  40.             Debug.Log("A rewarded video was closed.  Preload the next rewarded video.");
  41.             AppLovin.LoadRewardedInterstitial();
  42.         }
  43.     }
  44.  
  45.     public void ApplovinRewarded()
  46.     {
  47.         AppLovin.ShowRewardedInterstitial();
  48.         AppLovin.LoadRewardedInterstitial();
  49.         Debug.Log("should show reward");
  50.     }
  51.  
  52.  
  53. }