// Obtem o video
    public override void fetchVideo(bool force)
    {
        try
        {
            if (!force && tried_fetching_video)
            {
                return;
            }

            base.fetchVideo(force);

            if (Info.IsEditor())
            {
                return;
            }

                        #if UNITY_ANDROID
            Initializate.AddPrefab("VungleAndroidManager", typeof(VungleAndroidManager));

            VungleAndroid.init(key);
                        #elif UNITY_IPHONE
            Initializate.AddPrefab("VungleManager", typeof(VungleManager));

            VungleBinding.startWithAppId(key);
                        #endif
        }
        catch
        {
            Error(API, ERROR_STARTUP_OBJECT);
        }
    }
    // Mostra o video
    public override bool showVideo(VideoDelegate methodToCall)
    {
        if (!isVideoAvailable())
        {
            return(false);
        }

        try
        {
            if (Info.IsEditor())
            {
                return(false);
            }

#if UNITY_ANDROID
            callback = methodToCall;
            VungleAndroid.displayIncentivizedAdvert(false);
            return(true);
#elif UNITY_IPHONE
            callback = methodToCall;
            VungleBinding.playIncentivizedAd("user", false);
            return(true);
#else
            return(false);
#endif
        }
        catch
        {
            return(Error(API, ERROR_PLAY_VIDEO));
        }
    }
Beispiel #3
0
 // Clear sleep
 public static void clearSleep()
 {
             #if UNITY_IPHONE
     VungleBinding.clearSleep();
             #elif UNITY_ANDROID
             #else
             #endif
 }
Beispiel #4
0
    // Displays an incentivized advert with optional name
    public static void displayIncentivizedAdvert(bool showCloseButton, string user)
    {
#if UNITY_IPHONE
        VungleBinding.playIncentivizedAd(user, showCloseButton);
#elif UNITY_ANDROID
        VungleAndroid.displayIncentivizedAdvert(showCloseButton, user);
#endif
    }
Beispiel #5
0
    // Sets if sound should be enabled or not
    public static void setSoundEnabled(bool isEnabled)
    {
#if UNITY_IPHONE
        VungleBinding.setSoundEnabled(isEnabled);
#elif UNITY_ANDROID
        VungleAndroid.setSoundEnabled(isEnabled);
#endif
    }
Beispiel #6
0
    // Displays an advert
    public static void displayAdvert(bool showCloseButtonOnIOS)
    {
#if UNITY_IPHONE
        VungleBinding.playModalAd(showCloseButtonOnIOS);
#elif UNITY_ANDROID
        VungleAndroid.displayAdvert();
#endif
    }
Beispiel #7
0
 public static void setLogEnable(bool enable)
 {
             #if UNITY_IPHONE
     VungleBinding.enableLogging(enable);
             #elif UNITY_ANDROID
             #else
     return;
             #endif
 }
Beispiel #8
0
 public static void setEndPoint(string endPoint)
 {
             #if UNITY_IPHONE
     VungleBinding.setEndPoint(endPoint);
             #elif UNITY_ANDROID
             #else
     return;
             #endif
 }
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Start"))
        {
            // replace with your app ID!!!
            VungleBinding.startWithAppId("vungleTest");
        }


        if (GUILayout.Button("Start with Custom User Data"))
        {
            var userData = new Dictionary <string, object>();
            userData["gender"]          = 1;    // 0 unknown, 1 male, 2 female
            userData["adOrientation"]   = 1;    // 0 unknown, 1 portrait, 2 landscape
            userData["locationEnabled"] = true;
            userData["age"]             = 21;
            VungleBinding.startWithAppIdAndUserData("vungleTest", userData);
        }


        if (GUILayout.Button("Is Ad Available"))
        {
            Debug.Log("is ad available: " + VungleBinding.isAdAvailable());
        }


        if (GUILayout.Button("Play Modal Ad"))
        {
            VungleBinding.playModalAd(true);
        }


        endColumn(true);


        if (GUILayout.Button("Set Cache Size"))
        {
            VungleBinding.setCacheSize(12);
        }


        if (GUILayout.Button("Enable Logging"))
        {
            VungleBinding.enableLogging(true);
        }


        if (GUILayout.Button("Play Insentivised Ad"))
        {
            VungleBinding.playIncentivizedAd("user", true);
        }

        endColumn();
    }
