Ejemplo n.º 1
0
        /**
         * -		 *
         * -		* @Title: preloadAds
         * -		* @Description: preload ad with the type and idx
         * -		* @param @param adsType  the type of ad
         * -		* @param @param idx
         * -		* @return void
         * -		 */


        public void  preloadAds(AdsType adsType, int idx = 1)
        {
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
            GameAds_nativePreloadAds(adsType, idx);
#else
            Debug.Log("This platform does not support!");
#endif
        }
Ejemplo n.º 2
0
 public static void HideAll(AdsType type)
 {
     if (showAds)
     {
         plugin.HideAll(type);
     }
     Print($"{type} All Ads Hided");
 }
Ejemplo n.º 3
0
        /**
         *
         * @Title: hideAds
         * @Description: hide ad with the type and idx
         * @param @param adsType  the type of ad
         * @param @param idx
         * @return void
         */

        public void hideAds(AdsType adsType, int idx = 1)
        {
#if UNITY_ANDROID || UNITY_IOS
            AnySDKAds_nativeHideAds(adsType, idx);
#else
            Debug.Log("This platform does not support!");
#endif
        }
Ejemplo n.º 4
0
        /**
         *
         * @Title: showAds
         * @Description: show ad with the type and idx
         * @param @param adsType  the type of ad
         * @param @param idx
         * @return void
         */

        public void showAds(AdsType adsType, int idx = 1)
        {
#if !UNITY_EDITOR && ( UNITY_ANDROID )
            AnySDKAds_nativeShowAds(adsType, idx);
#else
            Debug.Log("This platform does not support!");
#endif
        }
Ejemplo n.º 5
0
        /**
         *
         * @Title: isAdTypeSupported
         * @Description: does the plugin support the type of ad
         * @param @param adsType
         * @param @return
         * @return boolean
         */
        public bool isAdTypeSupported(AdsType adType)
        {
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
            return(GameAds_nativeIsAdTypeSupported(adType));
#else
            Debug.Log("This platform does not support!");
            return(false);
#endif
        }
Ejemplo n.º 6
0
 public static void HandleRewarded_Video(ShopProductEntry shopProductEntry, ShopProductData shopProductData,
                                         AdsType adsType)
 {
     SushiDebug.Log("The ad was successfully shown. (Video)");
     SushiDebug.LogFormat("HandleShowResult: shopProductEntry: {0}", shopProductEntry);
     SushiDebug.LogFormat("HandleShowResult: shopProductData: {0}", shopProductData);
     // 이번 스테이지를 처음부터 새로 시작한다.
     LoadStageFromStart(stageNumber);
 }
Ejemplo n.º 7
0
        /**
         *
         * @Title: isAdTypeSupported
         * @Description: does the plugin support the type of ad
         * @param @param adsType
         * @param @return
         * @return boolean
         */
        public bool isAdTypeSupported(AdsType adType)
        {
#if UNITY_ANDROID || UNITY_IOS
            return(AnySDKAds_nativeIsAdTypeSupported(adType));
#else
            Debug.Log("This platform does not support!");
            return(false);
#endif
        }
Ejemplo n.º 8
0
        public static IAdsService Get(AdsType type)
        {
            if (adServices.ContainsKey(type))
            {
                return(adServices[type]);
            }

            return(null);
        }
Ejemplo n.º 9
0
 public static void HandleRewarded_RewardedVideo(ShopProductEntry shopProductEntry, ShopProductData shopProductData,
                                                 AdsType adsType)
 {
     SushiDebug.Log("The ad was successfully shown. (Rewarded Video)");
     SushiDebug.LogFormat("HandleShowResult: shopProductEntry: {0}", shopProductEntry);
     SushiDebug.LogFormat("HandleShowResult: shopProductData: {0}", shopProductData);
     // 체크포인트부터 이어서 플레이한다.
     // HotairBalloon.initialPositionY를 리셋하지 않으면
     // 이어서 되도록 해 놓았다.
     Bootstrap.ReloadCurrentScene();
 }
Ejemplo n.º 10
0
 public bool IsAdEnabled(AdsType type)
 {
     switch(type)
     {
         case AdsType.Banner:
         case AdsType.Interstitial:
             return (!IsAdsRemoved() || _UseInterstitialForRewardAd) && SupportAdsType[(int)type];
         case AdsType.RewardedVideo:
             return SupportAdsType[(int)type];
         case AdsType.OfferWall:
             return SupportAdsType[(int)type];
     }
     return false;
 }
Ejemplo n.º 11
0
    //---------------------------------------------------------------------------------------------------------------
    public void Show(Action callbackWatched, Action callbackNotWatched, AdsType type = DefaultPlacementID)
    {
        onAdsWatchedCallback    = callbackWatched;
        onAdsNotWatchedCallback = callbackNotWatched;
        if (!IsAvailable(type))
        {
            return;
        }

        AdsDummy.Show(type.GetDesc(), new AdsDummy.ShowOptions()
        {
            resultCallback = OnAdsWatched
        });
    }
