/// <summary>
 /// Log warning messages when verbose logging is enabled.
 ///
 /// Verbose logging can be enabled by calling <see cref="MaxSdk.SetVerboseLogging"/> or via the Integration Manager for build time logs.
 /// </summary>
 public static void W(string message)
 {
     if (MaxSdk.IsVerboseLoggingEnabled())
     {
         Debug.LogWarning("Warning [" + SdkTag + "] " + message);
     }
 }
 /// <summary>
 /// Log error messages when verbose logging is enabled.
 ///
 /// Verbose logging can be enabled by calling <see cref="MaxSdk.SetVerboseLogging"/> or via the Integration Manager for build time logs.
 /// </summary>
 public static void E(string message)
 {
     if (MaxSdk.IsVerboseLoggingEnabled())
     {
         Debug.LogError("Error [" + SdkTag + "] " + message);
     }
 }
        public override void Init(object[] parameters)
        {
            mConfig = ((BaseAdapterConfig)parameters[0]);
            Config  = mConfig;// (AppLovinAdapterConfig)mConfig;

            MaxSdkCallbacks.OnBannerAdLoadedEvent     += HandleOnBannerAdLoadedEvent;
            MaxSdkCallbacks.OnBannerAdLoadFailedEvent += HandleOnBannerAdLoadFailedEvent;
            MaxSdkCallbacks.OnBannerAdClickedEvent    += HandleOnBannerAdClickedEvent;

            MaxSdkCallbacks.OnInterstitialLoadedEvent            += HandleOnInterstitialLoadedEvent;
            MaxSdkCallbacks.OnInterstitialLoadFailedEvent        += HandleOnInterstitialLoadFailedEvent;
            MaxSdkCallbacks.OnInterstitialAdFailedToDisplayEvent += HandleOnInterstitialAdFailedToDisplayEvent;
            MaxSdkCallbacks.OnInterstitialHiddenEvent            += HandleOnInterstitialHiddenEvent;
            MaxSdkCallbacks.OnInterstitialDisplayedEvent         += HandleOnInterstitialDisplayedEvent;
            MaxSdkCallbacks.OnInterstitialClickedEvent           += HandleOnInterstitialClickedEvent;

            MaxSdkCallbacks.OnRewardedAdLoadedEvent          += HandleOnRewardedAdLoadedEvent;
            MaxSdkCallbacks.OnRewardedAdLoadFailedEvent      += HandleOnRewardedAdLoadFailedEvent;
            MaxSdkCallbacks.OnRewardedAdFailedToDisplayEvent += HandleOnRewardedAdFailedToDisplayEvent;
            MaxSdkCallbacks.OnRewardedAdDisplayedEvent       += HandleOnRewardedAdDisplayedEvent;
            MaxSdkCallbacks.OnRewardedAdClickedEvent         += HandleOnRewardedAdClickedEvent;
            MaxSdkCallbacks.OnRewardedAdHiddenEvent          += HandleOnRewardedAdHiddenEvent;
            MaxSdkCallbacks.OnRewardedAdReceivedRewardEvent  += HandleOnRewardedAdReceivedRewardEvent;

            var cacheParameters = parameters;

            MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {
                //MaxSdk.ShowMediationDebugger();
                MaxSdk.SetMuted(mIsMuted);
                base.Init(cacheParameters);
            };

            MaxSdk.SetSdkKey(Config.Platform.ApplovingSDKKey);
            MaxSdk.InitializeSdk();
        }
Exemplo n.º 4
0
 public void HideBanner(bool hide)
 {
     if (this._isEnableBanner == true)
     {
         if (this.IsAdsShow())
         {
             this._bannerHide = hide;
             if (hide == true)
             {
                 MaxSdk.HideBanner(this.GetBannerKey());
             }
             else
             {
                 MaxSdk.ShowBanner(this.GetBannerKey());
             }
             this.iBanner.gameObject.SetActive(!hide);
         }
         else
         {
             MaxSdk.HideBanner(this.GetBannerKey());
             this.iBanner.gameObject.SetActive(false);
         }
     }
     else
     {
         this.ycManager.ycConfig.LogWarning("[Ads] not init");
     }
 }