Beispiel #10
0
 public static string getEndPoint()
 {
             #if UNITY_IPHONE
     return(VungleBinding.getEndPoint());
             #elif UNITY_ANDROID
     return("");
             #else
     return("");
             #endif
 }
Beispiel #11
0
 // Clear cache
 public static void clearCache()
 {
             #if UNITY_IPHONE
     VungleBinding.clearCache();
             #elif UNITY_ANDROID
     //VungleAndroid.clearCache();
             #else
     return;
             #endif
 }
Beispiel #12
0
    public static void playAd(bool incentivized = false, string user = "", int orientation = 6)
    {
#if UNITY_IPHONE
        VungleBinding.playAd(incentivized, user, (VungleAdOrientation)orientation);
#elif UNITY_ANDROID
        VungleAndroid.playAd(incentivized, user);
#elif UNITY_WSA_10_0
        VungleWin.playAd(incentivized, user);
#endif
    }
Beispiel #13
0
    // Sets if sound should be enabled or not
    public static void setSoundEnabled(bool isEnabled)
    {
#if UNITY_IPHONE
        VungleBinding.setSoundEnabled(isEnabled);
#elif UNITY_ANDROID
        VungleAndroid.setSoundEnabled(isEnabled);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.setSoundEnabled(isEnabled);
#endif
    }
Beispiel #14
0
    // Checks to see if a video is available
    public static bool isAdvertAvailable()
    {
#if UNITY_IPHONE
        return(VungleBinding.isAdAvailable());
#elif UNITY_ANDROID
        return(VungleAndroid.isVideoAvailable());
#else
        return(false);
#endif
    }
Beispiel #15
0
    // Initializes the Vungle SDK. Pass in your Android and iOS app ID's from the Vungle web portal.
    public static void init(string androidAppId, string iosAppId, string winAppId = "")
    {
#if UNITY_IPHONE
        VungleBinding.startWithAppId(iosAppId, PLUGIN_VERSION);
#elif UNITY_ANDROID
        VungleAndroid.init(androidAppId, PLUGIN_VERSION);
#elif UNITY_WSA_10_0
        VungleWin.init(winAppId, PLUGIN_VERSION);
#endif
    }
Beispiel #16
0
    // Checks to see if a video is available
    public static bool isAdvertAvailable()
    {
#if UNITY_IPHONE
        return(VungleBinding.isAdAvailable());
#elif UNITY_ANDROID
        return(VungleAndroid.isVideoAvailable());
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        return(VungleWin.isVideoAvailable());
#else
        return(false);
#endif
    }
Beispiel #17
0
    // Clear sleep
    public static void clearSleep()
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return;
                #endif
                #if UNITY_IPHONE
        VungleBinding.clearSleep();
                #elif UNITY_ANDROID
                #else
                #endif
#endif
    }
Beispiel #18
0
    // Initializes the Vungle SDK. Pass in your Android and iOS app ID's from the Vungle web portal.
    public static void init(string androidAppId, string iosAppId, string winAppId = "")
    {
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.startWithAppId(iosAppId, PLUGIN_VERSION);
#elif UNITY_ANDROID
        VungleAndroid.init(androidAppId, PLUGIN_VERSION);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.init(winAppId, PLUGIN_VERSION);
#endif
    }
Beispiel #19
0
    public static void setLogEnable(bool enable)
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return;
                #endif
                #if UNITY_IPHONE
        VungleBinding.enableLogging(enable);
                #elif UNITY_ANDROID
                #else
        return;
                #endif
