public void ShowInPlayAd() { inPlayAd = Chartboost.getInPlay(CBLocation.Default); if (inPlayAd != null) { inPlayAd.show(); //inPlayAd.appName //if(GUILayout.Button(inPlayAd.appIcon, GUILayout.Width(ELEMENT_WIDTH))) { // inPlayAd.click(); //} } }
public static CBInPlay showInApp(RawImage image, Text caption, CBLocation loc) { CBInPlay inPlayAd = Chartboost.getInPlay(loc); if (inPlayAd != null) { image.texture = inPlayAd.appIcon; caption.text = inPlayAd.appName; inPlayAd.show(); return(inPlayAd); } return(null); }
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(); } } }
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 */ scrollPosition = GUI.BeginScrollView(new Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height - 50), scrollPosition, new Rect(0, 0, UnityEngine.Screen.width - 50, UnityEngine.Screen.height)); GUI.matrix = Matrix4x4.Scale(new Vector3(3, 3, 3)); if (GUILayout.Button("Cache Interstitial")) { Chartboost.cacheInterstitial(CBLocation.GameOver); } if (GUILayout.Button("Show Interstitial")) { Chartboost.showInterstitial(CBLocation.GameOver); } 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.GetComponent <GUITexture>().texture = inPlayAd.appIcon; inPlayText.GetComponent <GUIText>().text = inPlayAd.appName; inPlayAd.show(); } } if (GUILayout.Button("Send PIA Main Level Event")) { Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, "Test Send mail level Informatoion"); } if (GUILayout.Button("Send PIA Sub Level Event")) { Chartboost.trackLevelInfo("Test Data", CBLevelType.HIGHEST_LEVEL_REACHED, 1, 2, "Test Send sub level Informatoion"); } #if UNITY_IPHONE if (GUILayout.Button("Track IAP")) { TrackIAP(); } #endif GUI.EndScrollView(); }
void OnGUI() { #if TESTMODE_CHARTBOOST /* #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("Init Chatboost")) { #if UNITY_IOS Chartboost.init("54ca1abf04b0163ff3221c8d", "c232af7185297173942d04877791032505ec4c08"); #elif UNITY_ANDROID Chartboost.init("54ca2d4cc909a67eaaad9bad", "c85f8a761c7e159ddfcdc37f0e96141a65a1ad8a"); #endif } if (GUILayout.Button("Cache Interstitial")) { Chartboost.cacheInterstitial(CBLocation.Default); } if (GUILayout.Button("Show Interstitial")) { if (Chartboost.hasInterstitial(CBLocation.Default)) { Chartboost.showInterstitial(CBLocation.Default); //Invoke("randShow", 0.1f); } else { Debug.Log("Interstitial ad has not cached yet"); } } if (GUILayout.Button("Cache More Apps")) { Chartboost.cacheMoreApps(CBLocation.Default); } if (GUILayout.Button("Show More Apps")) { if (Chartboost.hasMoreApps(CBLocation.Default)) { Chartboost.showMoreApps(CBLocation.Default); //Invoke("randShow", 0.1f); } else { Debug.Log("Moreapps has not cached yet"); } } if (GUILayout.Button("Cache Rewarded Video")) { Chartboost.cacheRewardedVideo(CBLocation.Default); } if (GUILayout.Button("Show Rewarded Video")) { if (Chartboost.hasRewardedVideo(CBLocation.Default)) { Chartboost.showRewardedVideo(CBLocation.Default); //Invoke("randShow", 0.1f); } else { Debug.Log("Reward video ad has not cached yet"); } } if (GUILayout.Button("Cache InPlay Ad")) { Chartboost.cacheInPlay(CBLocation.Default); } if (GUILayout.Button("Show InPlay Ad")) { if (Chartboost.hasInPlay(CBLocation.Default)) { 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(); } } else { Debug.Log("InPlayAd has not cached yet"); } } #endif }