Exemplo n.º 5
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        MaxSdkCallbacks.OnSdkInitializedEvent += (SdkConfiguration sdkConfiguration) => {
            if (sdkConfiguration.ConsentDialogState == MaxSdkBase.ConsentDialogState.Applies)
            {
                MaxSdk.SetHasUserConsent(false);
            }
            else if (sdkConfiguration.ConsentDialogState == MaxSdkBase.ConsentDialogState.DoesNotApply)
            {
                // No need to show consent dialog, proceed with initialization
            }
            else
            {
                // Consent dialog state is unknown. Proceed with initialization, but check if the consent
                // dialog should be shown on the next application initialization
            }

            // AppLovin SDK is initialized, configure and start loading ads.
            MaxSdk.ShowMediationDebugger();
        };


        MaxSdk.SetSdkKey("W-sOyxtIUM_SnkZdrA6as0fDUylIazyI401izbxa_Mhq6E4yWtMl6-4zBiOVwACtfq-NVqcVXHiS41RxmATPp_");
        MaxSdk.InitializeSdk();
    }
Exemplo n.º 6
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }
        DontDestroyOnLoad(gameObject);


        MaxSdkCallbacks.OnSdkInitializedEvent += sdkConfiguration =>
        {
            // AppLovin SDK is initialized, configure and start loading ads.
            Debug.Log("MAX SDK Initialized");



            /*;W
             * InitializeRewardedInterstitialAds();
             * InitializeBannerAds();
             * InitializeMRecAds();*/
            // MaxSdk.ShowMediationDebugger();
        };


        Debug.Log("SetSDKKey");
        MaxSdk.SetSdkKey(MaxSdkKey);
        MaxSdk.InitializeSdk();
    }
 public override bool ShowAdsReward(Action <bool> callback, string adId = null)
 {
     if (string.IsNullOrEmpty(adId))
     {
         for (int i = 0; i < mDefaultRewardAdList.Count; ++i)
         {
             if (mDefaultRewardAdList[i]._Available)
             {
                 adId = mDefaultRewardAdList[i]._Id;
                 break;
             }
         }
     }
     if (string.IsNullOrEmpty(adId))
     {
         return(false);
     }
     if (!MaxSdk.IsRewardedAdReady(adId))
     {
         return(false);
     }
     base.ShowAdsReward(callback);
     mCurrentFullscreenAd = mAdDownloadHandler[adId];
     MaxSdk.ShowRewardedAd(adId);
     return(true);
 }
Exemplo n.º 8
0
 public void ShowInterstitialAd(string interstitialAdUnitId)
 {
     if (MaxSdk.IsInterstitialReady(interstitialAdUnitId))
     {
         MaxSdk.ShowInterstitial(interstitialAdUnitId);
     }
 }