#endif
    }
Beispiel #20
0
 // Displays an ad with the given options. The user option is only supported for incentivized ads.
 public static void playAdWithOptions(Dictionary <string, object> options)
 {
     if (options == null)
     {
         throw new ArgumentException("You can not call this method with null parameter");
     }
             #if UNITY_IPHONE
     VungleBinding.playAdEx(options);
             #elif UNITY_ANDROID
     VungleAndroid.playAdEx(options);
             #elif UNITY_WSA_10_0
     VungleWin.playAdEx(options);
             #endif
 }
Beispiel #21
0
    public static void setEndPoint(string endPoint)
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return;
                #endif
                #if UNITY_IPHONE
        VungleBinding.setEndPoint(endPoint);
                #elif UNITY_ANDROID
                #else
        return;
                #endif
#endif
    }
Beispiel #22
0
    public static void updateConsentStatus(Vungle.Consent consent, string version = "1.0")
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.updateConsentStatus(consent, version);
#elif UNITY_ANDROID
        VungleAndroid.updateConsentStatus(consent, version);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.updateConsentStatus(consent, version);
#endif
#endif
    }
Beispiel #23
0
    // Displays an ad with the no options. The user option is only supported for incentivized ads.
    public static void playAd(string placementID)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.playAd(placementID);
#elif UNITY_ANDROID
        VungleAndroid.playAd(placementID);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.playAd(placementID);
#endif
#endif
    }
Beispiel #24
0
    // Sets if sound should be enabled or not
    public static void setSoundEnabled(bool isEnabled)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.setSoundEnabled(isEnabled);
#elif UNITY_ANDROID
        VungleAndroid.setSoundEnabled(isEnabled);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.setSoundEnabled(isEnabled);
#endif
#endif
    }
Beispiel #25
0
    // Clear cache
    public static void clearCache()
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return;
                #endif
                #if UNITY_IPHONE
        VungleBinding.clearCache();
                #elif UNITY_ANDROID
        //VungleAndroid.clearCache();
                #else
        return;
                #endif
#endif
    }
    // Close flex ads.
    public static bool closeAd(string placementID)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return(false);
#endif
#if UNITY_IPHONE
        return(VungleBinding.closeAd(placementID));
#elif UNITY_ANDROID
        return(VungleAndroid.closeAd(placementID));
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        return(false);
#endif
#endif
    }
Beispiel #27
0
    public static Vungle.Consent getConsentStatus()
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return(Consent.Undefined);
#endif
#if UNITY_IPHONE
        return(VungleBinding.getConsentStatus());
#elif UNITY_ANDROID
        return(VungleAndroid.getConsentStatus());
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        return(VungleWin.getConsentStatus());
#endif
#endif
    }
Beispiel #28
0
    // Displays an ad with the given options. The user option is only supported for incentivized ads.
    public static void playAd(bool incentivized = false, string user = "", int orientation = 6)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.playAd(incentivized, user, (VungleAdOrientation)orientation);
#elif UNITY_ANDROID
        VungleAndroid.playAd(incentivized, user);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.playAd(incentivized, user);
#endif
#endif
    }
Beispiel #29
0
    public static void init(string appId, bool initHeaderBiddingDelegate)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
#if UNITY_IPHONE
        VungleBinding.startWithAppId(appId, PLUGIN_VERSION, initHeaderBiddingDelegate);
#elif UNITY_ANDROID
        VungleAndroid.init(appId, PLUGIN_VERSION);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.init(appId, PLUGIN_VERSION);
        VungleSceneLoom.Initialize();
#endif
#endif
    }
Beispiel #30
0
    public static string getEndPoint()
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return("");
                #endif
                #if UNITY_IPHONE
        return(VungleBinding.getEndPoint());
                #elif UNITY_ANDROID
        return("");
                #else
        return("");
                #endif
#else
        return("");
#endif
    }