Ejemplo n.º 12
0
    public void FetechBannerAds(AdsType type, AdSize size)
    {
        if (adsType == AdsType.BannerBottom)
        {
            position = AdPosition.Bottom;
        }
        else if (adsType == AdsType.BannerTop)
        {
            position = AdPosition.Top;
        }
        else
        {
            position = AdPosition.Bottom;
        }

        if (size == AdSize.Banner)
        {
            adSize = AdSize.Banner;
        }
        else if (size == AdSize.SmartBanner)
        {
            adSize = AdSize.SmartBanner;
        }
        else
        {
            adSize = AdSize.Banner;
        }

        bannerAds = new BannerView(AdsConfig.AdsAdmobBannerPlacement, size, position);

        if (bannerAds != null)
        {
            AdRequest request = new AdRequest.Builder().AddTestDevice("063215AC51C16009CE71243D30B7C2A1").Build();

            bannerAds.LoadAd(request);

            bannerAds.AdLoaded          += BannerAds_AdLoaded;
            bannerAds.AdFailedToLoad    += BannerAds_AdFailedToLoad;
            bannerAds.AdOpened          += BannerAds_AdOpened;
            bannerAds.AdClosing         += BannerAds_AdClosing;
            bannerAds.AdClosed          += BannerAds_AdClosed;
            bannerAds.AdLeftApplication += BannerAds_AdLeftApplication;
        }
        else
        {
            Debug.LogError("AdsManger: Banner Ads isn't, please init it");
        }
    }
    public void ShowAds(AdsType _adsType)
    {
        switch (_adsType)
        {
        case AdsType.Interstitial:
            ads.ShowInterstitialAd();
            break;

        case AdsType.Rewarded:
            ads.ShowRewadedAd();
            break;

        default:
            break;
        }
    }
Ejemplo n.º 14
0
        private unsafe void SetValue(object managedValue, AdsType adsType)
        {
            adsvalue        = new AdsValue();
            adsvalue.dwType = (int)adsType;
            switch (adsType)
            {
            case AdsType.ADSTYPE_INTEGER:
                adsvalue.generic.a = (int)managedValue;
                adsvalue.generic.b = 0;
                break;

            case AdsType.ADSTYPE_LARGE_INTEGER:
                LowInt64 = (long)managedValue;
                break;

            case AdsType.ADSTYPE_BOOLEAN:
                if ((bool)managedValue)
                {
                    LowInt64 = -1;
                }
                else
                {
                    LowInt64 = 0;
                }
                break;

            case AdsType.ADSTYPE_CASE_IGNORE_STRING:
                _pinnedHandle          = GCHandle.Alloc(managedValue, GCHandleType.Pinned);
                adsvalue.pointer.value = _pinnedHandle.AddrOfPinnedObject();
                break;

            case AdsType.ADSTYPE_PROV_SPECIFIC:
                byte[] bytes = (byte[])managedValue;
                // filling in an ADS_PROV_SPECIFIC struct.
                // 1st dword (our member a) is DWORD dwLength.
                // 2nd dword (our member b) is byte *lpValue.
                adsvalue.octetString.length = bytes.Length;
                _pinnedHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
                adsvalue.octetString.value = _pinnedHandle.AddrOfPinnedObject();
                break;

            default:
                throw new NotImplementedException(String.Format(CultureInfo.CurrentCulture, SR.DSAdsvalueTypeNYI, "0x" + Convert.ToString((int)adsType, 16)));
            }
        }
        private void SetValue(object managedValue, AdsType adsType)
        {
            this.adsvalue        = new AdsValue();
            this.adsvalue.dwType = (int)adsType;
            switch (adsType)
            {
            case AdsType.ADSTYPE_CASE_IGNORE_STRING:
                this.pinnedHandle           = GCHandle.Alloc(managedValue, GCHandleType.Pinned);
                this.adsvalue.pointer.value = this.pinnedHandle.AddrOfPinnedObject();
                return;

            case AdsType.ADSTYPE_BOOLEAN:
                if (!((bool)managedValue))
                {
                    this.LowInt64 = 0L;
                    return;
                }
                this.LowInt64 = -1L;
                return;

            case AdsType.ADSTYPE_INTEGER:
                this.adsvalue.generic.a = (int)managedValue;
                this.adsvalue.generic.b = 0;
                return;

            case AdsType.ADSTYPE_LARGE_INTEGER:
                this.LowInt64 = (long)managedValue;
                return;

            case AdsType.ADSTYPE_PROV_SPECIFIC:
            {
                byte[] buffer = (byte[])managedValue;
                this.adsvalue.octetString.length = buffer.Length;
                this.pinnedHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                this.adsvalue.octetString.value = this.pinnedHandle.AddrOfPinnedObject();
                return;
            }
            }
            throw new NotImplementedException(Res.GetString("DSAdsvalueTypeNYI", new object[] { "0x" + Convert.ToString((int)adsType, 0x10) }));
        }
