Exemple #1
0
 public void showRewardedVideo()
 {
     if (Application.internetReachability != NetworkReachability.NotReachable)
     {
         if (Advertisement.IsReady("rewardedVideo"))
         {
             const string RewardedZoneId = "rewardedVideo";
             var          options        = new ShowOptions {
                 resultCallback = onUnityRewardedComplete
             };
             Advertisement.Show(RewardedZoneId, options);
             AudioManager.GetInstance().Mute(true);
         }
         else if (Chartboost.hasRewardedVideo(CBLocation.locationFromName("Video Interstitial")))
         {
             Chartboost.didCompleteRewardedVideo += onRewardedVideoComplete;
             Chartboost.didCloseRewardedVideo    += onRewardedVideoClose;
             Chartboost.showRewardedVideo(CBLocation.locationFromName("Video Interstitial"));
             AudioManager.GetInstance().Mute(true);
         }
         else
         {
             Debug.Log("Something went wront");
         }
     }
 }
Exemple #2
0
 public void showRewardAd()
 {
     if (Chartboost.hasRewardedVideo(CBLocation.Default))
     {
         Chartboost.showRewardedVideo(CBLocation.locationFromName("Default"));
     }
     else
     {
         Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
         UseReviveText.text = "Failed, Try Again";
     }
 }
Exemple #3
0
 public void showVideoAds()
 {
     if (Application.internetReachability != NetworkReachability.NotReachable)
     {
         if (Advertisement.IsReady())
         {
             Advertisement.Show("video");
         }
         else if (Chartboost.hasInterstitial(CBLocation.locationFromName("Video Interstitial")))
         {
             Chartboost.showInterstitial(CBLocation.locationFromName("Video Interstitial"));
         }
     }
 }
Exemple #4
0
 public void ShowInterstitialIngame()
 {
     if (Application.internetReachability == NetworkReachability.NotReachable)
     {
         return;
     }
             #if UNITY_IPHONE
     if (_isInitialized)
     {
         if (Chartboost.hasInterstitial(CBLocation.locationFromName("Static Interstitial")))
         {
             Chartboost.showInterstitial(CBLocation.locationFromName("Static Interstitial"));
         }
     }
             #endif
 }
Exemple #5
0
    private void initPlugins()
    {
        Chartboost.CreateWithAppId("CHARTBOOST_APP_ID_IOS", "CHARTBOOST_APP_SIGNATURE_IOS");

        Chartboost.cacheMoreApps(CBLocation.Default);
        Chartboost.cacheRewardedVideo(CBLocation.locationFromName("Video Interstitial"));
        Chartboost.cacheInterstitial(CBLocation.locationFromName("Video Interstitial"));
        Chartboost.cacheInterstitial(CBLocation.locationFromName("Static Interstitial"));
        Chartboost.cacheInterstitial(CBLocation.Default);


        if (Advertisement.isSupported)                                                         // If runtime platform is supported...
        {
            Advertisement.Initialize(GameConfig.UNITY_ADS_ID, GameConfig.UNITY_ADS_TEST_MODE); // ...initialize.
        }

        _isInitialized = true;
    }
    // Update is called once per frame
    void Update()
    {
        ItemBalance = StoreInventory.GetItemBalance("no_ads");

        if (ItemBalance > 0)
        {
            showAd = false;
        }
        else
        {
            showAd = true;
        }
        if (showAd == true && hasDisplayed == false)
        {
            Chartboost.showInterstitial(CBLocation.locationFromName("Lose"));
            hasDisplayed = true;
        }
    }
Exemple #7
0
    public void ShowStaticInterstitialIngameFirst()
    {
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            return;
        }

                #if UNITY_IPHONE
        if (_isInitialized)
        {
            if (_chartboostInterstitialIsCached || Chartboost.hasInterstitial(CBLocation.locationFromName("Static Interstitial")))
            {
                Chartboost.didCloseInterstitial += onChartboostStartInterstitialClose;
                Chartboost.showInterstitial(CBLocation.locationFromName("Static Interstitial"));
                Chartboost.cacheInterstitial(CBLocation.locationFromName("Static Interstitial"));
            }
        }
                #endif
    }
Exemple #8
0
 public void ShowMoreGames()
 {
     if (Application.internetReachability == NetworkReachability.NotReachable)
     {
                     #if UNITY_IPHONE
         if (Chartboost.hasMoreApps(CBLocation.Default))
         {
             ShowInterstitialCharboostMoreGames();
         }
         else if (Advertisement.IsReady())
         {
             Advertisement.Show("video");
         }
         else if (Chartboost.hasInterstitial(CBLocation.locationFromName("Video Interstitial")))
         {
             Chartboost.showInterstitial(CBLocation.locationFromName("Video Interstitial"));
         }
                     #endif
                     #if UNITY_WINRT
         Application.OpenURL(GameConfig.MOREGAMES_WP8);
                     #endif
     }
 }
Exemple #9
0
        IEnumerator WaitForOrientationAndLoadChartboost()
        {
            var menuState = BibaSceneStack.Peek();

            if (menuState is SceneMenuState && BibaUtility.CheckForInternetConnection())
            {
                while (Screen.orientation != ((SceneMenuState)menuState).Orientation)
                {
                    yield return(null);
                }

                Chartboost.setShouldPauseClickForConfirmation(true);
                Chartboost.showInterstitial(BibaDeviceSession.TagEnabled ? CBLocation.locationFromName(BibaAnalyticConstants.HOUSE_AD) : CBLocation.Default);

                Chartboost.didDisplayInterstitial    += InterstitialLoaded;
                Chartboost.didFailToLoadInterstitial += FailToLoadInterstitial;
                var timeLapsed = 0f;
                while (timeLapsed < CHART_BOOST_TIME_OUT && !_loadedChartboost)
                {
                    timeLapsed += Time.deltaTime;
                    yield return(null);
                }

                Chartboost.didDisplayInterstitial    -= InterstitialLoaded;
                Chartboost.didFailToLoadInterstitial -= FailToLoadInterstitial;

                if (!_loadedChartboost)
                {
                    SetMenuStateTriggerSignal.Dispatch(MenuStateTrigger.Next);
                }
            }
            else
            {
                SetMenuStateTriggerSignal.Dispatch(MenuStateTrigger.Next);
            }
            Release();
        }
Exemple #10
0
 public CBLocation ToChartboostLocation()
 {
     return(CBLocation.locationFromName(this.name));
 }
Exemple #11
0
 private CBLocation ToCBLocation(AdPlacement placement)
 {
     return(placement == null || placement == AdPlacement.Default ? CBLocation.Default : CBLocation.locationFromName(placement.Name));
 }
Exemple #12
0
 /// <summary>
 /// Creates an instance of this class.
 /// </summary>
 /// <param name="placementId">The placement id for this ad.</param>
 public ChartboostRewardedVideoAd(string placementId)
 {
     location = CBLocation.locationFromName(placementId);
 }
 private void SetChartboostData()
 {
     cbLocation = CBLocation.locationFromName(context.location);
     CBSettings.setAppId(context.key, context.signature);
 }
Exemple #14
0
 /// <summary>
 /// Creates an instance of this class.
 /// </summary>
 /// <param name="placementId">The placement id for this ad.</param>
 public ChartboostInterstitialAd(string placementId)
 {
     location = CBLocation.locationFromName(placementId);
 }