Example #1
0
 // Plays an ad with the given options. The user option is only supported for incentivized ads.
 public static void playAd(bool incentivized = false, string user = "", VungleAdOrientation orientation = VungleAdOrientation.All)
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         _vunglePlayAdWithOptions(incentivized, (int)orientation, user);
     }
 }
Example #2
0
    // Sets the allowed orientations of any ads that are displayed
    public static void setAdOrientation(VungleAdOrientation orientation)
    {
        if (Application.platform != RuntimePlatform.Android)
        {
            return;
        }

        _plugin.Call("setAdOrientation", (int)orientation);
    }
 // Sets the allowed orientations of any ads that are displayed
 public void setAdOrientation(VungleAdOrientation orientation)
 {
     this.orientation = orientation;
 }
 // Sets the allowed orientations of any ads that are displayed
 public static void setAdOrientation(VungleAdOrientation orientation)
 {
     _orientation = orientation;
 }
Example #5
0
        protected override void InternalInit()
        {
            mAdSettings = EM_Settings.Advertising.VungleAds;
#if EM_VUNGLE
            if (mAdSettings.UseAdvancedSetting)
            {
                options = new Dictionary <string, object>();
                VungleAdOrientation orientation = VungleAdOrientation.All;
                switch (mAdSettings.AdvancedSettings.adOrientation)
                {
                case VungleSettings.VungleAdvancedSettings.AdOrientation.Portrait:
                    orientation = VungleAdOrientation.Portrait;
                    break;

#if UNITY_IOS
                case VungleSettings.VungleAdvancedSettings.AdOrientation.LandscapeLeft:
                    orientation = VungleAdOrientation.LandscapeLeft;
                    break;

                case VungleSettings.VungleAdvancedSettings.AdOrientation.LandscapeRight:
                    orientation = VungleAdOrientation.LandscapeRight;
                    break;

                case VungleSettings.VungleAdvancedSettings.AdOrientation.PortraitUpsideDown:
                    orientation = VungleAdOrientation.PortraitUpsideDown;
                    break;
#endif
                case VungleSettings.VungleAdvancedSettings.AdOrientation.Landscape:
                    orientation = VungleAdOrientation.Landscape;
                    break;

                case VungleSettings.VungleAdvancedSettings.AdOrientation.All:
                    orientation = VungleAdOrientation.All;
                    break;

#if UNITY_IOS
                case VungleSettings.VungleAdvancedSettings.AdOrientation.AllButUpsideDown:
                    orientation = VungleAdOrientation.AllButUpsideDown;
                    break;
#endif
#if UNITY_ANDROID
                case VungleSettings.VungleAdvancedSettings.AdOrientation.MatchVideo:
                    orientation = VungleAdOrientation.MatchVideo;
                    break;
#endif
                }
                options.Add("orientation", orientation);
                options.Add("alertTitle", mAdSettings.AdvancedSettings.prematureAdClosePopup.alertTitle);
                options.Add("alertText", mAdSettings.AdvancedSettings.prematureAdClosePopup.alertText);
                options.Add("closeText", mAdSettings.AdvancedSettings.prematureAdClosePopup.closeText);
                options.Add("continueText", mAdSettings.AdvancedSettings.prematureAdClosePopup.continueText);
            }
#endif
            customBannerPlacementDict       = new Dictionary <AdPlacement, VungleBannerAd>();
            customRewardedPlacementDict     = new Dictionary <AdPlacement, VungleRewardedAd>();
            customInterstitialPlacementDict = new Dictionary <AdPlacement, VungleInterstitialAd>();

            foreach (var keyPair in mAdSettings.CustomBannerAdIds)
            {
                if (customBannerPlacementDict.ContainsKey(keyPair.Key))
                {
                    continue;
                }
                customBannerPlacementDict.Add(keyPair.Key, new VungleBannerAd(keyPair.Value, keyPair.Key));
            }
            foreach (var keyPair in mAdSettings.CustomInterstitialAdIds)
            {
                if (customInterstitialPlacementDict.ContainsKey(keyPair.Key))
                {
                    continue;
                }
                customInterstitialPlacementDict.Add(keyPair.Key, new VungleInterstitialAd(keyPair.Value, keyPair.Key, options));
            }
            foreach (var keyPair in mAdSettings.CustomRewardedAdIds)
            {
                if (customRewardedPlacementDict.ContainsKey(keyPair.Key))
                {
                    continue;
                }
                customRewardedPlacementDict.Add(keyPair.Key, new VungleRewardedAd(keyPair.Value, keyPair.Key, options));
            }
            defaultInterstitial = new VungleInterstitialAd(mAdSettings.DefaultInterstitialAdId, AdPlacement.Default, options);
            defaultRewarded     = new VungleRewardedAd(mAdSettings.DefaultRewardedAdId, AdPlacement.Default, options);
            defaultBanner       = new VungleBannerAd(mAdSettings.DefaultBannerAdId, AdPlacement.Default);

#if EM_VUNGLE
            Vungle.onInitializeEvent += OnInitialized;
            Vungle.onAdStartedEvent  += OnAdStarted;
            Vungle.onAdFinishedEvent += OnAdFinished;
            Vungle.adPlayableEvent   += OnAdPlayableEvent;

            if (mAdSettings.UseAdvancedSetting)
            {
                Vungle.setSoundEnabled(mAdSettings.AdvancedSettings.enableAdSound);

                Vungle.SetMinimumDiskSpaceForInitialization(mAdSettings.AdvancedSettings.minimumDiskSpaceForInitialization);
                Vungle.SetMinimumDiskSpaceForAd(mAdSettings.AdvancedSettings.minimumDiskSpaceForAds);

                Vungle.EnableHardwareIdPrivacy(mAdSettings.AdvancedSettings.disableHardwareId);
            }

            GameObject appStateHandler = new GameObject("VungleAppstateHandler");
            appStateHandler.hideFlags = HideFlags.HideAndDontSave;
            appStateHandler.AddComponent <AppStateHandler>();

            Vungle.init(mAdSettings.AppId.Id);
#endif
            ApplyDataPrivacyConsent(GetApplicableDataPrivacyConsent());
        }
	// Plays an ad with the given options. The user option is only supported for incentivized ads.
	public static void playAd( bool incentivized = false, string user = "", VungleAdOrientation orientation = VungleAdOrientation.All )
	{
		if( Application.platform == RuntimePlatform.IPhonePlayer )
			_vunglePlayAdWithOptions( incentivized, (int)orientation, user );
	}
	// Sets the allowed orientations of any ads that are displayed
	public static void setAdOrientation( VungleAdOrientation orientation )
	{
		_orientation = orientation;
	}
Example #8
0
	// Sets the allowed orientations of any ads that are displayed
	public static void setAdOrientation( VungleAdOrientation orientation )
	{
		if( Application.platform != RuntimePlatform.Android )
			return;

		_plugin.Call( "setAdOrientation", (int)orientation );
	}
Example #9
0
 // Sets the allowed orientations of any ads that are displayed
 public void setAdOrientation(VungleAdOrientation orientation)
 {
     plugin.Call("setAdOrientation", (int)orientation);
 }