Ejemplo n.º 16
0
        protected virtual void AdDownloadCallback(AdsType adType, bool result, string message)
        {
            if (mCurrentDownload == null)
            {
                if (AdsManager.Debugging)
                {
                    Debug.Log("AdDownload mCurrentDownload is null but there is still have callback");
                }
                return;
            }

            if (adType != mCurrentDownload._Type)
            {
                if (AdsManager.Debugging)
                {
                    Debug.Log("AdDownload callback type " + adType + " does not match current download type " + mCurrentDownload._Type);
                }
                return;
            }

            if (result)
            {
                if (AdsManager.Debugging)
                {
                    Debug.Log("AdDownload " + mCurrentDownload._Type + " id " + mCurrentDownload._Id + " result success");
                }
                mAdLoadState = AdsLoadState.Loaded;
            }
            else
            {
                if (AdsManager.Debugging)
                {
                    Debug.Log("AdDownload " + mCurrentDownload._Type + " id " + mCurrentDownload._Id + " result failed: " + message);
                }
                mAdLoadState = AdsLoadState.Error;
            }
            mCurrentDownload.OnAdAvailabilityUpdate(result);
            mCurrentDownload = null;
        }
Ejemplo n.º 17
0
    /// <summary>
    /// This methods shows ads, after showing - change type of monetization system
    ///
    /// </summary>
    public static void showAndSwitchAds()
    {
        switch (currentAdsType)
        {
        case AdsType.HeyzApp:
            if (isHeyzappInited)
            {
                if (HZInterstitialAd.isAvailable())
                {
                    HZInterstitialAd.show();
                    currentAdsType = AdsType.AdMob;
                }
            }
            else
            {
                Debug.LogWarning("AdsManager: init Heyzapp from showAndSwitchAds");
                initInterstitial();
            }

            break;

        case AdsType.AdMob:
            if (interstitial != null)
            {
                if (interstitial.IsLoaded())
                {
                    interstitial.Show();
                    currentAdsType = AdsType.HeyzApp;
                }
            }
            else
            {
                Debug.LogWarning("AdsManager: admob not inited. But we init this after this try");
                initInterstitial();
            }

            break;
        }
    }
Ejemplo n.º 18
0
 public void hideAds(AdsType adsType, int idx = 1)
 {
     AnySDKAds.AnySDKAds_nativeHideAds(adsType, idx);
 }
Ejemplo n.º 19
0
 protected override AdStatusHandler CreateAdHandler(AdsType type, string id)
 {
     return(new MaxAdStatusHandler(type, id));
 }
Ejemplo n.º 20
0
 public MaxAdStatusHandler(AdsType type, string id) : base(type, id)
 {
 }
Ejemplo n.º 21
0
 public AdsValueHelper(object managedValue, AdsType adsType)
 {
     SetValue(managedValue, adsType);
 }
Ejemplo n.º 22
0
 private static extern void AnySDKAds_nativePreloadAds(AdsType adsType, int idx = 1);
Ejemplo n.º 23
0
 public AdsValueHelper(object managedValue, AdsType adsType)
 {
     SetValue(managedValue, adsType);
 }
Ejemplo n.º 24
0
 private static extern bool AnySDKAds_nativeIsAdTypeSupported(AdsType adsType);
Ejemplo n.º 25
0
 private static extern bool AnySDKAds_nativeIsAdTypeSupported(AdsType adsType);
Ejemplo n.º 26
0
 /**
  *
 * @Title: isAdTypeSupported
 * @Description: does the plugin support the type of ad
 * @param @param adsType
 * @param @return
 * @return boolean
  	*/
 public bool isAdTypeSupported(AdsType adType)
 {
     #if UNITY_ANDROID ||  UNITY_IOS
     return AnySDKAds_nativeIsAdTypeSupported (adType);
     #else
     Debug.Log("This platform does not support!");
     return false;
     #endif
 }
Ejemplo n.º 27
0
 public Advertisement(string advName, string advText, AdsType advType)
 {
     this.advertisementName = advName;
     this.advertisementText = advText;
     this.type = advType;
 }
Ejemplo n.º 28
0
 private static extern bool GameAds_nativeIsAdTypeSupported(AdsType adsType);
Ejemplo n.º 29
0
 public static async Task <IAdsService> GetAsync(AdsType type)
 {
     await new WaitUntil(() => !Get(type).IsNull());
     return(Get(type));
 }
