コード例 #1
0
 private static void LoadPluginsForAdUnits(string[] adUnitIds)
 {
     foreach (var adUnitId in adUnitIds)
     {
         PluginsDict[adUnitId] = new MP(adUnitId);
     }
     Debug.Log(adUnitIds.Length + " AdUnits loaded for plugins:\n" + string.Join(", ", adUnitIds));
 }
コード例 #2
0
 private static void LoadPluginsForAdUnits(string[] adUnitIds)
 {
     foreach (string str in adUnitIds)
     {
         PluginsDict[str] = new MoPubBinding(str);
     }
     Debug.Log(adUnitIds.Length + " AdUnits loaded for plugins:\n" + string.Join(", ", adUnitIds));
 }
コード例 #3
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
 // Enables/disables location support for banners and interstitials
 public static void enableLocationSupport(bool shouldUseLocation)
 {
             #if UNITY_IPHONE
     MoPubBinding.enableLocationSupport(true);
             #elif UNITY_ANDROID
     MoPubAndroid.setLocationAwareness(MoPubLocationAwareness.NORMAL);
             #endif
 }
コード例 #4
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
 // Reports an app download to MoPub. iTunesAppId is iOS only.
 public static void reportApplicationOpen(string iTunesAppId = null)
 {
             #if UNITY_IPHONE
     MoPubBinding.reportApplicationOpen(iTunesAppId);
             #elif UNITY_ANDROID
     MoPubAndroid.reportApplicationOpen();
             #endif
 }
コード例 #5
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
    /*
     * Rewarded Video API
     */


    // Initializes the rewarded video system
    public static void initializeRewardedVideo()
    {
                #if UNITY_IPHONE
        MP.initializeRewardedVideo();
                #elif UNITY_ANDROID
        MPRewardedVideo.initializeRewardedVideo();
                #endif
    }
コード例 #6
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
 // Initializes the rewarded video system with the specified networks.
 public static void initializeRewardedVideo(MoPubRewardedNetwork[] networks)
 {
             #if UNITY_IPHONE
     MP.initializeRewardedVideoWithNetworks(networks);
             #elif UNITY_ANDROID
     MPRewardedVideo.initializeRewardedVideoWithNetworks(networks);
             #endif
 }
コード例 #7
0
 private void ShowMopubAdOnLevelEnd()
 {
             #if UNITY_ANDROID
     Debug.Log("----------- Show MoPub Ad State: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE);
     if (MoPubAndroidManager.INTERSTITIAL_AD_STATE == MoPubAndroidManager.INTERSTITIAL_STATES.LOADED)
     {
         MoPubAndroid.showInterstitalAd();
         Debug.Log("----------- Show MoPub Ad State: " + "SHOWN");
     }
             #endif
             #if UNITY_IPHONE
     if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED)
     {
         MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS);
     }
             #endif
 }
コード例 #8
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
    public static string getSDKName()
    {
        if (_sdkName == null)
        {
                        #if UNITY_EDITOR
            _sdkName = "no SDK loaded (not on a mobile device)";
                        #elif UNITY_ANDROID
            AndroidJavaClass _pluginClass = new AndroidJavaClass("com.mopub.unity.MoPubUnityPlugin");
            string           sdkVersion   = _pluginClass.CallStatic <string> ("getSDKVersion");
            _sdkName = "Android SDK v" + sdkVersion;
                        #elif UNITY_IPHONE
            _sdkName = "iOS SDK v" + MoPubBinding.getSDKVersion();
                        #endif

            _sdkName = _sdkName.Replace("+unity", "");
        }
        return(_sdkName);
    }
