/// <summary> /// Create a banner ad /// </summary> /// <param name="adType">The ad type</param> /// <param name="width">Width of the ad</param> /// <param name="height">Height of the ad</param> /// <param name="verticalPlacement">Where should the ad be placed vertically</param> /// <param name="horizontalPlacement">Where should the ad be placed horizontally</param> public static void CreatAd(WSABannerAdType adType, int width, int height, WSAAdVerticalPlacement verticalPlacement, WSAAdHorizontalPlacement horizontalPlacement) { if (!_unityEditor) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { if (adType == WSABannerAdType.AdDuplex) { _BannerAdCreate(adType.ToString(), _adDuplexAppId, _adDuplexAdUnitId, width, height, verticalPlacement.ToString(), horizontalPlacement.ToString()); } else if (adType == WSABannerAdType.Microsoft) { _BannerAdCreate(adType.ToString(), _msAppId, _msAdUnitId, width, height, verticalPlacement.ToString(), horizontalPlacement.ToString()); } }, false); } }
/// <summary> /// Destroy the banner ad /// </summary> /// <param name="adType">The ad type</param> public static void DestroyAd(WSABannerAdType adType) { if (!_unityEditor) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { _BannerAdDestroy(adType.ToString()); }, false); } }
/// <summary> /// Reconfigure an existing ad /// </summary> /// <param name="adType">The ad type</param> /// <param name="width">Width of the ad</param> /// <param name="height">Height of the ad</param> /// <param name="verticalPlacement">Where should the ad be placed vertically</param> /// <param name="horizontalPlacement">Where should the ad be placed horizontally</param> public static void ReconfigureAd(WSABannerAdType adType, int width, int height, WSAAdVerticalPlacement verticalPlacement, WSAAdHorizontalPlacement horizontalPlacement) { if (!_unityEditor) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { _BannerAdReconfigure(adType.ToString(), width, height, verticalPlacement.ToString(), horizontalPlacement.ToString()); }, false); } }
/// <summary> /// Show or hide the banner ad /// </summary> /// <param name="adType">The ad type</param> /// <param name="visible">Should the ad be visible</param> public static void SetAdVisibility(WSABannerAdType adType, bool visible) { if (!_unityEditor) { UnityEngine.WSA.Application.InvokeOnUIThread(() => { _BannerAdSetVisibility(adType.ToString(), visible); }, false); } }