#if UNITY_ANDROID using System; using System.Collections.Generic; using UnityEngine; public class IronSourceRewardedVideoLevelPlayAndroid : AndroidJavaProxy, IUnityLevelPlayRewardedVideo { //implements UnityRewardedVideoListener java interface public IronSourceRewardedVideoLevelPlayAndroid(): base(IronSourceConstants.LevelPlayRewardedVideoBridgeListenerClass) { try { using (var pluginClass = new AndroidJavaClass(IronSourceConstants.bridgeClass)) { var bridgeInstance = pluginClass.CallStatic("getInstance"); bridgeInstance.Call("setUnityRewardedVideoLevelPlayListener", this); } } catch(Exception e) { Debug.LogError("setUnityRewardedVideoLevelPlayListener method doesn't exist, error: " + e.Message); } } public event Action OnAdShowFailed = delegate { }; public event Action OnAdOpened = delegate { }; public event Action OnAdClosed = delegate { }; public event Action OnAdRewarded = delegate { }; public event Action OnAdClicked = delegate { }; public event Action OnAdAvailable = delegate { }; public event Action OnAdUnavailable = delegate { }; void onAdShowFailed(string description, string data) { if (this.OnAdShowFailed != null) { IronSourceError ssp = IronSourceUtils.getErrorFromErrorObject(description); IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdShowFailed(ssp, adInfo); } } void onAdClosed(string data) { if (this.OnAdClosed != null) { IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdClosed(adInfo); } } void onAdOpened(string data) { if (this.OnAdOpened != null) { IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdOpened(adInfo); } } void onAdRewarded(string description, string data) { if (this.OnAdRewarded != null) { IronSourcePlacement ssp = IronSourceUtils.getPlacementFromObject(description); IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdRewarded(ssp, adInfo); } } void onAdClicked(string description, string data) { if (this.OnAdClicked != null) { IronSourcePlacement ssp = IronSourceUtils.getPlacementFromObject(description); IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdClicked(ssp, adInfo); } } void onAdAvailable( string data) { if (this.OnAdAvailable != null) { IronSourceAdInfo adInfo = new IronSourceAdInfo(data); this.OnAdAvailable( adInfo); } } void onAdUnavailable() { if (this.OnAdUnavailable != null) { this.OnAdUnavailable(); } } } #endif