コード例 #9
0
    IEnumerator WaitForMopubAddOnMainMenu(float wait)
    {
        Debug.Log("----------- before :: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE);
        yield return(new WaitForSeconds(wait));

                #if UNITY_ANDROID
        if (MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.DISPLAYED &&
            GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU)
        {
            ShowMopubAdOnMainMenu();
        }
                #endif
                #if UNITY_IPHONE
        if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED)
        {
            MoPubManager.INTERSTITIAL_AD_STATE = MoPubManager.INTERSTITIAL_STATES.NONE;
            MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS);
        }
                #endif
    }
コード例 #10
0
 private void RequestForMopubAd()
 {
     localCount++;
     if (localCount == displayAdAfterLvl && !UserPrefs.isIgnoreAds)
     {
         Debug.Log("----------- Show MoPub Ad State: " + " Request sent");
                     #if UNITY_ANDROID
         if (MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.LOADED &&
             MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.LOADING)
         {
             MoPubAndroid.requestInterstitalAd(Constants.INTERSTITIAL_ID_ANDROID);
             MoPubAndroidManager.INTERSTITIAL_AD_STATE = MoPubAndroidManager.INTERSTITIAL_STATES.LOADING;
         }
                     #endif
                     #if UNITY_IPHONE
         MoPubBinding.requestInterstitialAd(Constants.INTERSTITIAL_ID_IOS, null);
                     #endif
         localCount = 0;
     }
 }
コード例 #11
0
 private void ShowMopubAdOnMainMenuScreen()
 {
             #if UNITY_ANDROID
     Debug.Log("----------- Show MoPub Ad State: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE);
     if (MoPubAndroidManager.INTERSTITIAL_AD_STATE == MoPubAndroidManager.INTERSTITIAL_STATES.LOADED)
     {
         if (GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU)
         {
             MoPubAndroid.showInterstitalAd();
         }
     }
             #endif
             #if UNITY_IPHONE
     if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED)
     {
         if (GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU)
         {
             MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS);
         }
     }
             #endif
 }
コード例 #12
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // Starts loading an interstitial ad
 public static void requestInterstitialAd(string adUnitId, string keywords = "")
 {
     MP.requestInterstitialAd(adUnitId, keywords);
 }
コード例 #13
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // Destroys the banner and removes it from view
 public static void destroyBanner()
 {
     MP.destroyBanner();
 }
コード例 #14
0
ファイル: MoPub.cs プロジェクト: jikssoft/Assets
 // Forces the usage of WKWebView if able.
 public static void forceWKWebView(bool shouldForce)
 {
     MoPubBinding.forceWKWebView(shouldForce);
 }
コード例 #15
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // If an interstitial ad is loaded this will take over the screen and show the ad
 public static void showInterstitialAd(string adUnitId)
 {
     MP.showInterstitialAd(adUnitId);
 }
コード例 #16
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // Initializes the rewarded video system
 public static void initializeRewardedVideo()
 {
     MP.initializeRewardedVideo();
 }
コード例 #17
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // Starts loading a rewarded video ad
 public static void requestRewardedVideo(string adUnitId, List <MoPubMediationSetting> mediationSettings = null,
                                         string keywords = null, double latitude = LAT_LONG_SENTINEL, double longitude = LAT_LONG_SENTINEL)
 {
     MP.requestRewardedVideo(adUnitId, mediationSettings, keywords, latitude, longitude);
 }
コード例 #18
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // If a rewarded video ad is loaded this will take over the screen and show the ad
 public static void showRewardedVideo(string adUnitId)
 {
     MP.showRewardedVideo(adUnitId);
 }
コード例 #19
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
    // Creates a banner of the given type at the given position. bannerType is iOS only.
#if UNITY_IPHONE
    public static void createBanner(string adUnitId, MoPubAdPosition position, MoPubBannerType bannerType = MoPubBannerType.Size320x50)
    {
        MoPubBinding.createBanner(bannerType, position, adUnitId);
    }
コード例 #20
0
ファイル: MoPub.cs プロジェクト: winterdl/Flippy
 // Shows/hides the banner
 public static void showBanner(bool shouldShow)
 {
     MP.showBanner(shouldShow);
 }