Ejemplo n.º 1
0
        public void ShowRewardedVideo(Action <bool> success)
        {
            Chartboost.showRewardedVideo(CBLocation.Default);
            Chartboost.didFailToLoadRewardedVideo += delegate(CBLocation arg1, CBImpressionError arg2)
            {
                Debug.Log("user fail chartboost rewarded video - didFailToLoadRewardedVideo");

                print("AAChartboost - didFailToLoadRewardedVideo");

                if (success != null)
                {
                    success(false);
                }
            };

            Chartboost.didCompleteRewardedVideo += delegate(CBLocation arg1, int arg2)
            {
                Debug.Log("user success chartboost rewarded video - didCompleteRewardedVideo");

                if (success != null)
                {
                    success(true);
                }
            };

            Chartboost.didDismissRewardedVideo += delegate(CBLocation obj)
            {
                Debug.Log("user success chartboost rewarded video - didDismissRewardedVideo");

                if (success != null)
                {
                    success(false);
                }
            };
        }
Ejemplo n.º 2
0
    public void ShowAds(bool chartboost = true)
    {
        if (chartboost)
        {
#if CHARTBOOST_ADS
            Debug.Log("show Chartboost Interstitial in " + LevelManager.THIS.gameStatus);

            Chartboost.showInterstitial(CBLocation.Default);
            Chartboost.cacheInterstitial(CBLocation.Default);
#endif
        }
        else
        {
#if GOOGLE_MOBILE_ADS
            Debug.Log("show Google mobile ads Interstitial in " + LevelManager.THIS.gameStatus);
            if (interstitial.IsLoaded())
            {
                interstitial.Show();
#if UNITY_ANDROID
                interstitial = new InterstitialAd(admobUIDAndroid);
#elif UNITY_IOS
                interstitial = new InterstitialAd(admobUIDIOS);
#else
                interstitial = new InterstitialAd(admobUIDAndroid);
#endif

                // Create an empty ad request.
                requestAdmob = new AdRequest.Builder().Build();
                // Load the interstitial with the request.
                interstitial.LoadAd(requestAdmob);
            }
#endif
        }
    }
Ejemplo n.º 3
0
    void ShowChartboostInterstitialGameOver()
    {
        Chartboost.didFailToLoadInterstitial -= didFailedToLoaChartboostGameOver;
        Chartboost.didFailToLoadInterstitial += didFailedToLoaChartboostGameOver;

        Chartboost.showInterstitial(CBLocation.Default);
    }
 // Token: 0x0600000C RID: 12 RVA: 0x00002474 File Offset: 0x00000874
 private void Start()
 {
     this.delegateHistory = new List <string>();
     Chartboost.setAutoCacheAds(this.autocache);
     Chartboost.setMediation(CBMediation.AdMob, "1.0");
     this.AddLog("Is Initialized: " + Chartboost.isInitialized());
 }
Ejemplo n.º 5
0
    void Start()
    {
        delegateHistory = new List <string>();
        Chartboost.setShouldPauseClickForConfirmation(ageGate);
        Chartboost.setAutoCacheAds(autocache);
        Chartboost.setMediation(CBMediation.AdMob, "1.0");

        AddLog("Is Initialized: " + Chartboost.isInitialized());


        /*
         *      // Create the Chartboost gameobject with the editor AppId and AppSignature
         *      // Remove the Chartboost gameobject from the sample first
         *      Chartboost.Create();
         */

        /*
         *      // Sample to create Chartboost gameobject from code overriding editor AppId and AppSignature
         *      // Remove the Chartboost gameobject from the sample first
         #if UNITY_IPHONE
         *      Chartboost.CreateWithAppId("4f21c409cd1cb2fb7000001b", "92e2de2fd7070327bdeb54c15a5295309c6fcd2d");
         #elif UNITY_ANDROID
         *      Chartboost.CreateWithAppId("4f7b433509b6025804000002", "dd2d41b69ac01b80f443f5b6cf06096d457f82bd");
         #endif
         */
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        // display ad for opening up Store!
        if (panelOpen)
        {
            // if ** STIL THE FIRST INTERACTION (going on right meow) **
            if (!firstInteraction)
            {
                // <-- SHOW AD FOR FIRST TIME -->

                // ** SHOW AD TRUMPSTER STYLE!! :) **
                // Show interstitial at location HomeScreen.
                // See Chartboost.cs for available location options.
                Chartboost.showInterstitial(CBLocation.HomeScreen);

                // set to true so this doesnt happen again
                firstInteraction = true;
            }
            else
            {
            }


            // ** SHOW AD TRUMPSTER STYLE!! :) **
            // Show interstitial at location HomeScreen.
            // See Chartboost.cs for available location options.
            Chartboost.showInterstitial(CBLocation.HomeScreen);
        }
    }
