public static bool show(string zoneId, string rewardItemKey, Dictionary <string, string> options) { if (!_adsShow && _campaignsAvailable) { if (SharedInstance) { string optionsString = parseOptionsDictionary(options); if (UnityAdsExternal.show(zoneId, rewardItemKey, optionsString)) { if (_adsShowDelegate != null) { _adsShowDelegate(); } _adsShow = true; _savedTimeScale = Time.timeScale; _savedAudioVolume = AudioListener.volume; AudioListener.pause = true; AudioListener.volume = 0; Time.timeScale = 0; return(true); } } } return(false); }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 50), _campaignsAvailable ? "Open Zone 1" : "Waiting...")) { if (_campaignsAvailable) { UnityAdsExternal.Log("Open Zone 1 -button clicked"); UnityAds.show("16-default"); } } if (GUI.Button(new Rect(10, 70, 150, 50), _campaignsAvailable ? "Open Zone 2" : "Waiting...")) { if (_campaignsAvailable) { UnityAdsExternal.Log("Open Zone 2 -button clicked"); UnityAds.show("16-default", "ship", new Dictionary <string, string> { { "openAnimated", "true" }, { "noOfferScreen", "true" }, { "sid", "testiSid" }, { "muteVideoSounds", "true" }, { "useDeviceOrientationForVideo", "true" } }); } } }
public static void setDefaultRewardItemAsRewardItem() { if (_campaignsAvailable) { UnityAdsExternal.setDefaultRewardItemAsRewardItem(); } }
public static void hide() { if (_adsShow) { UnityAdsExternal.hide(); } }
public static string getCurrentRewardItemKey() { if (_campaignsAvailable) { return(UnityAdsExternal.getCurrentRewardItemKey()); } return(""); }
public static bool setRewardItemKey(string rewardItemKey) { if (_campaignsAvailable) { return(UnityAdsExternal.setRewardItemKey(rewardItemKey)); } return(false); }
public static bool canShow() { if (_campaignsAvailable) { return(UnityAdsExternal.canShow()); } return(false); }
public void onVideoStarted() { if (_videoStartedDelegate != null) { _videoStartedDelegate(); } UnityAdsExternal.Log("onVideoStarted"); }
public static bool hasMultipleRewardItems() { if (_campaignsAvailable) { return(UnityAdsExternal.hasMultipleRewardItems()); } return(false); }
public void onFetchFailed() { _campaignsAvailable = false; if (_campaignsFetchFailedDelegate != null) { _campaignsFetchFailedDelegate(); } UnityAdsExternal.Log("onFetchFailed"); }
public void onFetchCompleted() { _campaignsAvailable = true; if (_campaignsAvailableDelegate != null) { _campaignsAvailableDelegate(); } UnityAdsExternal.Log("onFetchCompleted"); }
private static void fillRewardItemKeyData() { string keyData = UnityAdsExternal.getRewardItemDetailsKeys(); if (keyData != null && keyData.Length > 2) { List <string> splittedKeyData = new List <string>(keyData.Split(';')); _rewardItemNameKey = splittedKeyData.ToArray().GetValue(0).ToString(); _rewardItemPictureKey = splittedKeyData.ToArray().GetValue(1).ToString(); } }
public static List <string> getRewardItemKeys() { List <string> retList = new List <string>(); if (_campaignsAvailable) { string keys = UnityAdsExternal.getRewardItemKeys(); retList = new List <string>(keys.Split(';')); } return(retList); }
/* Events */ public void onHide() { _adsShow = false; AudioListener.pause = false; AudioListener.volume = _savedAudioVolume; Time.timeScale = _savedTimeScale; if (_adsHideDelegate != null) { _adsHideDelegate(); } UnityAdsExternal.Log("onHide"); }
public void onVideoCompleted(string parameters) { if (parameters != null) { List <string> splittedParameters = new List <string>(parameters.Split(';')); string rewardItemKey = splittedParameters.ToArray().GetValue(0).ToString(); bool skipped = splittedParameters.ToArray().GetValue(1).ToString() == "true" ? true : false; if (_videoCompletedDelegate != null) { _videoCompletedDelegate(rewardItemKey, skipped); } UnityAdsExternal.Log("onVideoCompleted: " + rewardItemKey + " - " + skipped); } }
public static Dictionary <string, string> getRewardItemDetailsWithKey(string rewardItemKey) { Dictionary <string, string> retDict = new Dictionary <string, string>(); string rewardItemDataString = ""; if (_campaignsAvailable) { rewardItemDataString = UnityAdsExternal.getRewardItemDetailsWithKey(rewardItemKey); if (rewardItemDataString != null) { List <string> splittedData = new List <string>(rewardItemDataString.Split(';')); UnityAdsExternal.Log("UnityAndroid: getRewardItemDetailsWithKey() rewardItemDataString=" + rewardItemDataString); if (splittedData.Count == 2) { retDict.Add(getRewardItemNameKey(), splittedData.ToArray().GetValue(0).ToString()); retDict.Add(getRewardItemPictureKey(), splittedData.ToArray().GetValue(1).ToString()); } } } return(retDict); }
/* Static Methods */ public static bool isSupported() { return(UnityAdsExternal.isSupported()); }
public void onShow() { UnityAdsExternal.Log("onShow"); }
public static string getSDKVersion() { return(UnityAdsExternal.getSDKVersion()); }