コード例 #1
0
        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));
            }
        }
コード例 #2
0
 public Builder ForCustomNativeAd(string templateId, Action <CustomNativeTemplateAd, string> callback)
 {
     TemplateIds.Add(templateId);
     CustomNativeTemplateClickHandlers[templateId] = callback;
     AdTypes.Add(NativeAdType.CustomTemplate);
     return(this);
 }
コード例 #3
0
    /// <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;
            }
        }
    }
コード例 #4
0
 //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);
 }
コード例 #5
0
 public static void UpdateAdAvailability(AdTypes ad, bool isAvailable)
 {
     if (OnAdAvailabilityChanged != null)
     {
         OnAdAvailabilityChanged(ad, isAvailable);
     }
 }
コード例 #6
0
        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));
            }
        }
コード例 #7
0
    public static void ShowAd(AdTypes type)
    {
        AdManager adManager = GameObject.FindGameObjectWithTag("AdManager").GetComponent <AdManager>();

        if (type == AdTypes.GAME_OVER_AD)
        {
            adManager.ShowAdMobVideo();
        }
        else
        {
            adManager.ShowRewardAd();
        }
    }
コード例 #8
0
        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
        }
コード例 #9
0
 /// <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");
     }
 }
コード例 #10
0
        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
        }
コード例 #11
0
        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);
        }
コード例 #12
0
    /// <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;
        }
    }
コード例 #13
0
        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
        }
コード例 #14
0
    //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);
        }
    }
コード例 #15
0
        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
        }
コード例 #16
0
    /// <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);
        }
    }
コード例 #17
0
        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;
            }
        }
コード例 #18
0
 protected abstract void LoadAdType(AdTypes type);
コード例 #19
0
        protected bool IsAdBuffering(AdTypes type)
        {
            int adIndex = ( int )type;

            return(adBufferingRecord[adIndex]);
        }
コード例 #20
0
 public IEnumerable <Ad> Get(AdTypes type, int count = 5)
 {
     return(this.Ads.Where(a => a.AdType == type));
 }
コード例 #21
0
        protected bool IsAdTypeAvailable(AdTypes type)
        {
            int adIndex = ( int )type;

            return(adTypeAvailabilityRecord[adIndex]);
        }
コード例 #22
0
 protected virtual void OnAdBufferTimeout(AdTypes type)
 {
 }
コード例 #23
0
 public UrlFilterModel(string text, AdTypes value)
 {
     Text  = text;
     Value = ((int)value).ToString();
 }
コード例 #24
0
 protected void LoadUnavailableAd(AdTypes type)
 {
     LoadAdType(type);
 }
コード例 #25
0
 public void OnAdAvailableDelegate(AdTypes adtype, AdSizes adsize)
 {
 }
コード例 #26
0
 protected abstract void ShowAd(string adUnit, AdTypes type);
コード例 #27
0
 /// <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);
 }
コード例 #28
0
 public Builder ForCustomNativeAd(string templateId)
 {
     TemplateIds.Add(templateId);
     AdTypes.Add(NativeAdType.CustomTemplate);
     return(this);
 }