Ejemplo n.º 7
0
 public void ShowInterstitialChartboost()
 {
             #if UNITY_IPHONE
     Chartboost.showInterstitial(CBLocation.Default);
     Chartboost.cacheInterstitial(CBLocation.Default);
             #endif
 }
Ejemplo n.º 8
0
    public void ShowAds(bool chartboost = true)
    {
        if (chartboost)
        {
            Chartboost.showInterstitial(CBLocation.Default);
            Chartboost.cacheInterstitial(CBLocation.Default);
        }
        else
        {
            if (interstitial.IsLoaded())
            {
                interstitial.Show();
                                #if UNITY_ANDROID
                interstitial = new InterstitialAd(admobUIDAndroid);
                                #elif UNITY_IOS
                interstitial = new InterstitialAd(admobUIDIOS);
                                #else
                interstitial = new InterstitialAd(admobUIDAndroid);
                                #endif

                // Create an empty ad request.
                requestAdmob = new AdRequest.Builder().Build();
                // Load the interstitial with the request.
                interstitial.LoadAd(requestAdmob);
            }
        }
    }
 public void Show(Action onInterstitialClosed)
 {
     this.onInterstitialClosed = onInterstitialClosed;
     Chartboost.showInterstitial(location);
     isShowing = true;
     CacheInterstitial();
 }
 public void Show(Action <bool> onRewardVideoWatched)
 {
     this.onRewardVideoWatched = onRewardVideoWatched;
     isShowing = true;
     Chartboost.showRewardedVideo(location);
     CacheVideo();
 }
Ejemplo n.º 11
0
        protected override void InternalInit()
        {
            #if EM_CHARTBOOST
            mAdSettings = EM_Settings.Advertising.Chartboost;

            Chartboost.didCacheInterstitial      += CBDidCacheInterstitial;
            Chartboost.didClickInterstitial      += CBDidClickInterstitial;
            Chartboost.didCloseInterstitial      += CBDidCloseInterstitial;
            Chartboost.didDismissInterstitial    += CBDidDismissInterstitial;
            Chartboost.didFailToLoadInterstitial += CBDidFailToLoadInterstitial;

            Chartboost.didCacheRewardedVideo      += CBDidCacheRewardedVideo;
            Chartboost.didClickRewardedVideo      += CBDidClickRewardedVideo;
            Chartboost.didCloseRewardedVideo      += CBDidCloseRewardedVideo;
            Chartboost.didDismissRewardedVideo    += CBDidDismissRewardedVideo;
            Chartboost.didFailToLoadRewardedVideo += CBDidFailToLoadRewardedVideo;
            Chartboost.didCompleteRewardedVideo   += CBDidCompleteRewardedVideo;

            // Create Chartboost object.
            // We'll handle ad loading, so turning off Chartboost's autocache feature.
            Chartboost.Create();
            Chartboost.setAutoCacheAds(false);

            // Set GDPR consent (if any) *after* the SDK is started,
            // as recommended by the "restrictDataCollection* method.
            var consent = GetApplicableDataPrivacyConsent();
            ApplyDataPrivacyConsent(consent);

            // Done initialization.
            mIsInitialized = true;
            Debug.Log("Chartboost client has been initialized.");
            #endif
        }
Ejemplo n.º 12
0
    //public ScoringScript ScoringScript;
    //public RotateWallScript RotateWallScript;
    //public HitSideWallRightScript HitSideWallRightScript;
    //public HitSideWallLeftScript HitSideWallLeftScript;
    //public SpawnMovingObjectScript SpawnMovingObjectScript;

    // Use this for initialization
    void Start()
    {
        //Starting of the app
        Screen.orientation = ScreenOrientation.Portrait;

        Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
    }
Ejemplo n.º 13
0
    // Show ads at the game over screen and unlock death achievements
    public void showGameOverAds()
    {
        go_count++;

        string death_count = go_count.ToString();

        // Unlock achievement for dying specific number of times
        #if UNITY_ANDROID
        switch (death_count)
        {
        case "10":
            Achievements.justGettingTheHangOfItAchievement();
            break;

        case "20":
            Achievements.thisGetsEasierRightAchievement();
            break;

        case "30":
            Achievements.masochistAchievement();
            break;

        case "50":
            Achievements.soMuchDeathAchievement();
            break;
        }
        #endif

        if (go_count % ad_frequency == 0 && StoreInventory.GetItemBalance(SOAPStoreAssets.NO_ADS_LIFETIME_PRODUCT_ID) == 0)
        {
            Chartboost.showInterstitial(CBLocation.GameOver);
            Debug.Log("show the ads now!");
        }
    }