Ejemplo n.º 30
0
 /**
  *
 * @Title: showAds
 * @Description: show ad with the type and idx
 * @param @param adsType  the type of ad
 * @param @param idx
 * @return void
  	*/
 public void showAds(AdsType adsType, int idx = 1)
 {
     #if UNITY_ANDROID ||  UNITY_IOS
     AnySDKAds_nativeShowAds (adsType,idx);
     #else
     Debug.Log("This platform does not support!");
     #endif
 }
Ejemplo n.º 31
0
 private static extern void AnySDKAds_nativeHideAds(AdsType adsType, int idx = 1);
Ejemplo n.º 32
0
 private static extern void AnySDKAds_nativePreloadAds(AdsType adsType, int idx = 1);
        private void SetValue(object managedValue, AdsType adsType)
        {
            this.adsvalue = new AdsValue();
            this.adsvalue.dwType = (int) adsType;
            switch (adsType)
            {
                case AdsType.ADSTYPE_CASE_IGNORE_STRING:
                    this.pinnedHandle = GCHandle.Alloc(managedValue, GCHandleType.Pinned);
                    this.adsvalue.pointer.value = this.pinnedHandle.AddrOfPinnedObject();
                    return;

                case AdsType.ADSTYPE_BOOLEAN:
                    if (!((bool) managedValue))
                    {
                        this.LowInt64 = 0L;
                        return;
                    }
                    this.LowInt64 = -1L;
                    return;

                case AdsType.ADSTYPE_INTEGER:
                    this.adsvalue.generic.a = (int) managedValue;
                    this.adsvalue.generic.b = 0;
                    return;

                case AdsType.ADSTYPE_LARGE_INTEGER:
                    this.LowInt64 = (long) managedValue;
                    return;

                case AdsType.ADSTYPE_PROV_SPECIFIC:
                {
                    byte[] buffer = (byte[]) managedValue;
                    this.adsvalue.octetString.length = buffer.Length;
                    this.pinnedHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
                    this.adsvalue.octetString.value = this.pinnedHandle.AddrOfPinnedObject();
                    return;
                }
            }
            throw new NotImplementedException(Res.GetString("DSAdsvalueTypeNYI", new object[] { "0x" + Convert.ToString((int) adsType, 0x10) }));
        }
Ejemplo n.º 34
0
 public bool isAdTypeSupported(AdsType adType)
 {
     return(AnySDKAds.AnySDKAds_nativeIsAdTypeSupported(adType));
 }
Ejemplo n.º 35
0
 public void preloadAds(AdsType adsType, int idx = 1)
 {
     AnySDKAds.AnySDKAds_nativePreloadAds(adsType, idx);
 }
Ejemplo n.º 36
0
        public AdsValueHelper(object managedValue)
        {
            AdsType adsType = GetAdsTypeForManagedType(managedValue.GetType());

            SetValue(managedValue, adsType);
        }
Ejemplo n.º 37
0
 private unsafe void SetValue(object managedValue, AdsType adsType)
 {
     adsvalue = new AdsValue();
     adsvalue.dwType = (int)adsType;
     switch (adsType)
     {
         case AdsType.ADSTYPE_INTEGER:
             adsvalue.generic.a = (int)managedValue;
             adsvalue.generic.b = 0;
             break;
         case AdsType.ADSTYPE_LARGE_INTEGER:
             LowInt64 = (long)managedValue;
             break;
         case AdsType.ADSTYPE_BOOLEAN:
             if ((bool)managedValue)
                 LowInt64 = -1;
             else
                 LowInt64 = 0;
             break;
         case AdsType.ADSTYPE_CASE_IGNORE_STRING:
             _pinnedHandle = GCHandle.Alloc(managedValue, GCHandleType.Pinned);
             adsvalue.pointer.value = _pinnedHandle.AddrOfPinnedObject();
             break;
         case AdsType.ADSTYPE_PROV_SPECIFIC:
             byte[] bytes = (byte[])managedValue;
             // filling in an ADS_PROV_SPECIFIC struct.
             // 1st dword (our member a) is DWORD dwLength.
             // 2nd dword (our member b) is byte *lpValue.
             adsvalue.octetString.length = bytes.Length;
             _pinnedHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
             adsvalue.octetString.value = _pinnedHandle.AddrOfPinnedObject();
             break;
         default:
             throw new NotImplementedException(Res.GetString(Res.DSAdsvalueTypeNYI, "0x" + Convert.ToString((int)adsType, 16)));
     }
 }
Ejemplo n.º 38
0
 private static extern void GameAds_nativeShowAds(AdsType adsType, int idx = 1);
Ejemplo n.º 39
0
 private static extern void AnySDKAds_nativeShowAds(AdsType adsType, int idx = 1);