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(); } }
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(2, 2, 2)); 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(); } } }