Exemplo n.º 9
0
            protected override void Awake()
            {
                base.Awake();
                this.bRemoveAds.onClick.AddListener(() => {
                    this.ycManager.inAppManager.BuyProductIDAdsRemove();
                });
                this.iBanner.gameObject.SetActive(false);
                this.iInterstitial.gameObject.SetActive(false);
                if (this.GetInterstitialKey() != "" || this.GetRewardedKey() != "" || this.GetBannerKey() != "")
                {
                    MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {
                        if (sdkConfiguration.ConsentDialogState == MaxSdkBase.ConsentDialogState.Applies)
                        {
                            this._hasDataPrivacy = true;
                            if (this.ycManager.dataManager.GetGdprValidate() == false)
                            {
                                this.InitAds();
                                this.DisplayGDPR();
                            }
                            else
                            {
                                this.InitConsentAndAds();
                            }
                        }
                        else if (sdkConfiguration.ConsentDialogState == MaxSdkBase.ConsentDialogState.DoesNotApply)
                        {
                            this.InitConsentAndAds();
                        }
                        else
                        {
#if UNITY_EDITOR
                            this._hasDataPrivacy = true;
                            if (this.ycManager.dataManager.GetGdprValidate() == false)
                            {
                                this.InitAds();
                                this.DisplayGDPR();
                            }
                            else
                            {
                                this.InitConsentAndAds();
                            }
#else
                            this.InitConsentAndAds();
#endif
                        }
                    };
                    MaxSdk.SetSdkKey(SDK_KEY);
                    MaxSdk.InitializeSdk();
                }
                else
                {
                    if (this.ycManager.ycConfig.MaxForceInit)
                    {
                        MaxSdk.SetSdkKey(SDK_KEY);
                        MaxSdk.InitializeSdk();
                    }
                    this.ycManager.ycConfig.LogWarning("[Ads] not init");
                }
            }
Exemplo n.º 10
0
            public bool IsRewardBasedVideo()
            {
#if UNITY_EDITOR
                return(true);
#else
                return(this._isEnableRewarded == true && MaxSdk.IsRewardedAdReady(this.GetRewardedKey()));
#endif
            }
 public void PlayReviveRewardedAd()
 {
     if (MaxSdk.IsRewardedAdReady(ReviveRewardedAdUnitId))
     {
         AudioManager.instance.MuteSoundsUnsaved();
         MaxSdk.ShowRewardedAd(ReviveRewardedAdUnitId);
     }
 }
Exemplo n.º 12
0
    public void LetsGo()
    {
        RemoteDelayTime = 3000;
        RemoteMinLevel  = 0;

        DontDestroyOnLoad(this.gameObject);

        Debug.Log("AdsManager_A is ready.");
        MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) =>
        {
            if (sdkState == SdkState.Integration)
            {
                return;
            }
            // AppLovin SDK is initialized, start loading ads
            InitializeRewardedAds();

            InitializeInterstitialAds();
            InitializeBannerAds();


            if (sdkState == SdkState.Test)
            {
                MaxSdk.ShowMediationDebugger();
            }
        };

        if (Application.internetReachability != NetworkReachability.NotReachable)
        {
            MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration config) => {
                // Get value of a variable to use variableValue to alter your business logic
                var interstitial_timer = MaxSdk.VariableService.GetString("interstitial_timer", "0");
                //RemoteDelayTime = int.Parse(interstitial_delay);
                RemoteDelayTime             = Convert.ToInt32(interstitial_timer);
                GameConst.kacsaniyedeReklam = (int)RemoteDelayTime;
                Debug.Log("interstitial_delay" + RemoteDelayTime);

                var min_level = MaxSdk.VariableService.GetString("min_level_interstitial", "0");
                //  RemoteMinLevel = int.Parse(min_level);
                RemoteMinLevel = Convert.ToInt32(min_level);
                Debug.Log("min_level" + RemoteMinLevel);


                var character_prize = MaxSdk.VariableService.GetString("skin_popup_freq", "0");
                var character       = Convert.ToInt32(character_prize);
                SlugAnalytics.ABTestCharacter(Convert.ToInt32(character_prize));
                SlugAnalytics.ABTestAds((int)RemoteDelayTime);

                GameConst.kacOyundaKarakter = Convert.ToInt32(character_prize);

                //GameObject.Find("TestText").GetComponent<Text>().text = RemoteDelayTime + "_" + RemoteMinLevel + "_" + character;
            };
        }

        MaxSdk.SetSdkKey(sdkKey);
        MaxSdk.InitializeSdk();
    }
    private void InitializeBannerAds()
    {
        // Banners are automatically sized to 320x50 on phones and 728x90 on tablets.
        // You may use the utility method `MaxSdkUtils.isTablet()` to help with view sizing adjustments.
        MaxSdk.CreateBanner(BannerAdUnitId, MaxSdkBase.BannerPosition.TopCenter);

        // Set background or background color for banners to be fully functional.
        MaxSdk.SetBannerBackgroundColor(BannerAdUnitId, Color.black);
    }
