/// <summary> /// Sends the "requestAd" event with the "moreApps" parameter to the native Spil SDK which will send a request to the back-end. /// When a response has been received from the back-end the SDK will fire either an "AdAvailable" or and "AdNotAvailable" /// event to which the developer can subscribe and for instance call PlayVideo(); or PlayMoreApps(); /// </summary> public override void RequestMoreApps() { SpilUnityImplementationBase.fireAdAvailableEvent("moreApps"); }
/// <summary> /// This method is called by the native Spil SDK, it should not be used by developers. /// Developers can subscribe to the Spil.Instance.AdAvailable event. /// </summary> public void AdAvailable(string type) { SpilUnityImplementationBase.fireAdAvailableEvent(type); }
public static void ProcessAdvertisementResponse(ResponseEvent response) { if (response.action.Equals("init")) { JSONObject provider = response.data.GetField("providers"); if (provider.HasField("DFP")) { AdvertisementManager.DFPEnabled = true; SpilLogging.Log("DFP Enabled"); } if (provider.HasField("Fyber")) { AdvertisementManager.FyberEnabled = true; SpilLogging.Log("Fyber Enabled"); } if (provider.HasField("Chartboost") || provider.HasField("ChartBoost")) { AdvertisementManager.ChartboostEnabled = true; SpilLogging.Log("Chartboost Enabled"); } } else if (response.action.Equals("show")) { int priv = Spil.Instance.GetPrivValue(); if (priv < 2 && priv > -1) { return; } string provider = response.data.GetField("provider").str; string adType = response.data.GetField("adType").str; int probability = Random.Range(0, 100); bool available = probability > 20; if (provider.ToLower().Trim().Equals("dfp")) { if (available) { SpilLogging.Log("DFP Show"); SpilUnityImplementationBase.fireAdAvailableEvent(adType); AdvertisementManager.PlayInterstitial("DFP"); } else { SpilLogging.Log("DFP Not Available"); SpilUnityImplementationBase.fireAdNotAvailableEvent(adType); } } else if (provider.ToLower().Trim().Equals("fyber")) { if (available) { SpilLogging.Log("Fyber Show"); SpilUnityImplementationBase.fireAdAvailableEvent(adType); } else { SpilLogging.Log("Fyber Not Available"); SpilUnityImplementationBase.fireAdNotAvailableEvent(adType); } } else if (provider.ToLower().Trim().Equals("chartboost")) { if (available) { SpilLogging.Log("Chartboost Show"); SpilUnityImplementationBase.fireAdAvailableEvent(adType); AdvertisementManager.PlayInterstitial("Chartboost"); } else { SpilLogging.Log("Chartboost Not Available"); SpilUnityImplementationBase.fireAdNotAvailableEvent(adType); } } } }