コード例 #1
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;
		}
コード例 #2
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);
    }
コード例 #3
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);
        }
コード例 #4
0
    void LayoutButtons()

    {
        // The view with buttons to trigger the main Chartboost API calls

        GUILayout.Space(5);

        GUILayout.Label("Has Interstitial: " + hasInterstitial);

        if (GUILayout.Button("Cache Interstitial", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheInterstitial(CBLocation.Default);
        }



        if (GUILayout.Button("Show Interstitial", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.showInterstitial(CBLocation.Default);
        }



        GUILayout.Space(5);

        GUILayout.Label("Has Rewarded Video: " + hasRewardedVideo);

        if (GUILayout.Button("Cache Rewarded Video", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }



        if (GUILayout.Button("Show Rewarded Video", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.showRewardedVideo(CBLocation.Default);
        }

        GUILayout.Space(5);

        GUILayout.Label("Post install events:");

        if (GUILayout.Button("Send PIA Main Level Event", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, "Test Send mail level Information");
        }



        if (GUILayout.Button("Send PIA Sub Level Event", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, 2, "Test Send sub level Information");
        }

        if (GUILayout.Button("Track IAP", GUILayout.Width(ELEMENT_WIDTH)))
        {
            TrackIAP();
        }
    }
コード例 #5
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;
            }
        }
    }
コード例 #6
0
    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);
    }
コード例 #7
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);
    }
コード例 #8
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);
    }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     Chartboost.cacheInterstitial(CBLocation.Default);
     Chartboost.cacheRewardedVideo(CBLocation.Default);
     Chartboost.setAutoCacheAds(true);
 }
コード例 #10
0
 void Start()
 {
     delegateHistory = new List <string>();
     Chartboost.setShouldPauseClickForConfirmation(ageGate);
     Chartboost.setAutoCacheAds(autocache);
     Chartboost.cacheInterstitial(CBLocation.Default);
     Chartboost.cacheRewardedVideo(CBLocation.Default);
 }
コード例 #11
0
ファイル: ChartboostClientImpl.cs プロジェクト: akil03/bx
        //------------------------------------------------------------
        // Rewarded Ads.
        //------------------------------------------------------------

        public void LoadRewardedAd(AdLocation location)
        {
            #if EM_CHARTBOOST
            Chartboost.cacheRewardedVideo(location.ToChartboostLocation());
            #else
            Debug.LogError(NO_SDK_MESSAGE);
            #endif
        }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        Chartboost.cacheInterstitial(CBLocation.Default);
        Chartboost.cacheRewardedVideo(CBLocation.MainMenu);

        /** Cache rewarded video pre-roll message and video ad at location Main Menu.
         * See /assets/chartboost/scripts/chartboost.cs for available location options. **/

        Chartboost.cacheRewardedVideo(CBLocation.Default);
    }
コード例 #13
0
 public void ShowGameOverRewardedVideo()
 {
     if (Chartboost.hasCachedRewardedVideo())
     {
         Chartboost.showRewardedVideo();
     }
     else
     {
         Chartboost.cacheRewardedVideo();
     }
 }
コード例 #14
0
 public void showRewardAd()
 {
     if (Chartboost.hasRewardedVideo(CBLocation.Default))
     {
         Chartboost.showRewardedVideo(CBLocation.locationFromName("Default"));
     }
     else
     {
         Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
         UseReviveText.text = "Failed, Try Again";
     }
 }
コード例 #15
0
    void Start()
    {
        Chartboost.init("55bb8a96c909a66315763faa",
                        "5ee308bc8a482c70f6408d8a75a5789cad00d580",
                        "55bb8a96c909a66315763fa9",
                        "c70bb9fe554de9639e875dc6ccf2da3618a2517b");

        ChartboostAndroid.setImpressionsUseActivities(true);

        Chartboost.cacheInterstitial();
        Chartboost.cacheRewardedVideo();
    }
コード例 #16
0
 public void ShowRewardVideo()
 {
     if (Chartboost.hasRewardedVideo(CBLocation.MainMenu) == true && PlayerPrefs.GetString("NoAdsShow") == "false")
     {
         Debug.Log("Showing Reward Video");
         Chartboost.showRewardedVideo(CBLocation.MainMenu);
     }
     else
     {
         // We don't have a cached video right now, but try to get one for next time
         Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
         Debug.Log("Does not have a video cached");
     }
 }