Exemplo n.º 14
0
 public override void HideAdsBanner()
 {
     if (mDefaultBannerAdList.Count <= 0 || !mDefaultBannerAdList[0]._Available)
     {
         return;
     }
     base.HideAdsBanner();
     MaxSdk.HideBanner(mDefaultBannerAdList[0]._Id);
 }
Exemplo n.º 15
0
 private void InitializeBannerAds()
 {
     if (this.GetBannerKey() != "")
     {
         this._isEnableBanner = true;
         MaxSdk.CreateBanner(this.GetBannerKey(), MaxSdkBase.BannerPosition.BottomCenter);
         this.HideBanner(false);
     }
 }
Exemplo n.º 16
0
 public void ShowRewardAd(string rewardedAdUnitId, Action <bool> Callback)
 {
     getReward  = false;
     AdCallback = Callback;
     if (MaxSdk.IsRewardedAdReady(rewardedAdUnitId))
     {
         MaxSdk.ShowRewardedAd(rewardedAdUnitId);
     }
 }
Exemplo n.º 17
0
    string bannerAdUnitId = "c902bb7f304b8cf8"; // Retrieve the id from your account
#endif
    public void InitializeBannerAds()
    {
        // Banners are automatically sized to 320x50 on phones and 728x90 on tablets
        // You may use the utility method `MaxSdkUtils.isTablet()` to help with view sizing adjustments
        MaxSdk.CreateBanner(bannerAdUnitId, MaxSdkBase.BannerPosition.BottomCenter);

        // Set background or background color for banners to be fully functional
        MaxSdk.SetBannerBackgroundColor(bannerAdUnitId, Color.white);
        MaxSdk.ShowBanner(bannerAdUnitId);
    }
 public void PlayReviveRewardedAd()
 {
     if (MaxSdk.IsRewardedAdReady(ReviveRewardedAdUnitId))
     {
         MaxSdk.ShowRewardedAd(ReviveRewardedAdUnitId);
         if (PlayerPrefs.GetString("muteMusic", "false") == "false")
         {
             AudioManager.instance.MuteSoundsUnsaved();
         }
     }
 }
Exemplo n.º 19
0
 public AnalyticsManager.AdData OnAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
 {
     AnalyticsManager.AdData adData = new AnalyticsManager.AdData();
     adData.revenue           = (float)adInfo.Revenue;
     adData.country_code      = MaxSdk.GetSdkConfiguration().CountryCode;
     adData.network_name      = adInfo.NetworkName;
     adData.network_placement = adInfo.NetworkPlacement;
     adData.placement         = adInfo.Placement;
     adData.ad_unit_id        = adInfo.AdUnitIdentifier;
     adData.creative_id       = adInfo.CreativeIdentifier;
     return(adData);
 }
 void ShowInterstitial()
 {
     if (MaxSdk.IsInterstitialReady(InterstitialAdUnitId))
     {
         interstitialStatusText.text = "Showing";
         MaxSdk.ShowInterstitial(InterstitialAdUnitId);
     }
     else
     {
         interstitialStatusText.text = "Ad not ready";
     }
 }
Exemplo n.º 21
0
            public bool IsInterstitial(bool force = false)
            {
                bool cond = this._canDisplayInterstitial && this.IsAdsShow() && this._isEnableInterstitial && (this._delayInterstitial <= 0f || force == true) && this.ycManager.rateManager.IsShow() == false;

#if !UNITY_EDITOR
                if (cond)
                {
                    return(MaxSdk.IsInterstitialReady(this.GetInterstitialKey()));
                }
#endif
                return(cond);
            }
