// Creates a native ad public void CreateNativeAd(string placementId, string channelId, string versionId, GameObject gameObject, YumiNativeAdOptions option) { this.nativeClientPtr = (IntPtr)GCHandle.Alloc(this); this.currentGameObject = gameObject; Camera camera = Camera.main; int expressAdViewWidth = 0; int expressAdViewHeight = 0; if (option.expressAdViewTransform != null) { Rect adViewRect = getGameObjectRect(option.expressAdViewTransform as RectTransform, camera); expressAdViewWidth = (int)adViewRect.width; expressAdViewHeight = (int)adViewRect.height; } this.NativeAdPtr = YumiExterns.InitYumiNativeAd(this.nativeClientPtr, placementId, channelId, versionId, (int)option.adChoiseViewPosition, (int)option.adAttribution.AdOptionsPosition, option.adAttribution.text, option.adAttribution.textColor, option.adAttribution.backgroundColor, option.adAttribution.textSize, option.adAttribution.hide, expressAdViewWidth, expressAdViewHeight); adOptions = option; YumiExterns.SetNativeCallbacks( this.NativeAdPtr, NativeDidReceiveAdCallback, NativeDidFailToReceiveAdWithErrorCallback, NativeDidClickCallback, NativeExpressAdDidRenderSuccessCallback, NativeExpressAdDidRenderFailCallback, NativeExpressAdDidClickCloseButtonCallback ); }
public void CreateInterstitialAd(string placementId, string channelId, string versionId) { this.interstitialClientPtr = (IntPtr)GCHandle.Alloc(this); this.InterstitialPtr = YumiExterns.InitYumiInterstitial(this.interstitialClientPtr, placementId, channelId, versionId); YumiExterns.SetInterstitiaCallbacks( this.InterstitialPtr, InterstitialDidReceiveAdCallback, InterstitialDidFailToReceiveAdWithErrorCallback, InterstitialDidClickCallback, InterstitialDidCloseCallback); }
public void CreateBannerView(string placementId, string channelId, string versionId, YumiAdPosition adPosition) { // A new GCHandle that protects the object from garbage collection. This GCHandle must be released with Free() when it is no longer needed. this.bannerClientPtr = (IntPtr)GCHandle.Alloc(this); this.BannerViewPtr = YumiExterns.InitYumiBannerAd(this.bannerClientPtr, placementId, channelId, versionId, (int)adPosition); YumiExterns.SetBannerCallbacks( this.BannerViewPtr, BannerDidReceiveAdCallback, BannerDidFailToReceiveAdWithErrorCallback, BannerDidClickCallback); }
// Creates an RewardVideo. public void CreateRewardVideoAd() { this.rewardVideoClientPtr = (IntPtr)GCHandle.Alloc(this); this.RewardVideoPtr = YumiExterns.CreateYumiRewardVideo(this.rewardVideoClientPtr); // call back YumiExterns.SetRewardVideoCallbacks( this.RewardVideoPtr, RewardVideoDidOpenAdCallback, RewardVideoDidStartPlayingCallback, RewardVideoDidRewardCallback, RewardVideoDidCloseCallback ); }
// private method private void RegisterAssetObjectsForInteraction(YumiNativeData yumiNaitveData, Rect adViewRect, Rect mediaViewRect, Rect iconViewRect, Rect ctaViewRect, Rect titleRect, Rect descRect) { //set view style YumiExterns.RenderingTitleText(NativeAdPtr, adOptions.titleTextOptions.textColor, adOptions.titleTextOptions.backgroundColor, adOptions.titleTextOptions.textSize); YumiExterns.RenderingDescText(NativeAdPtr, adOptions.descTextOptions.textColor, adOptions.descTextOptions.backgroundColor, adOptions.descTextOptions.textSize); YumiExterns.RenderingCallToActionText(NativeAdPtr, adOptions.callToActionTextOptions.textColor, adOptions.callToActionTextOptions.backgroundColor, adOptions.callToActionTextOptions.textSize); YumiExterns.RenderingIconScaleType(NativeAdPtr, (int)adOptions.iconScaleType); YumiExterns.RenderingCoverImageScaleType(NativeAdPtr, (int)adOptions.coverImageScaleType); YumiExterns.RegisterAssetViewsForInteraction(this.NativeAdPtr, yumiNaitveData.uniqueId, (int)adViewRect.x, (int)adViewRect.y, (int)adViewRect.width, (int)adViewRect.height, (int)mediaViewRect.x, (int)mediaViewRect.y, (int)mediaViewRect.width, (int)mediaViewRect.height, (int)iconViewRect.x, (int)iconViewRect.y, (int)iconViewRect.width, (int)iconViewRect.height, (int)ctaViewRect.x, (int)ctaViewRect.y, (int)ctaViewRect.width, (int)ctaViewRect.height, (int)titleRect.x, (int)titleRect.y, (int)titleRect.width, (int)titleRect.height, (int)descRect.x, (int)descRect.y, (int)descRect.width, (int)descRect.height); }
public void CreateBannerView(string placementId, string channelId, string versionId, YumiBannerViewOptions bannerOptions) { // A new GCHandle that protects the object from garbage collection. This GCHandle must be released with Free() when it is no longer needed. this.bannerClientPtr = (IntPtr)GCHandle.Alloc(this); this.BannerViewPtr = YumiExterns.InitYumiBannerAd(this.bannerClientPtr, placementId, channelId, versionId, (int)bannerOptions.adPosition); //config banner if (bannerOptions.disableAutoRefresh) { YumiExterns.DisableAutoRefresh(BannerViewPtr); } YumiMediationAdViewBannerSize bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewBanner320x50; switch (bannerOptions.bannerSize) { case YumiBannerAdSize.YUMI_BANNER_AD_SIZE_320x50: bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewBanner320x50; break; case YumiBannerAdSize.YUMI_BANNER_AD_SIZE_728x90: bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewBanner728x90; break; case YumiBannerAdSize.YUMI_BANNER_AD_SIZE_300x250: bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewBanner300x250; break; case YumiBannerAdSize.YUMI_BANNER_AD_SIZE_SMART_PORTRAIT: bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewSmartBannerPortrait; break; case YumiBannerAdSize.YUMI_BANNER_AD_SIZE_SMART_LANDSCAPE: bannerSize = YumiMediationAdViewBannerSize.kYumiMediationAdViewSmartBannerLandscape; break; } YumiExterns.SetBannerAdSize(BannerViewPtr, bannerSize); YumiExterns.SetBannerCallbacks( this.BannerViewPtr, BannerDidReceiveAdCallback, BannerDidFailToReceiveAdWithErrorCallback, BannerDidClickCallback); }
private YumiNativeData GetNativeAdData(string adUniqueId) { YumiNativeData nativeAdData = new YumiNativeData { uniqueId = adUniqueId, title = YumiExterns.YumiNativeAdBridgeGetTitle(this.NativeAdPtr, adUniqueId), desc = YumiExterns.YumiNativeAdBridgeGetDesc(this.NativeAdPtr, adUniqueId), iconURL = YumiExterns.YumiNativeAdBridgeGetIconUrl(this.NativeAdPtr, adUniqueId), coverImageURL = YumiExterns.YumiNativeAdBridgeGetCoverImageURL(this.NativeAdPtr, adUniqueId), callToAction = YumiExterns.YumiNativeAdBridgeGetCallToAction(this.NativeAdPtr, adUniqueId), price = YumiExterns.YumiNativeAdBridgeGetPrice(this.NativeAdPtr, adUniqueId), starRating = YumiExterns.YumiNativeAdBridgeGetStarRating(this.NativeAdPtr, adUniqueId), other = YumiExterns.YumiNativeAdBridgeGetOther(this.NativeAdPtr, adUniqueId), isExpressAdView = YumiExterns.YumiNativeAdBridgeIsExpressAdView(NativeAdPtr, adUniqueId) }; return(nativeAdData); }
// Creates an Splash. public void CreateSplashAd(string placementId, string channelId, string versionId, YumiSplashOptions splashOptions) { splashClientPtr = (IntPtr)GCHandle.Alloc(this); SplashPtr = YumiExterns.InitYumiSplash(splashClientPtr, placementId, channelId, versionId); this.splashOptions = splashOptions; YumiExterns.SetSplashFetchTime(SplashPtr, splashOptions.adFetchTime); if (splashOptions.adOrientation != YumiSplashOrientation.YUMISPLASHORIENTATION_UNKNOWN || splashOptions.adOrientation != YumiSplashOrientation.YUMISPLASHORIENTATION_PORTRAIT) { YumiExterns.SetSplashOrientation(SplashPtr, (int)splashOptions.adOrientation); } YumiExterns.SetSplashCallbacks( SplashPtr, SplashDidSuccessToShowCallback, SplashDidFailToShowCallback, SplashDidClickCallback, SplashDidCloseCallback ); }
//load and show full screen splash public void LoadAdAndShow() { YumiExterns.LoadAdAndShowWithBottomViewHeight(SplashPtr, splashOptions.adBottomViewHeight); }
// Destroys a banner view. public void DestroyBannerView() { YumiExterns.DestroyBannerView(this.BannerViewPtr); this.BannerViewPtr = IntPtr.Zero; }
// Hides the banner view from the screen. public void HideBannerView() { YumiExterns.HideBannerView(this.BannerViewPtr); }
// Shows the banner view on the screen. public void ShowBannerView() { YumiExterns.ShowBannerView(this.BannerViewPtr); }
public bool IsAdInvalidated(YumiNativeData nativeData) { return(YumiExterns.IsAdInvalidated(this.NativeAdPtr, nativeData.uniqueId)); }
// Shows the RewardVideo. public void PlayRewardVideo() { YumiExterns.PlayRewardVideo(this.RewardVideoPtr); }
// Determines whether the interstitial has loaded. public bool IsRewardVideoReady() { return(YumiExterns.IsRewardVideoReady(this.RewardVideoPtr)); }
public void LoadRewardVideoAd(string placementId, string channelId, string versionId) { YumiExterns.LoadYumiRewardVideo(this.RewardVideoPtr, placementId, channelId, versionId); }
// Begins loading the YumiMediationNativeAd with the count you wanted. public void LoadAd(int adCount) { nativeDataList = null; YumiExterns.RequestNativeAd(this.NativeAdPtr, adCount); }
// Determines whether the interstitial has loaded. public bool IsInterstitialReady() { return(YumiExterns.IsInterstitialReady(this.InterstitialPtr)); }
// Requests a new ad for the banner view. public void LoadAd(bool isSmart) { Logger.LogError("load ad"); YumiExterns.RequestBannerAd(this.BannerViewPtr, isSmart); }
public void HideView(YumiNativeData nativeData) { YumiExterns.HideView(this.NativeAdPtr, nativeData.uniqueId); }
public void UnregisterView(YumiNativeData nativeData) { YumiExterns.UnregisterView(this.NativeAdPtr, nativeData.uniqueId); }
public void ChangeToTestServer() { YumiExterns.EnableTestMode(); }
public void CallYumiMediationDebugCenter(string bannerPlacementID, string interstitialPlacementID, string videoPlacementID, string channelID, string versionID) { YumiExterns.PresentDebugCenter(bannerPlacementID, interstitialPlacementID, videoPlacementID, "", channelID, versionID); }
// Shows the InterstitialAd. public void ShowInterstitial() { YumiExterns.PresentInterstitial(this.InterstitialPtr); }
public void UpdateNetworksConsentStatus(YumiConsentStatus consentStatus) { YumiExterns.UpdateNetworksConsentStatus((int)consentStatus); }