/// <summary> /// Use to create multiple Ads. /// </summary> /// <param name="descs">Your AdDesc settings.</param> /// <param name="createdCallback">The callback that fires when done.</param> /// <returns>Returns array of Ad objects</returns> public static Ad[] CreateAd(AdDesc[] descs, AdCreatedCallbackMethod createdCallback) { if (creatingAds) { Debug.LogError("You must wait for the last ads to finish being created!"); if (createdCallback != null) { createdCallback(false); } return(null); } creatingAds = true; AdManager.createdCallback = createdCallback; int startLength = plugins.Count; for (int i = 0; i != descs.Length; ++i) { plugins.Add(AdPluginAPI.New(descs[i], async_CreatedCallback)); } var ads = new Ad[descs.Length]; for (int i = 0, i2 = startLength; i != descs.Length; ++i, ++i2) { ads[i] = new Ad(plugins[i2]); } return(ads); }
/// <summary> /// Use to create a single Ad. /// </summary> /// <param name="desc">Your AdDesc settings.</param> /// <param name="createdCallback">The callback that fires when done.</param> /// <returns>Returns Ad object</returns> public static Ad CreateAd(AdDesc desc, AdCreatedCallbackMethod createdCallback) { if (creatingAds) { Debug.LogError("You must wait for the last ad to finish being created!"); if (createdCallback != null) { createdCallback(false); } return(null); } creatingAds = true; AdManager.createdCallback = createdCallback; plugins.Add(AdPluginAPI.New(desc, async_CreatedCallback)); return(new Ad(plugins[plugins.Count - 1])); }