Exemplo n.º 22
0
 //Plays an interstitial ad
 public void PlayInterstitialAd()
 {
     if (MaxSdk.IsInterstitialReady(InterstitialAdUnitId))
     {
         MaxSdk.ShowInterstitial(InterstitialAdUnitId);
         if (PlayerPrefs.GetString("muteMusic", "false") == "false")
         {
             AudioManager.instance.MuteSoundsUnsaved();
         }
     }
     //  LoadInterstitial();
 }
 private void ShowRewardedAd()
 {
     if (MaxSdk.IsRewardedAdReady(RewardedAdUnitId))
     {
         rewardedStatusText.text = "Showing";
         MaxSdk.ShowRewardedAd(RewardedAdUnitId);
     }
     else
     {
         rewardedStatusText.text = "Ad not ready";
     }
 }
 public void PlayGiftRewardedAd()
 {
     if (MaxSdk.IsRewardedAdReady(RewardedAdUnitId))
     {
         MaxSdk.ShowRewardedAd(RewardedAdUnitId);
         Analytics.CustomEvent("Gift Ad Watched");
         if (PlayerPrefs.GetString("muteMusic", "false") == "false")
         {
             AudioManager.instance.MuteSoundsUnsaved();
         }
     }
 }
Exemplo n.º 25
0
 public void ApplovinMaxShowRewardedAd()
 {
     Debug.Log("Showing ApplovinMax Rewarded Ad");
     if (MaxSdk.IsRewardedAdReady(maxAdUnitId))
     {
         MaxSdk.ShowRewardedAd(maxAdUnitId, "Dynamic Placement");
     }
     else
     {
         Debug.Log("unity-script: MaxSdk.isRewardedAdReady - False");
     }
 }
Exemplo n.º 26
0
 public bool ShowRewarded(Action <bool> action)
 {
     this.aRewarded = action;
     if (this.IsRewardBasedVideo())
     {
         this.ycManager.soundManager.PauseMusic();
         this._finishRewarded = false;
         MaxSdk.ShowRewardedAd(this.GetRewardedKey());
         return(true);
     }
     action(false);
     return(false);
 }
Exemplo n.º 27
0
    public void ConfigureApplovinMaxAds()
    {
        MaxSdk.SetVerboseLogging(true);

        MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {
            // AppLovin SDK is initialized, start loading ads
            InitializeMaxRewardedAds();
        };

        MaxSdk.SetSdkKey("Li1cCmO-P7mxhdd9Nnqr2ChbmAfGkysfV1qbGLwse-2G1OtyCwCSe3chc2RwZ1PZTeeb4KBFbrnNtrZdbmnS5p");
        //MaxSdk.SetUserId(DDNA.Instance.UserID);
        MaxSdk.InitializeSdk();
    }
Exemplo n.º 28
0
    private IEnumerator CheckInterstitial()
    {
        while (true)
        {
            MaxSdk.LoadInterstitial(interstitialAdUnitId);
            yield return(new WaitForSeconds(2f));

            if (MaxSdk.IsInterstitialReady(interstitialAdUnitId))
            {
                break;
            }
        }
    }
Exemplo n.º 29
0
        protected override void InternalLoadRewardedAd(AdPlacement placement)
        {
#if EM_APPLOVIN
            string id = placement == AdPlacement.Default ?
                        mAdSettings.DefaultRewardedAdId.Id :
                        FindIdForPlacement(mAdSettings.CustomRewardedAdIds, placement);
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            MaxSdk.LoadRewardedAd(id);
#endif
        }
Exemplo n.º 30
0
        protected override void InternalShowInterstitialAd(AdPlacement placement)
        {
#if EM_APPLOVIN
            string id = placement == AdPlacement.Default ?
                        mAdSettings.DefaultInterstitialAdId.Id :
                        FindIdForPlacement(mAdSettings.CustomInterstitialAdIds, placement);
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            MaxSdk.ShowInterstitial(id);
            currentShowingInterstitial = placement;
#endif
        }