public IActionResult EditAdTypes([FromBody] AdTypes AddAdType) { try { var userId = this.help.GetCurrentUser(HttpContext); if (userId <= 0) { return(StatusCode(401, "الرجاء الـتأكد من أنك قمت بتسجيل الدخول")); } var AdTypes = (from p in db.AdTypes where p.AdTypeId == AddAdType.AdTypeId select p).SingleOrDefault(); if (AdTypes == null) { return(BadRequest("حذث خطأ في ارسال البيانات الرجاء إعادة الادخال")); } AdTypes.AdTypeName = AddAdType.AdTypeName; db.SaveChanges(); return(Ok("تم تعديل بيانات نوع الرسالة بنجاح")); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public Builder ForCustomNativeAd(string templateId, Action <CustomNativeTemplateAd, string> callback) { TemplateIds.Add(templateId); CustomNativeTemplateClickHandlers[templateId] = callback; AdTypes.Add(NativeAdType.CustomTemplate); return(this); }
/// <summary> /// Register Cross Promotion Action /// </summary> /// <param name="action">Action.</param> /// <param name="adType">Ad type.</param> public void CrosspromotionAction(string action, AdTypes adType) { if (adType == AdTypes.CPOverAll) { switch (action) { case "GetItNow": TapdaqGAHelper.Log(TapdaqGAEvents.CPOverallClick); AdManager.SendNativeClick(nativeAdOverall); break; case "Cancel": TapdaqGAHelper.Log(TapdaqGAEvents.CPOverallClose); break; } } else if (adType == AdTypes.CPCategory) { switch (action) { case "GetItNow": TapdaqGAHelper.Log(TapdaqGAEvents.CPCategoryClick); AdManager.SendNativeClick(nativeAdCategory); break; case "Cancel": TapdaqGAHelper.Log(TapdaqGAEvents.CPCategoryClose); break; } } }
//see if cross promotion is already loaded public bool IsCPLoaded(AdTypes AdType, AdSizes AdSize) { if (AdType == AdTypes.CPOverAll) { if (AdSize == AdSizes.Small && OverallSpriteSmall != null) { return(true); } if (AdSize == AdSizes.Large && OverallSpriteLarge != null) { return(true); } } else if (AdType == AdTypes.CPCategory) { if (AdSize == AdSizes.Small && CategorySpriteSmall != null) { return(true); } if (AdSize == AdSizes.Large && CategorySpriteLarge != null) { return(true); } } return(false); }
public static void UpdateAdAvailability(AdTypes ad, bool isAvailable) { if (OnAdAvailabilityChanged != null) { OnAdAvailabilityChanged(ad, isAvailable); } }
public IActionResult AddAdTypes([FromBody] AdTypes AddAdType) { try { if (AddAdType == null) { return(BadRequest("حذث خطأ في ارسال البيانات الرجاء إعادة الادخال")); } var userId = this.help.GetCurrentUser(HttpContext); if (userId <= 0) { return(StatusCode(401, "الرجاء الـتأكد من أنك قمت بتسجيل الدخول")); } AddAdType.CreatedBy = userId; AddAdType.CreatedOn = DateTime.Now; AddAdType.Status = 1; db.AdTypes.Add(AddAdType); db.SaveChanges(); return(Ok("لقد قمت بتسـجيل نوع الرساله بنــجاح")); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public static void ShowAd(AdTypes type) { AdManager adManager = GameObject.FindGameObjectWithTag("AdManager").GetComponent <AdManager>(); if (type == AdTypes.GAME_OVER_AD) { adManager.ShowAdMobVideo(); } else { adManager.ShowRewardAd(); } }
protected void SetAdAvailability(AdTypes type, bool isAvailable) { int adIndex = ( int )type; #if !UNITY_EDITOR if (adTypeAvailabilityRecord[adIndex] != isAvailable) { Advertisement.UpdateAdAvailability(type, isAvailable); adTypeAvailabilityRecord[adIndex] = isAvailable; } #else Advertisement.UpdateAdAvailability(type, isAvailable); adTypeAvailabilityRecord[adIndex] = isAvailable; #endif }
/// <summary> /// Displays the Cross Promotion Ad. /// </summary> /// <param name="TargetImage">Target image.</param> /// <param name="TargetType">Target type.</param> /// <param name="TargetSize">Target size.</param> public void ShowCrosspromotionAd(Image TargetImage, AdTypes TargetType, AdSizes TargetSize) { if (TargetType == AdTypes.CPOverAll) { ShowCrosspromotionAdOverall(TargetImage, TargetSize); } else if (TargetType == AdTypes.CPCategory) { ShowCrosspromotionAdCategory(TargetImage, TargetSize); } else { Debug.Log("GT >> Unknown CP Type"); } }
protected override void LoadAdType(AdTypes type) { #if UNITY_EDITOR SetAdAvailability(type, true); #else SetAdBuffering(type, true); switch (type) { case AdTypes.Interstitial: IronSource.Agent.loadInterstitial(); break; } #endif }
internal AdvertisementEventViewModel(string addId, bool skipped, AdActions action, bool firstTime, AdFailShowReasons failShowReason, int duration, string sdkName, AdTypes type, string placement, double amount) { AddId = addId; Skipped = skipped; Action = action; FirstTime = firstTime; FailShowReason = failShowReason; Duration = duration; SDKName = sdkName; Type = type; Placement = placement; Amount = amount; DeviceInfo.WriteBaseEventDataViewModel(this.GetType().Name, this); Broker.AdvertisementEventCreated(this); }
/// <summary> /// Loads the Ad of specified Type. /// </summary> /// <param name="AdType">Ad type.</param> public void LoadAd(AdTypes AdType) { switch (AdType) { case AdTypes.Interstitial: LoadInterstitial(); break; case AdTypes.Video: LoadVideo(); break; case AdTypes.Rewarded: LoadRewardedVideo(); break; } }
public bool GetAdAvailability(AdTypes adType) { #if UNITY_EDITOR return(true); #else switch (adType) { case AdTypes.Interstitial: return(IronSource.Agent.isInterstitialReady()); case AdTypes.Rewarded: return(IronSource.Agent.isRewardedVideoAvailable()); default: return(false); } #endif }
//pull CP image from nativeAd object and cache private void cacheCPImage(TDNativeAd myNativeAd, AdTypes nativeAdType) { Debug.Log("GT >> Cache CP Image"); Texture2D texture = myNativeAd.texture; Debug.Log("GT >> Got Texture"); if (texture == null) { Debug.LogError("GT >> Texture not loaded"); return; } var sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); if (nativeAdType == AdTypes.CPOverAll) { if (CPLoadingSize == AdSizes.Small) { OverallSpriteSmall = sprite; } else if (CPLoadingSize == AdSizes.Large) { OverallSpriteLarge = sprite; } NotifyAdAvailable(AdTypes.CPOverAll, CPLoadingSize); TapdaqGAHelper.Log(TapdaqGAEvents.CPOverallLoaded); } else if (nativeAdType == AdTypes.CPCategory) { if (CPLoadingSize == AdSizes.Small) { CategorySpriteSmall = sprite; } else if (CPLoadingSize == AdSizes.Large) { CategorySpriteLarge = sprite; } NotifyAdAvailable(AdTypes.CPCategory, CPLoadingSize); TapdaqGAHelper.Log(TapdaqGAEvents.CPCategoryLoaded); } }
protected override void ShowAd(string adUnit, AdTypes type) { #if UNITY_EDITOR if (isDebugging) { Debug.Log("[IronSourceProvider] Editor stub. Faking successful ad display."); } if (currentAd != null) { switch (currentAd.Type) { case AdTypes.Interstitial: InterstitialAdShowSucceededEvent(); InterstitialAdOpenedEvent(); InterstitialAdClosedEvent(); InterstitialAdReadyEvent(); break; case AdTypes.Rewarded: RewardedVideoAdStartedEvent(); RewardedVideoAdOpenedEvent(); RewardedVideoAdEndedEvent(); RewardedVideoAdClosedEvent(); RewardedVideoAdRewardedEvent(new IronSourcePlacement("test", "test", 1)); RewardedVideoAvailabilityChangedEvent(true); break; } } return; #else switch (type) { case AdTypes.Interstitial: IronSource.Agent.showInterstitial(adUnit); break; case AdTypes.Rewarded: IronSource.Agent.showRewardedVideo(adUnit); break; } #endif }
/// <summary> /// Loads the Cross Promotion of specific Type (i.e Overall,Category) and Size. /// </summary> /// <param name="AdType">Cross Promotion Type.</param> /// <param name="CPSize">Cross Promotion Size.</param> public void LoadCrossPromotion(AdTypes AdType, AdSizes CPSize) { if (IsCPLoaded(AdType, CPSize)) { Debug.Log("GT >> CP Already Loaded"); return; } CPLoadingSize = CPSize; Debug.Log("GT >> Load CP Type: " + AdType.ToString() + " Size:" + CPSize.ToString()); if (AdType == AdTypes.CPOverAll) { AdManager.LoadNativeAdvertForTag(CrossPromotionTagOverall, getTDNativeAdType(CPSize)); TapdaqGAHelper.Log(TapdaqGAEvents.LoadCPOverall); } else if (AdType == AdTypes.CPCategory) { AdManager.LoadNativeAdvertForTag(CrossPromotionTagCategory, getTDNativeAdType(CPSize)); TapdaqGAHelper.Log(TapdaqGAEvents.LoadCPCategory); } }
protected void SetAdBuffering(AdTypes type, bool isBuffering) { if (!IsAdBuffering(type) && isBuffering) { int adIndex = ( int )type; adBufferingRecord[adIndex] = true; string id = string.Empty; id = TimerUtility.Instance.RegisterTimer(adBufferTimeout, Domain.Enum.CountdownScope.Game, (s) => { if (s != id || !IsAdBuffering(type)) { return; } SetAdBuffering(type, false); OnAdBufferTimeout(type); }); } else { int adIndex = ( int )type; adBufferingRecord[adIndex] = false; } }
protected abstract void LoadAdType(AdTypes type);
protected bool IsAdBuffering(AdTypes type) { int adIndex = ( int )type; return(adBufferingRecord[adIndex]); }
public IEnumerable <Ad> Get(AdTypes type, int count = 5) { return(this.Ads.Where(a => a.AdType == type)); }
protected bool IsAdTypeAvailable(AdTypes type) { int adIndex = ( int )type; return(adTypeAvailabilityRecord[adIndex]); }
protected virtual void OnAdBufferTimeout(AdTypes type) { }
public UrlFilterModel(string text, AdTypes value) { Text = text; Value = ((int)value).ToString(); }
protected void LoadUnavailableAd(AdTypes type) { LoadAdType(type); }
public void OnAdAvailableDelegate(AdTypes adtype, AdSizes adsize) { }
protected abstract void ShowAd(string adUnit, AdTypes type);
/// <summary>Call PROBA Advertisement event</summary> public static void AdvertisementEvent(string addId, bool skipped, AdActions action, bool firstTime = false, AdFailShowReasons failShowReason = AdFailShowReasons.Unknown, int duration = 0, string sdkName = "", AdTypes type = AdTypes.RewardedVideo, string placement = "", double amount = 0.0) { _ = new AdvertisementEventViewModel(addId, skipped, action, firstTime, failShowReason, duration, sdkName, type, placement, amount); }
public Builder ForCustomNativeAd(string templateId) { TemplateIds.Add(templateId); AdTypes.Add(NativeAdType.CustomTemplate); return(this); }