Example #1
0
    private static int show(string spotid, AdType adType, Rect adRect, IMobileIconParams iconParams, bool sizeAdjust, IMobileNativeAdParams adParams)
    {
        int adViewId = IMobileAdViewIdManager.CreateId();

                #if !UNITY_EDITOR
        iconParams = iconParams ?? new IMobileIconParams();
        string partnerId = IMobileSpotInfoManager.GetPartnerId(spotid);
        string mediaId   = IMobileSpotInfoManager.GetMediaId(spotid);
        bool   isIcon    = adType == AdType.ICON;
                #endif

                #if UNITY_IPHONE && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            string[] parameters =
            {
                partnerId,
                mediaId,
                spotid,
                adRect.x.ToString(),
                adRect.y.ToString(),
                adRect.width.ToString(),
                adRect.height.ToString(),
                sizeAdjust.ToString(),
                adViewId.ToString()
            };

            string paramStr = string.Join(":", parameters);
            imobileShowBySpotIDWithPosition_(paramStr);
        }
                #elif UNITY_ANDROID && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.Android)
        {
            imobileSdkAdsAndroidPlugin.CallStatic("show", partnerId, mediaId, spotid, (int)adRect.x, (int)adRect.y,
                                                  iconParams.iconNumber,
                                                  iconParams.iconViewLayoutWidth,
                                                  iconParams.iconSize,
                                                  iconParams.iconTitleEnable,
                                                  iconParams.iconTitleFontSize,
                                                  iconParams.iconTitleFontColor,
                                                  iconParams.iconTitleOffset,
                                                  iconParams.iconTitleShadowEnable,
                                                  iconParams.iconTitleShadowColor,
                                                  iconParams.iconTitleShadowDx,
                                                  iconParams.iconTitleShadowDy,
                                                  isIcon,
                                                  sizeAdjust,
                                                  adViewId
                                                  );
        }
#endif


        return(adViewId);
    }
    private static int show(string spotid, AdType adType, Rect adRect, IMobileIconParams iconParams)
    {
        iconParams = iconParams ?? new IMobileIconParams();
        string partnerId = IMobileSpotInfoManager.GetPartnerId(spotid);
        string mediaId   = IMobileSpotInfoManager.GetMediaId(spotid);
        int    adViewId  = IMobileAdViewIdManager.createId();

                #if UNITY_IPHONE
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            imobileShowBySpotIDWithPositionAndIconParams_(spotid,
                                                          partnerId,
                                                          mediaId,
                                                          (int)adRect.x,
                                                          (int)adRect.y,
                                                          (int)adRect.width,
                                                          (int)adRect.height,
                                                          iconParams.iconNumber,
                                                          iconParams.iconViewLayoutWidth,
                                                          iconParams.iconSize,
                                                          iconParams.iconTitleEnable,
                                                          iconParams.iconTitleFontSize,
                                                          iconParams.iconTitleFontColor,
                                                          iconParams.iconTitleOffset,
                                                          iconParams.iconTitleShadowEnable,
                                                          iconParams.iconTitleShadowColor,
                                                          iconParams.iconTitleShadowDx,
                                                          iconParams.iconTitleShadowDy,
                                                          adViewId);
        }
                #elif UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            imobileSdkAdsAndroidPlugin.CallStatic("show", partnerId, mediaId, spotid, adViewId, (int)adRect.x, (int)adRect.y,
                                                  iconParams.iconNumber,
                                                  iconParams.iconViewLayoutWidth,
                                                  iconParams.iconSize,
                                                  iconParams.iconTitleEnable,
                                                  iconParams.iconTitleFontSize,
                                                  iconParams.iconTitleFontColor,
                                                  iconParams.iconTitleOffset,
                                                  iconParams.iconTitleShadowEnable,
                                                  iconParams.iconTitleShadowColor,
                                                  iconParams.iconTitleShadowDx,
                                                  iconParams.iconTitleShadowDy
                                                  );
        }
                #endif


        return(adViewId);
    }
Example #3
0
    /// <summary>
    /// ネイティブ広告の取得を行います
    /// </summary>
    /// <param name="spotId">スポットID</param>
    /// <param name="adParams">ネイティブ広告取得時のパラメータ</param>
    /// <param name="callBack">広告取得完了に実行されます</param>
    /// <param name="dontDestroyReciever">シーン間で広告を引き継ぐ際にTrueを指定します</param>
    /// <param name="adViewId">(省略可能)adViewIdを既に取得している場合、それを指定できます</param>
    public static int getNativeAdData(string spotId, IMobileNativeAdParams adParams, Action <IMobileNativeAdObject[]> callBack, bool dontDestroyReciever = false)
    {
        int adViewId = IMobileAdViewIdManager.CreateId();

                #if !UNITY_EDITOR
        string partnerId = IMobileSpotInfoManager.GetPartnerId(spotId);
        string mediaId   = IMobileSpotInfoManager.GetMediaId(spotId);
        string recieverGameObjectName = IMobileNativeAdRecieverManager.CreateNativeAdReciever(adViewId, callBack, dontDestroyReciever);
                #endif

                #if UNITY_IPHONE && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            string[] parameters =
            {
                partnerId,
                mediaId,
                spotId,
                adParams.requestAdCount.ToString(),
                adParams.nativeImageGetFlag.ToString(),
                recieverGameObjectName,
                adViewId.ToString()
            };

            string paramStr = string.Join(":", parameters);
            imobileGetNativeAdDataAndNativeAdParams_(paramStr);
        }
                #elif UNITY_ANDROID && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.Android)
        {
            imobileSdkAdsAndroidPlugin.CallStatic(
                "getNativeAdData",
                partnerId,
                mediaId,
                spotId,
                adParams.requestAdCount,
                adParams.nativeImageGetFlag,
                recieverGameObjectName
                );
        }
                #endif
        return(adViewId);
    }