Exemplo n.º 1
0
    public void RequestBanner(string adName, AdSize adSize, AdPosition adPosition)
    {
        AdxBannerRequest bannerAdsObject;

        if (_bannerAdsObjectDic.ContainsKey(adName))
        {
            bannerAdsObject = _bannerAdsObjectDic[adName];
        }
        else
        {
            GameObject gameObject = new GameObject("BannerAdsObject_" + adName);
            bannerAdsObject = gameObject.AddComponent <AdxBannerRequest>();
            _bannerAdsObjectDic.Add(adName, bannerAdsObject);
        }

        MoPub.AdPosition mAdPosition = MoPub.AdPosition.BottomCenter;
        switch (adPosition)
        {
        case AdPosition.Bottom:
            mAdPosition = MoPub.AdPosition.BottomCenter;
            break;

        case AdPosition.BottomLeft:
            mAdPosition = MoPub.AdPosition.BottomLeft;
            break;

        case AdPosition.BottomRight:
            mAdPosition = MoPub.AdPosition.BottomRight;
            break;

        case AdPosition.Center:
            mAdPosition = MoPub.AdPosition.Centered;
            break;

        case AdPosition.Top:
            mAdPosition = MoPub.AdPosition.TopCenter;
            break;

        case AdPosition.TopLeft:
            mAdPosition = MoPub.AdPosition.TopLeft;
            break;

        case AdPosition.TopRight:
            mAdPosition = MoPub.AdPosition.TopRight;
            break;
        }


        bannerAdsObject.RequestBanner(_adData.GetAdUnitId(AdType.BANNER, adName), mAdPosition);
    }
Exemplo n.º 2
0
    public void RequestBanner(string adName, AdSize adSize, AdPosition adPosition)
    {
        BannerAdsObject bannerAdsObject;

        if (_bannerAdsObjectDic.ContainsKey(adName))
        {
            bannerAdsObject = _bannerAdsObjectDic[adName];
        }
        else
        {
            GameObject gameObject = new GameObject("BannerAdsObject_" + adName);
            bannerAdsObject = gameObject.AddComponent <BannerAdsObject>();
            _bannerAdsObjectDic.Add(adName, bannerAdsObject);
        }

        bannerAdsObject.SetAd(adSize, adPosition);
        bannerAdsObject.RequestAd(adName, _admobData.GetAdUnitId(AdType.BANNER, adName), GetAdRequest(), null);
    }