Ejemplo n.º 14
0
    void Update()
    {
        foreach (AdNetwork network in Enum.GetValues(typeof(AdNetwork)))
        {
            if (allNetworks.Contains(network))
            {
                DebugPanel.Log(network.ToString(), "Ads", IsReady(network));
            }
        }

        if (!Chartboost.hasInterstitial(CBLocation.Default) && !CBdownloading)
        {
            CBdownloading = true;
            Chartboost.cacheInterstitial(CBLocation.Default);
        }

        if (!AdMob_Interstitial.IsLoaded() && !AdMob_loading)
        {
            AdMob_loading      = true;
            AdMob_Interstitial = new InterstitialAd(GetAdMobIDs());
            AdMob_Interstitial.LoadAd(new AdRequest.Builder().Build());
        }
        else if (AdMob_Interstitial.IsLoaded())
        {
            AdMob_loading = false;
        }
    }
Ejemplo n.º 15
0
    void Start()
    {
        GameObject.Find("SoundManager").GetComponents <AudioSource>()[0].volume = PlayerPrefs.GetFloat("musicLevel") / 100f;
        soundmanager = GameObject.Find("SoundManager");
        Chartboost.cacheInterstitial(CBLocation.Default);
        Chartboost.cacheRewardedVideo(CBLocation.Default);
        text.text = PlayerPrefs.GetInt("coins").ToString();
        int bttnLength = bttn.Length;

        distance     = new float[bttnLength];
        bttnDistance = (int)Mathf.Abs(bttn[1].GetComponent <RectTransform>().anchoredPosition.x - bttn[0].GetComponent <RectTransform>().anchoredPosition.x);
        foreach (Button button in bttn)
        {
            string[] splitString = button.name.Split('-');
            string   itemName    = splitString[0];        //name of item
            //Debug.Log (splitString[1]); //price
            if (PlayerPrefs.GetString(itemName) == "true")
            {
                button.GetComponent <Image>().color = Color.white;
            }
            else
            {
                button.GetComponent <Image>().sprite = unknown;
            }
        }
    }
Ejemplo n.º 16
0
		private void ShowInterstitialAd(StoreInfo al) {
			MyDebug.Log(false, "AdsMCG::ShowInterstitialAd => Show Interstitial Ad Called");
			switch(al.ShowAdsFrom) {
#if ADCOLONY
			case Provider.AdColony:
				string rawStatus, status;
				rawStatus = AdColony.StatusForZone (al.AdColonyZone);
				status = string.Format ("Zone {0} status is {1}", al.AdColonyZone, rawStatus);
				MyDebug.Log (false,status);
				if (AdColony.IsVideoAvailable (al.AdColonyZone)) {
					ShowAdColonyAds (al.AdColonyZone);
				}
				break;
#endif

#if ADMOB
			case Provider.AdMob:
				if(GoogleMobileAdsScript.Me.IsInterstitialReady(al.AdMobUnitID)) {
					ShowAdMobAds(al.AdMobUnitID);
				}
				break;
#endif

#if CHARTBOOST
			case Provider.Chartboost:
				if(Chartboost.hasInterstitial(new CBLocation(al.CBLoation))) {
					ShowChartboostAds(al.CBLoation);
				}
				break;
#endif
			case Provider.Inmobi:
				break;

			}
		}
Ejemplo n.º 17
0
        public override void Init()
        {
#if CHARTBOOST
            if (isInit)
            {
                return;
            }
            else
            {
                isInit = true;
            }

            Debug.Log("Ads - Chartboost - Init...");

            settings.isLoggingEnabled = Debug.isDebugBuild;

            Chartboost.didFailToLoadInterstitial += didFailToLoadInterstitial;
            Chartboost.didDismissInterstitial    += didDismissInterstitial;
            Chartboost.didCloseInterstitial      += didCloseInterstitial;
            Chartboost.didClickInterstitial      += didClickInterstitial;
            Chartboost.didCacheInterstitial      += didCacheInterstitial;
            Chartboost.shouldDisplayInterstitial += shouldDisplayInterstitial;
            Chartboost.didDisplayInterstitial    += didDisplayInterstitial;

            Chartboost.cacheInterstitial(CBLocation.Default);
#endif
        }