コード例 #17
0
ファイル: AdManager.cs プロジェクト: ttat/puzzlewarrior
    public void CacheAd(AdNetwork network, DisplayedAdType displayType, CBLocation location)
    {
#if ADFREE
        // Don't cache if Ad-free
        return;
#endif

        if (Debug.isDebugBuild)
        {
            Debug.Log("Caching ad");
        }

        switch (displayType)
        {
        case DisplayedAdType.FullScreen:

#if !MOREAPPSONLY
            switch (network)
            {
            case AdNetwork.ChartBoost:
            default:
                Chartboost.cacheInterstitial(location);
                break;
            }
#endif

            break;

        case DisplayedAdType.MoreGames:
            switch (network)
            {
            case AdNetwork.ChartBoost:
            default:
                Chartboost.cacheMoreApps(location);
                break;
            }
            break;

        case DisplayedAdType.Video:
            switch (network)
            {
            case AdNetwork.ChartBoost:
            default:
                Chartboost.cacheRewardedVideo(location);
                break;
            }
            break;
        }
    }
コード例 #18
0
        /// <summary>
        /// Loads a Chartboost rewarded video
        /// </summary>
        void LoadRewardedVideo()
        {
#if UNITY_IOS
            if (debug)
            {
                Debug.Log(this + " LoadRewardedVideo id:" + CBSettings.getIOSAppId() + " signature " + CBSettings.getIOSAppSecret());
                ScreenWriter.Write(this + " LoadRewardedVideo id:" + CBSettings.getIOSAppId() + " signature " + CBSettings.getIOSAppSecret());
            }
#else
            if (debug)
            {
                Debug.Log(this + " LoadRewardedVideo id:" + CBSettings.getAndroidAppId() + " signature " + CBSettings.getAndroidAppSecret());
                ScreenWriter.Write(this + " LoadRewardedVideo id:" + CBSettings.getAndroidAppId() + " signature " + CBSettings.getAndroidAppSecret());
            }
#endif
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }
コード例 #19
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;
    }
コード例 #20
0
        private void SetModeAndDelegates()
        {
            switch (context.mode)
            {
            case AdzeContext.Mode.Interstitial:
                chartboostShow  = () => Chartboost.showInterstitial(cbLocation);
                isLoaded        = () => Chartboost.hasInterstitial(cbLocation);
                chartboostCache = () => Chartboost.cacheInterstitial(cbLocation);
                SetupInterstitialDelegates();
                break;

            case AdzeContext.Mode.Reward:
                chartboostShow  = () => Chartboost.showRewardedVideo(cbLocation);
                isLoaded        = () => Chartboost.hasRewardedVideo(cbLocation);
                chartboostCache = () => Chartboost.cacheRewardedVideo(cbLocation);
                SetupRewardDelegates();
                break;
            }
        }
コード例 #21
0
        public void Init()
        {
            print("AAChartboost - Init");

            CBSettings settings = ScriptableObject.CreateInstance <CBSettings>();


            string amazonAppId     = adIds.ChartboostAppIdAmazon;
            string amazonAppSecret = adIds.ChartboostAppSignatureAmazon;

            string androidAppId     = adIds.ChartboostAppIdAndroid;
            string androidAppSecret = adIds.ChartboostAppSignatureAndroid;



            settings.iOSAppId     = adIds.ChartboostAppIdIOS;
            settings.iOSAppSecret = adIds.ChartboostAppSignatureIOS;

            settings.SetIOSAppId(adIds.ChartboostAppIdIOS);
            settings.SetIOSAppSecret(adIds.ChartboostAppSignatureIOS);



#if ANDROID_AMAZON
            SetAndroidIds(settings, amazonAppId, amazonAppSecret);
#else
            SetAndroidIds(settings, androidAppId, androidAppSecret);
#endif



            var c = FindObjectOfType <Chartboost>();

            if (c == null)
            {
                gameObject.AddComponent <Chartboost>();
            }

            Chartboost.setAutoCacheAds(true);
            Chartboost.cacheInterstitial(CBLocation.Default);
            Chartboost.cacheInterstitial(CBLocation.Startup);
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }
コード例 #22
0
    // Use this for initialization
    void Start()
    {
        Chartboost.cacheInterstitial(CBLocation.Default);
        Chartboost.cacheRewardedVideo(CBLocation.Default);

        /** Cache rewarded video pre-roll message and video ad at location Main Menu.
         * See /assets/chartboost/scripts/chartboost.cs for available location options. **/

        Chartboost.cacheRewardedVideo(CBLocation.Default);

        if (Chartboost.hasRewardedVideo(CBLocation.Default))
        {
            Chartboost.showRewardedVideo(CBLocation.Default);
        }
        else
        {
            // We don't have a cached video right now, but try to get one for next time
            Chartboost.cacheRewardedVideo(CBLocation.Default);
            Debug.Log("Does not have a video cached");
        }
    }
コード例 #23
0
    // Use this for initialization


    void Start()
    {
        Chartboost.setAutoCacheAds(true);


        Chartboost.cacheInterstitial(CBLocation.Default);
        Chartboost.cacheInterstitial(CBLocation.HomeScreen);
        Chartboost.cacheInterstitial(CBLocation.Quit);
        Chartboost.cacheRewardedVideo(CBLocation.Default);
        Chartboost.cacheMoreApps(CBLocation.Default);
        Chartboost.cacheMoreApps(CBLocation.Settings);

        Chartboost.didDismissRewardedVideo    += Chartboost_didDismissRewardedVideo;
        Chartboost.didCompleteRewardedVideo   += Chartboost_didCompleteRewardedVideo;
        Chartboost.didFailToLoadRewardedVideo += Chartboost_didFailToLoadRewardedVideo;
        Chartboost.didDisplayRewardedVideo    += Chartboost_didDisplayRewardedVideo;
        Chartboost.didFailToLoadMoreApps      += Chartboost_didFailToLoadMoreApps;
        Chartboost.didCacheMoreApps           += Chartboost_didCacheMoreApps;

        Chartboost.didCloseInterstitial += Chartboost_didCloseInterstitial;
        // Chartboost.showInterstitial(CBLocation.HomeScreen);
        //Chartboost.showRewardedVideo(CBLocation.Default);
    }
コード例 #24
0
    public void Awake()
    {
        Debug.Log("Caching Video");
        Chartboost.cacheRewardedVideo(CBLocation.MainMenu);
        Chartboost.cacheInterstitial(CBLocation.Default);

        SFXIcon = SFXIcon.gameObject.GetComponent <Image>();

        if (SFXIcon.sprite == MuteIcon)
        {
            //Mute sounds
            AudioListener.volume = 0;
        }
        else if (SFXIcon.sprite == UnMuteIcon)
        {
            //UnMute sounds
            AudioListener.volume = 1;
        }

        //disable settings panel by default
        SettingsPanel.SetActive(false);

        PlayerAllTimeHighScoreText = PlayerAllTimeHighScoreGameObject.GetComponent <Text>();

        //LoadStoredHighScoreValue();

        PlayerAllTimeHighScoreText.text = PlayerAllTimeHighScore.ToString();

        Cloud.Storage.Save();

        // Update player name

        if (Cloud.IsSignedIn)
        {
            playerNameText.text = string.Format("Welcome {0}", Cloud.PlayerDisplayName);
        }
    }
コード例 #25
0
 private void manageAds(int numAds = 0)
 {
     ///numAds = 0: Carica i video
     ///numAds = 1: Interstitial
     ///numAds = 2: rewarded
     if (Chartboost.hasInterstitial(CBLocation.Default) == true && numAds == 1)
     {
         Chartboost.showInterstitial(CBLocation.Default);
     }
     else
     {
         Debug.LogError("NO INTERSTITIAL");
         Chartboost.cacheInterstitial(CBLocation.Default);
     }
     if (Chartboost.hasRewardedVideo(CBLocation.Default) == true && numAds == 2)
     {
         Chartboost.showRewardedVideo(CBLocation.Default);
     }
     else
     {
         Debug.LogError("NO REWARDED VIDEO");
         Chartboost.cacheRewardedVideo(CBLocation.Default);
     }
 }
コード例 #26
0
    IEnumerator Start()
    {
        yield return(0);

        GC.Collect();

        Resources.UnloadUnusedAssets();

        Application.targetFrameRate = 60;

        if (!NO_ADS)
        {
                        #if UNITY_IOS && (STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS)
            if (!useAdmob)
            {
                        #endif
                                #if UNITY_IOS
            fullscreenAd = new ADInterstitialAd();
            ADInterstitialAd.onInterstitialWasLoaded += OnFullscreenLoaded;
                                #if !UNITY_4_6 && !UNITY_5_0 && !UNITY_5_1
            ADInterstitialAd.onInterstitialWasViewed += OnFullscreenViewed;
                                #endif
                                #endif

                                #if UNITY_IOS && (STAN_ASSET_GOOGLEMOBILEADS || STAN_ASSET_ANDROIDNATIVE || GOOGLE_MOBILE_ADS)
        }
                                #endif

                        #if STAN_ASSET_GOOGLEMOBILEADS
            if (!GoogleMobileAd.IsInited)
            {
                GoogleMobileAd.Init();
            }
                        #endif

                        #if STAN_ASSET_ANDROIDNATIVE
            if (!AndroidAdMobController.Instance.IsInited)
            {
                Set();
            }
                        #endif

                        #if CHARTBOOST
            Chartboost.setAutoCacheAds(true);

            Chartboost.cacheInterstitial(CBLocation.Default);

            Chartboost.cacheRewardedVideo(CBLocation.Default);
                        #endif

            yield return(new WaitForSeconds(1));

            ShowBanner();

            yield return(new WaitForSeconds(1));

            if (ShowIntertitialAtStart)
            {
                _ShowInterstitial();
            }
        }
    }
