You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.5 KiB
C#
85 lines
2.5 KiB
C#
#if UNITY_ANDROID
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class IronSourceOfferwallAndroid : AndroidJavaProxy, IUnityOfferwall
|
|
{
|
|
|
|
//implements UnityOfferwallListener java interface
|
|
public IronSourceOfferwallAndroid() : base(IronSourceConstants.offerwallBridgeListenerClass)
|
|
{
|
|
try
|
|
{
|
|
using (var pluginClass = new AndroidJavaClass(IronSourceConstants.bridgeClass))
|
|
{
|
|
var bridgeInstance = pluginClass.CallStatic<AndroidJavaObject>("getInstance");
|
|
bridgeInstance.Call("setUnityOfferwallListener", this);
|
|
}
|
|
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
Debug.LogError("setUnityOfferwallListener method doesn't exist, error: " + e.Message);
|
|
}
|
|
}
|
|
|
|
public event Action<IronSourceError> OnOfferwallShowFailed = delegate { };
|
|
public event Action OnOfferwallOpened = delegate { };
|
|
public event Action OnOfferwallClosed = delegate { };
|
|
public event Action<IronSourceError> OnGetOfferwallCreditsFailed = delegate { };
|
|
public event Action<Dictionary<string, object>> OnOfferwallAdCredited = delegate { };
|
|
public event Action<bool> OnOfferwallAvailable = delegate { };
|
|
|
|
public void onOfferwallOpened ()
|
|
{
|
|
if (this.OnOfferwallOpened != null) {
|
|
this.OnOfferwallOpened ();
|
|
}
|
|
}
|
|
|
|
|
|
public void onOfferwallShowFailed (string description)
|
|
{
|
|
if (OnOfferwallShowFailed != null) {
|
|
IronSourceError sse = IronSourceUtils.getErrorFromErrorObject (description);
|
|
OnOfferwallShowFailed (sse);
|
|
}
|
|
}
|
|
|
|
|
|
public void onOfferwallClosed ()
|
|
{
|
|
if (OnOfferwallClosed != null) {
|
|
OnOfferwallClosed ();
|
|
}
|
|
}
|
|
|
|
|
|
public void onGetOfferwallCreditsFailed (string description)
|
|
{
|
|
if (OnGetOfferwallCreditsFailed != null) {
|
|
IronSourceError sse = IronSourceUtils.getErrorFromErrorObject (description);
|
|
OnGetOfferwallCreditsFailed (sse);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void onOfferwallAdCredited (string json)
|
|
{
|
|
if (OnOfferwallAdCredited != null)
|
|
OnOfferwallAdCredited (IronSourceJSON.Json.Deserialize (json) as Dictionary<string,object>);
|
|
}
|
|
|
|
|
|
public void onOfferwallAvailable (string stringAvailable)
|
|
{
|
|
bool isAvailable = (stringAvailable == "true") ? true : false;
|
|
if (OnOfferwallAvailable != null)
|
|
OnOfferwallAvailable (isAvailable);
|
|
}
|
|
|
|
|
|
}
|
|
#endif |