Ejemplo n.º 18
0
		private bool IsRewardAdAvailable(StoreInfo al) {
			bool retValue = false;
			MyDebug.Log(false, "AdsMCG::IsRewardAdAvailable => IsReward Ad Available Called");

			switch(al.ShowAdsFrom) {
#if ADCOLONY
			case Provider.AdColony:
				string rawStatus, status;
				rawStatus = AdColony.StatusForZone (al.AdColonyZone);
				status = string.Format ("Zone {0} status is {1}", al.AdColonyZone, rawStatus);
				MyDebug.Log (false,status);
				retValue = AdColony.IsVideoAvailable (al.AdColonyZone);
				break;
#endif

#if ADMOB
			case Provider.AdMob:
				retValue = GoogleMobileAdsScript.Me.IsRewardVideoAdReady(al.AdMobUnitID);
				//if(!retValue) GoogleMobileAdsScript.Me.RequestRewardVideoAd(al.AdMobUnitID);
				break;
#endif

#if CHARTBOOST
			case Provider.Chartboost:
				retValue = Chartboost.hasRewardedVideo(new CBLocation(al.CBLoation));
				if(!retValue) Chartboost.cacheRewardedVideo(new CBLocation(al.CBLoation));
				break;
#endif
			case Provider.Inmobi:
			default:
				break;
			}
			return retValue;
		}
Ejemplo n.º 19
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");
         }
     }
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     Chartboost.cacheInterstitial(CBLocation.Default);
     Chartboost.cacheRewardedVideo(CBLocation.Default);
     Chartboost.setAutoCacheAds(true);
 }
Ejemplo n.º 21
0
 public void ShowInterstitialCharboostMoreGames()
 {
             #if UNITY_IPHONE
     Chartboost.showMoreApps(CBLocation.Default);
     Chartboost.cacheMoreApps(CBLocation.Default);
             #endif
 }
Ejemplo n.º 22
0
 public void ShowRewardedAd()
 {
     if (Chartboost.hasRewardedVideo(CBLocation.Default))
     {
         Chartboost.showRewardedVideo(CBLocation.Default);
     }
 }
Ejemplo n.º 23
0
        public void ShowAds(AdType adType, string zone = "")
        {
            switch (adType)
            {
            case AdType.Interstitial:
                if (Chartboost.hasInterstitial(CBLocation.Default))
                {
                    Chartboost.showInterstitial(CBLocation.Default);
                }
                break;

            case AdType.VideoRewardAd:
                if (Chartboost.hasRewardedVideo(CBLocation.Default))
                {
                    Chartboost.didCompleteRewardedVideo += (arg1, arg2) => {
                        if (AdFinished != null)
                        {
                            AdFinished.Invoke();
                        }
                    };
                    Chartboost.showRewardedVideo(CBLocation.Default);
                }
                break;
            }
            CacheAds();
        }
Ejemplo n.º 24
0
 public static void runAd()
 {
     if (Chartboost.hasInterstitial(CBLocation.Default))
     {
         Chartboost.showInterstitial(CBLocation.Default);
     }
 }
    void Start()
    {
        // Register callbacks for Grow Insights before initialization
        HighwayEvents.OnInsightsRefreshFinished += OnInsightsRefreshFinished;

        // Register callbacks for SOOMLA LevelUp before initialization
        LevelUpEvents.OnLevelEnded += OnLevelEnded;

        // Register callbacks for Chartboost events
        SetChartboostEvents();
        Chartboost.cacheInterstitial(CBLocation.LevelComplete);
        Chartboost.cacheRewardedVideo(CBLocation.LevelComplete);


        // Make sure to make this call in your earliest loading scene,
        // and before initializing any other SOOMLA/GROW components
        // i.e. before SoomlaStore.Initialize(...)
        GrowHighway.Initialize();
        GrowInsights.Initialize();

        // Initialize SOOMLA Store & LevelUp
        // Assumes you've implemented your store assets
        // and an initial world with levels and missions
        SoomlaStore.Initialize(new YourStoreAssetsImplementation());
        SoomlaLevelUp.Initialize(WORLD);
    }
Ejemplo n.º 26
0
 public static void runAddCoinsAd()
 {
     if (Chartboost.hasRewardedVideo(CBLocation.Default))
     {
         Chartboost.showRewardedVideo(CBLocation.Default);
     }
 }