コード例 #27
0
 public void CacheRewardedVideo()
 {
     print("AAChartboost - CacheRewardedVideo");
     Chartboost.cacheRewardedVideo(CBLocation.Default);
 }
コード例 #28
0
ファイル: QChartboost.cs プロジェクト: Saferer/happy-mapper
 public void RequestRewardedAd()
 {
     QuickAds.instance.ReportOnScreen("Request for rewarded ad from Chartbooost");
     Chartboost.cacheRewardedVideo(CBLocation.Default);
     LoadRewardedCallbacks();
 }
    void OnGUI()
    {
/*
 #if UNITY_ANDROID
 *              // Disable user input for GUI when impressions are visible
 *              // This is only necessary on Android if we have disabled impression activities
 *              //   by having called CBBinding.init(ID, SIG, false), as that allows touch
 *              //   events to leak through Chartboost impressions
 *              GUI.enabled = !Chartboost.isImpressionVisible();
 #endif
 */
        GUI.matrix = Matrix4x4.Scale(new Vector3(5, 5, 5));

        if (GUILayout.Button("Cache Interstitial"))
        {
            Chartboost.cacheInterstitial(CBLocation.Default);
        }

        if (GUILayout.Button("Show Interstitial"))
        {
            Chartboost.showInterstitial(CBLocation.Default);
        }

        if (GUILayout.Button("Cache More Apps"))
        {
            Chartboost.cacheMoreApps(CBLocation.Default);
        }

        if (GUILayout.Button("Show More Apps"))
        {
            Chartboost.showMoreApps(CBLocation.Default);
        }

        if (GUILayout.Button("Cache Rewarded Video"))
        {
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }

        if (GUILayout.Button("Show Rewarded Video"))
        {
            Chartboost.showRewardedVideo(CBLocation.Default);
        }

        if (GUILayout.Button("Cache InPlay Ad"))
        {
            Chartboost.cacheInPlay(CBLocation.Default);
        }

        if (GUILayout.Button("Show InPlay Ad"))
        {
            inPlayAd = Chartboost.getInPlay(CBLocation.Default);
            if (inPlayAd != null)
            {
                // Set the texture of InPlay Ad Icon
                // Link its onClick() event with inPlay's click()
                inPlayIcon.guiTexture.texture = inPlayAd.appIcon;
                inPlayText.guiText.text       = inPlayAd.appName;
                inPlayAd.show();
            }
        }
    }
コード例 #30
0
    void LayoutButtons()
    {
        // The view with buttons to trigger the main Chartboost API calls
        GUILayout.Space(5);
        GUILayout.Label("Has Interstitial: " + hasInterstitial);

        if (GUILayout.Button("Cache Interstitial", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheInterstitial(CBLocation.Default);
        }

        if (GUILayout.Button("Show Interstitial", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.showInterstitial(CBLocation.Default);
        }

        GUILayout.Space(5);
        GUILayout.Label("Has MoreApps: " + hasMoreApps);
        if (GUILayout.Button("Cache More Apps", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheMoreApps(CBLocation.Default);
        }

        if (GUILayout.Button("Show More Apps", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.showMoreApps(CBLocation.Default);
        }

        GUILayout.Space(5);
        GUILayout.Label("Has Rewarded Video: " + hasRewardedVideo);
        if (GUILayout.Button("Cache Rewarded Video", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheRewardedVideo(CBLocation.Default);
        }

        if (GUILayout.Button("Show Rewarded Video", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.showRewardedVideo(CBLocation.Default);
        }

        GUILayout.Space(5);
        GUILayout.Label("Has InPlay: " + hasInPlay);
        if (GUILayout.Button("Cache InPlay Ad", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.cacheInPlay(CBLocation.Default);
        }

        if (GUILayout.Button("Show InPlay Ad", GUILayout.Width(ELEMENT_WIDTH)))
        {
            inPlayAd = Chartboost.getInPlay(CBLocation.Default);
            if (inPlayAd != null)
            {
                inPlayAd.show();
            }
        }
        if (inPlayAd != null)
        {
            // Set the texture of InPlay Ad Icon
            // Link its onClick() event with inPlay's click()
            GUILayout.Label("app: " + inPlayAd.appName);
            if (GUILayout.Button(inPlayAd.appIcon, GUILayout.Width(ELEMENT_WIDTH)))
            {
                inPlayAd.click();
            }
        }

        GUILayout.Space(5);
        GUILayout.Label("Post install events:");
        if (GUILayout.Button("Send PIA Main Level Event", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, "Test Send mail level Information");
        }

        if (GUILayout.Button("Send PIA Sub Level Event", GUILayout.Width(ELEMENT_WIDTH)))
        {
            Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, 2, "Test Send sub level Information");
        }

        if (GUILayout.Button("Track IAP", GUILayout.Width(ELEMENT_WIDTH)))
        {
            TrackIAP();
        }
    }