//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);
 }
 /// <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");
     }
 }
    //Converts AdSizes to TDNativeAdType
    private TDNativeAdType getTDNativeAdType(AdSizes size)
    {
        switch (size)
        {
        case AdSizes.Small:
            return(TDNativeAdType.TDNativeAdType1x1Small);

        case AdSizes.Medium:
            return(TDNativeAdType.TDNativeAdType1x1Medium);

        case AdSizes.Large:
            return(TDNativeAdType.TDNativeAdType1x1Large);
        }
        return(TDNativeAdType.TDNativeAdType1x1Small);
    }
Beispiel #4
0
        void CreateAdControl(AdSizes adSize, string adUnitID)
        {
            bannerView = new AdControl();
            switch (adSize)
            {
            case AdSizes.StandardBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            case AdSizes.LargeBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            case AdSizes.MediumRectangle:
                bannerView.Width  = 300;
                bannerView.Height = 250;
                break;

            case AdSizes.FullBanner:
                bannerView.Width  = 480;
                bannerView.Height = 80;
                break;

            case AdSizes.Leaderboard:
                bannerView.Width  = 728;
                bannerView.Height = 90;
                break;

            case AdSizes.SmartBanner:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;

            default:
                bannerView.Width  = 320;
                bannerView.Height = 50;
                break;
            }

            bannerView.ApplicationId = UsefulStuff.UWP_AdAppID;
            bannerView.AdUnitId      = adUnitID;
            bannerView.AutoRefreshIntervalInSeconds = 6;
        }
    private void ShowCrosspromotionAdCategory(Image CPImage, AdSizes TargetSize)
    {
        Debug.Log("GT >> Show CP Category " + TargetSize);
        if (TargetSize == AdSizes.Small && CategorySpriteSmall != null)
        { // if internet is not available then don't show crosspromotion
            CPImage.sprite = CategorySpriteSmall;
        }
        else if ((TargetSize == AdSizes.Large && CategorySpriteLarge != null))
        {
            CPImage.sprite = CategorySpriteLarge;
        }
        else
        {
            Debug.Log("GT >> Tapdaq:Category CP (" + TargetSize + ") Not Avallibale to show as image is not assigned");
            return;
        }

        AdManager.SendNativeImpression(nativeAdCategory);
        TapdaqGAHelper.Log(TapdaqGAEvents.CPCategoryShow);
    }
    private void ShowCrosspromotionAdOverall(Image CPImage, AdSizes TargetSize)
    {
        Debug.Log("GT >> Show CP Overall " + TargetSize);

        if (TargetSize == AdSizes.Small && OverallSpriteSmall != null)
        {
            CPImage.sprite = OverallSpriteSmall;
        }
        else if (TargetSize == AdSizes.Large && OverallSpriteLarge != null)
        {
            CPImage.sprite = OverallSpriteLarge;
        }
        else
        {
            Debug.Log("GT >> Tapdaq:Overall CP (" + TargetSize + ") Not Avallibale to show as image is not assigned");
            return;
        }

        AdManager.SendNativeImpression(nativeAdOverall);
        TapdaqGAHelper.Log(TapdaqGAEvents.CPOverallShow);
    }
    /// <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);
        }
    }
Beispiel #8
0
 public void OnAdAvailableDelegate(AdTypes adtype, AdSizes adsize)
 {
 }