Ejemplo n.º 27
0
    private bool ShowRewardedVideoGameOverCHARTBOOST(Action <bool> success)
    {
        if (Chartboost.hasRewardedVideo(CBLocation.Default))
        {
            Chartboost.showRewardedVideo(CBLocation.Default);

            Chartboost.didCompleteRewardedVideo += delegate(CBLocation arg1, int arg2) {
                Debug.Log("!!!!!! Chartboost didCompleteRewardedVideo at location : " + arg1.ToString());

                if (success != null)
                {
                    success(true);
                }
            };

            Chartboost.didFailToLoadRewardedVideo += delegate(CBLocation arg1, CBImpressionError arg2) {
                Debug.Log("!!!!!! Chartboost didFailToLoadRewardedVideo at location : " + arg1.ToString());

                if (success != null)
                {
                    success(false);
                }
            };

            return(true);
        }

        Chartboost.cacheRewardedVideo(CBLocation.Default);

        return(false);
    }
Ejemplo n.º 28
0
 public void BuyOrSelect()
 {
     string[] splitString = selectedButton.name.Split('-');
     if (PlayerPrefs.GetString(splitString[0]) == "true")           //select
     {
         PlayerPrefs.SetString("selected", splitString[0]);
         shopPanel.SetActive(false);
     }
     else             //buy
     {
         int coins = PlayerPrefs.GetInt("coins");
         if (splitString[1] != "Free")
         {
             coins = coins - int.Parse(splitString[1]);
         }
         if (coins >= 0)
         {
             PlayerPrefs.SetString(splitString[0], "true");
             if (splitString[0] == "BlueGuy")
             {
                 selectedButton.GetComponent <Image>().sprite = BlueGuy;
             }
             else if (splitString[0] == "WhiteGuy")
             {
                 selectedButton.GetComponent <Image>().sprite = WhiteGuy;
             }
             else if (splitString[0] == "BlackGuy")
             {
                 selectedButton.GetComponent <Image>().sprite = BlackGuy;
             }
             else if (splitString[0] == "Gold")
             {
                 Chartboost.cacheInterstitial(CBLocation.Default);
                 selectedButton.GetComponent <Image>().sprite = Gold;
             }
             else if (splitString[0] == "Ice")
             {
                 selectedButton.GetComponent <Image>().sprite = Ice;
             }
             else if (splitString[0] == "Smile")
             {
                 selectedButton.GetComponent <Image>().sprite = Smile;
             }
             else if (splitString[0] == "Ghost")
             {
                 selectedButton.GetComponent <Image>().sprite = Ghost;
             }
             else if (splitString[0] == "Radioactive")
             {
                 selectedButton.GetComponent <Image>().sprite = Radioactive;
             }
             else if (splitString[0] == "Drake")
             {
                 selectedButton.GetComponent <Image>().sprite = Drake;
             }
             PlayerPrefs.SetInt("coins", coins);
             text.text = PlayerPrefs.GetInt("coins").ToString();
         }
     }
 }
Ejemplo n.º 29
0
    /// <summary>
    /// Return true if a rewarded video is available (Chartboost and / or Unity Ads if integrated, please refere to the ADS_INTEGRATION_DOCUMENTATION.PDF)
    /// </summary>
    public bool RewardedVideoIsInitialized()
    {
        print("RewardedVideoIsInitialized method check");
        bool adsReady = false;


                #if CHARTBOOST
        adsReady = adsReady || Chartboost.hasRewardedVideo(CBLocation.Default);
        if (!Chartboost.hasRewardedVideo(CBLocation.Default))
        {
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }
                #endif

                #if ADCOLONY
        adsReady = adsReady || AdColony.IsVideoAvailable(ADCOLONY_RewardedVideoZoneID);
                #endif

                #if UNITY_ADS
        adsReady = adsReady || Advertisement.IsReady(rewardedVideoZoneUnityAds);
                #endif

        if (Application.isEditor)
        {
            adsReady = rewardedVideoAlwaysReadyInSimulator;
        }

        print("RewardedVideoIsInitialized method check finished, adsReady = " + adsReady);

        return(adsReady);
    }
Ejemplo n.º 30
0
        /// <summary>
        /// Chartboost specific event triggered after a rewarded video was closed
        /// </summary>
        /// <param name="obj"></param>
        void ReloadRewarded(CBLocation obj)
        {
            if (debug)
            {
                Debug.Log(this + "ReloadRewarded");
                ScreenWriter.Write(this + "ReloadRewarded");
            }
            if (triggerCompleteMethod == true)
            {
                if (OnCompleteMethod != null)
                {
                    OnCompleteMethod(false);
                    OnCompleteMethod      = null;
                    triggerCompleteMethod = false;
                }
                if (OnCompleteMethodWithAdvertiser != null)
                {
                    OnCompleteMethodWithAdvertiser(false, SupportedAdvertisers.Chartboost.ToString());
                    OnCompleteMethodWithAdvertiser = null;
                    triggerCompleteMethod          = false;
                }
            }

            //load another rewarded video
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }