예제 #1
0
    /**
     * Load a Banner Ad.
     *
     * @param adSize
     *           Vector2 - Customized size of the Ad.
     *
     *           adSize.x - The width of the Ad, in pixels.
     *           adSize.y - The height of the Ad, in pixels.
     *
     * @param layout
     *           AdLayout - In which layout the Ad should display.
     *
     * @param offset
     *           Vector2 - The offset of the Ad.
     *
     *           offset.x - The horizontal offset of the Ad, if the layout is set to left,
     *                 the offset is from the left edge of screen to the left edge of
     *                 the Ad; if the layout is set to right, the offset is from the
     *                 right edge of screen to the right edge of the Ad.
     *                 The offset is in pixels.
     *           offset.y - The vertical offset of the Ad, if the layout is set to top,
     *                 the offset is from the top edge of screen to the top edge of
     *                 the Ad; if the layout is set to bottom, the offset is from the
     *                 bottom edge of screen to the bottom edge of the Ad.
     *                 The offset is in pixels.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     *
     * @param tagForChildren
     *           TagForChildrenDirectedTreatment - Set TagForChildrenDirectedTreatment flag,
     *           More information, please refer to:
     *           https://developers.google.com/mobile-ads-sdk/docs/admob/additional-controls#play-coppa
     *
     *           Valid values:
     *
     *	         Unset - Ad requests will include no indication of how you would like your content treated
     *                   with respect to COPPA.
     *
     *           Yes - You will indicate that your content should be treated as child-directed for
     *                 purposes of COPPA.
     *
     *           No - You will indicate that your content should NOT be treated as child-directed for
     *                purposes of COPPA.
     *
     */
    public void LoadBannerAd(Vector2 adSize, AdLayout layout, Vector2 offset, bool hide,
                             Dictionary <string, string> extras, TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd(adSize, (int)layout, offset, hide, extras, (int)tagForChildren);
#endif
    }
예제 #2
0
    /**
     * Load an Interstitial Ad.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowInterstitialAd() after you get notified with event
     *                  OnReceiveAdInterstitial from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     */
    public void LoadInterstitialAd(bool hide, Dictionary <string, string> extras,
                                   TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadInterstitialAd(hide, extras, (int)tagForChildren);
#endif
    }
예제 #3
0
    /**
     * Load a Banner Ad and place it at specified absolute position.
     *
     * Please note that the Ad won't display if the top or left applied
     * makes the Ad display area outside the screen.
     *
     * @param adType
     *          BannerAdType - the type of Ad.
     *
     * @param top
     *          int - the top margin (in pixels) for placing Ad in absolute position.
     *
     * @param left
     *          int - the left margin (in pixels) for placing Ad in absolute position.
     *
     * @param hide
     *           bool - whether the ad should keep being invisible after loaded,
     *                  true for making the ad hidden, false for showing the
     *                  ad immediately. if the parameter is set to true, then
     *                  you need to programmatically display the ad by calling
     *                  ShowBannerAd() after you get notified with event
     *                  OnReceiveAd from AdmobAdListener.
     *
     * @param extras
     *           Dictionary<string, string> - The extra parameters of Ad request.
     *
     * @param tagForChildren
     *           TagForChildrenDirectedTreatment - Set TagForChildrenDirectedTreatment flag,
     *           More information, please refer to:
     *           https://developers.google.com/mobile-ads-sdk/docs/admob/additional-controls#play-coppa
     *
     *           Valid values:
     *
     *	         Unset - Ad requests will include no indication of how you would like your content treated
     *                   with respect to COPPA.
     *
     *           Yes - You will indicate that your content should be treated as child-directed for
     *                 purposes of COPPA.
     *
     *           No - You will indicate that your content should NOT be treated as child-directed for
     *                purposes of COPPA.
     *
     */
    public void LoadBannerAd(BannerAdType adType, int top, int left, bool hide,
                             Dictionary <string, string> extras,
                             TagForChildrenDirectedTreatment tagForChildren)
    {
#if UNITY_ANDROID
        AdmobAdAndroid.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
#if UNITY_IPHONE
        AdmobAdIOS.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
#if UNITY_WP8
        AdmobAdWP.Instance().LoadBannerAd((int)adType, top, left, hide, extras, (int)tagForChildren);
#endif
    }