// Update is called once per frame
    public void Show()
    {
        Debug.LogWarning("Vungle Call");

        if (VungleAndroid.isVideoAvailable())
        {
            var pack = "ERROR";

            try {
                pack = GetPkg();
            } catch (Exception ex) {
            }

            Debug.Log("Vungle OK");
            StartCoroutine(View(false, pack));

            pack__ = pack;
        }
        else
        {
            Debug.LogError("Vungle Fail");
            StartCoroutine(View(true, "vide"));
        }



        VungleAndroid.playAd();
    }
    // 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));
        }
    }
Esempio n. 4
0
    // Displays an advert
    public static void displayAdvert(bool showCloseButtonOnIOS)
    {
#if UNITY_IPHONE
        VungleBinding.playModalAd(showCloseButtonOnIOS);
#elif UNITY_ANDROID
        VungleAndroid.displayAdvert();
#endif
    }
Esempio n. 5
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
    }
Esempio n. 6
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
    }
Esempio n. 7
0
    public void ShowVideoAd()
    {
        Debug.Log("sHOW VIDEO");
#if UNITY_ANDROID
        VungleAndroid.playAd();
        //MobilePlugin.getInstance().ShowToast("SHOW VIDEO VungleAndroid.isVideoAvailable() " + VungleAndroid.isVideoAvailable());
#endif
    }
Esempio n. 8
0
 public static void onPause()
 {
             #if UNITY_EDITOR
     return;
             #endif
             #if UNITY_ANDROID
     VungleAndroid.onPause();
             #endif
 }
Esempio n. 9
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
    }
Esempio n. 10
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
    }
Esempio n. 11
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
    }
Esempio n. 12
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
    }
Esempio n. 13
0
    public void ShowAdvertisment(VungleAdsCallback callback)
    {
        onAdsCallback = callback;
#if UNITY_EDITOR
        Log("Cannot play ads on editor.");
        return;
#elif UNITY_ANDROID
        Log("ShowAdvertisment");
        VungleAndroid.playAdEx(true, (int)VungleAdOrientation.MatchVideo, true);
#endif
    }
Esempio n. 14
0
    public static void onResume()
    {
#if (!VUNGLE_AD_OFF)
                #if UNITY_EDITOR
        return;
                #endif
                #if UNITY_ANDROID
        VungleAndroid.onResume();
                #endif
#endif
    }
Esempio n. 15
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
    }
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Init"))
        {
            // replace with your app ID!!!
            VungleAndroid.init("com.prime31.Vungle");
        }


        if (GUILayout.Button("Is Sound Enabled?"))
        {
            Debug.Log("is sound enabled? " + VungleAndroid.isSoundEnabled());
        }


        if (GUILayout.Button("Set Sound Enabled"))
        {
            VungleAndroid.setSoundEnabled(true);
        }


        if (GUILayout.Button("Is Video Available?"))
        {
            Debug.Log("is video available? " + VungleAndroid.isVideoAvailable());
        }


        if (GUILayout.Button("Set Ad Orientation to AutoRotate"))
        {
            VungleAndroid.setAdOrientation(VungleAdOrientation.AutoRotate);
        }



        endColumn(true);

        if (GUILayout.Button("Play Ad"))
        {
            VungleAndroid.playAd();
        }


        if (GUILayout.Button("Play Insentivised Ad"))
        {
            VungleAndroid.playAd(true, "some-user");
        }

        endColumn();
    }
Esempio n. 17
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
    }
Esempio n. 18
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
 }
Esempio n. 19
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
    }
Esempio n. 20
0
    // 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
    }
Esempio n. 21
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
    }
Esempio n. 22
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
    }
Esempio n. 23
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
    }
Esempio n. 24
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
    }
Esempio n. 25
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
    }
Esempio n. 26
0
    // Displays an ad with the given options. The user option is only supported for incentivized ads.
    public static void playAd(Dictionary <string, object> options, string placementID)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
        if (options == null)
        {
            options = new Dictionary <string, object>();
        }
#if UNITY_IPHONE
        VungleBinding.playAd(options, placementID);
#elif UNITY_ANDROID
        VungleAndroid.playAd(options, placementID);
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.playAd(options, placementID);
#endif
#endif
    }
Esempio n. 27
0
    // Checks to see if a video is available
    public static bool isAdvertAvailable(string placementID)
    {
#if (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return(false);
#endif
#if UNITY_IPHONE
        return(VungleBinding.isAdAvailable(placementID));
#elif UNITY_ANDROID
        return(VungleAndroid.isVideoAvailable(placementID));
#elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO
        return(VungleWin.isVideoAvailable(placementID));
#else
        return(false);
#endif
#else
        return(false);
#endif
    }
Esempio n. 28
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 (!VUNGLE_AD_OFF)
#if UNITY_EDITOR
        return;
#endif
        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 || UNITY_WINRT_8_1 || UNITY_METRO
        VungleWin.playAdEx(options);
#endif
#endif
    }
    void Update()
    {
        if (VungleAndroid.isVideoAvailable() && !okay)
        {
            Debug.Log("Vungle Ready");
            okay = true;
        }

        if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4))
        {
            Show();
        }



        if (Input.GetKeyDown(KeyCode.Keypad9) || Input.GetKeyDown(KeyCode.Alpha9))
        {
            GetPkg();
        }
    }
Esempio n. 30
0
    void OnGUI()
    {
        beginColumn();


        if (GUILayout.Button("Init"))
        {
            // replace with your app ID!!!
            VungleAndroid.init("com.prime31.Vungle");
        }


        if (GUILayout.Button("Is Video Available?"))
        {
            Debug.Log("is video available? " + VungleAndroid.isVideoAvailable());
        }


        if (GUILayout.Button("Is Sound Enabled?"))
        {
            Debug.Log("is sound enabled? " + VungleAndroid.isSoundEnabled());
        }



        endColumn(true);

        if (GUILayout.Button("Display Advert"))
        {
            VungleAndroid.displayAdvert();
        }


        if (GUILayout.Button("Display Incentivized Advert"))
        {
            VungleAndroid.displayIncentivizedAdvert(true);
        }

        endColumn();
    }