void DrawAdColonySettings() { EditorGUILayout.Space(); DrawUppercaseSection("ADCOLONY_SETUP_FOLDOUT_KEY", "ADCOLONY", () => { #if !EM_ADCOLONY EditorGUILayout.HelpBox(AdColonyImportInstruction, MessageType.Warning); if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadAdColonyPlugin(); } #else EditorGUILayout.HelpBox(AdColonyAvailMsg, MessageType.Info); if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadAdColonyPlugin(); } // App ID. EditorGUILayout.Space(); EditorGUILayout.LabelField("App ID", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.adColonyAppId.property, AdProperties.adColonyAppId.content, true); EditorGUI.indentLevel--; // Default Placements. EditorGUILayout.Space(); EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.adColonyDefaultInterstitialAdId.property, AdProperties.adColonyDefaultInterstitialAdId.content, true); EditorGUILayout.PropertyField(AdProperties.adColonyDefaultRewardedAdId.property, AdProperties.adColonyDefaultRewardedAdId.content, true); EditorGUI.indentLevel--; // Custom placements. EditorGUILayout.Space(); EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.adColonyCustomInterstitialAdIds.property, AdProperties.adColonyCustomInterstitialAdIds.content, true); EditorGUILayout.PropertyField(AdProperties.adColonyCustomRewardedAdIds.property, AdProperties.adColonyCustomRewardedAdIds.content, true); EditorGUI.indentLevel--; // Ad settings. EditorGUILayout.Space(); EditorGUILayout.LabelField("Ad Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(AdProperties.adColonyAdOrientation.property, AdProperties.adColonyAdOrientation.content); EditorGUILayout.PropertyField(AdProperties.adColonyEnableRewardedAdPrePopup.property, AdProperties.adColonyEnableRewardedAdPrePopup.content); EditorGUILayout.PropertyField(AdProperties.adColonyEnableRewardedAdPostPopup.property, AdProperties.adColonyEnableRewardedAdPostPopup.content); #endif }); }
void AdModuleGUI() { EditorGUILayout.BeginVertical(EM_GUIStyleManager.GetCustomStyle("Module Box")); EditorGUI.BeginChangeCheck(); isAdModuleEnable.boolValue = EM_EditorGUI.ModuleToggle(isAdModuleEnable.boolValue, AdModuleLabel); if (EditorGUI.EndChangeCheck()) { GameObject prefab = EM_EditorUtil.GetMainPrefab(); if (!isAdModuleEnable.boolValue) { EM_PluginManager.DisableAdModule(prefab); } else { EM_PluginManager.EnableAdModule(prefab); } } // Now draw the GUI. if (!isAdModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(AdModuleIntro, MessageType.Info); } else { // AdColony setup EditorGUILayout.Space(); EditorGUILayout.LabelField("ADCOLONY SETUP", EditorStyles.boldLabel); #if !EM_ADCOLONY EditorGUILayout.HelpBox(AdColonyImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadAdColonyPlugin(); } #else EditorGUILayout.HelpBox(AdColonyAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download AdColony Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadAdColonyPlugin(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("AdColony IDs", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosAdColonyConfig.property, AdProperties.iosAdColonyConfig.content, true); EditorGUILayout.PropertyField(AdProperties.androidAdColonyConfig.property, AdProperties.androidAdColonyConfig.content, true); EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField("Ad Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(AdProperties.adColonyShowRewardedAdPrePopup.property, AdProperties.adColonyShowRewardedAdPrePopup.content); EditorGUILayout.PropertyField(AdProperties.adColonyShowRewardedAdPostPopup.property, AdProperties.adColonyShowRewardedAdPostPopup.content); EditorGUILayout.PropertyField(AdProperties.adColonyAdOrientation.property, AdProperties.adColonyAdOrientation.content); #endif // AdMob setup EditorGUILayout.Space(); EditorGUILayout.LabelField("ADMOB SETUP", EditorStyles.boldLabel); #if !EM_ADMOB EditorGUILayout.HelpBox(AdMobImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin(); } #else EditorGUILayout.HelpBox(AdMobAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Google Mobile Ads Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadGoogleMobileAdsPlugin(); } // IDs. EditorGUILayout.Space(); EditorGUILayout.LabelField("AdMob IDs", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosAdMobConfig.property, AdProperties.iosAdMobConfig.content, true); EditorGUILayout.PropertyField(AdProperties.androidAdMobConfig.property, AdProperties.androidAdMobConfig.content, true); EditorGUI.indentLevel--; // Ad targeting settings. EditorGUILayout.Space(); DrawAdMobTargetingSettings(AdProperties.admobTargeting.property, AdProperties.admobTargeting.content); // Test mode. EditorGUILayout.Space(); EditorGUILayout.LabelField("Test Mode", EditorStyles.boldLabel); EditorGUILayout.PropertyField(AdProperties.admobEnableTestMode.property, AdProperties.admobEnableTestMode.content); if (AdProperties.admobEnableTestMode.property.boolValue) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.admobTestDeviceIds.property, AdProperties.admobTestDeviceIds.content, true); EditorGUI.indentLevel--; } else { // Clear test device IDs when test mode is disable for safety. AdProperties.admobTestDeviceIds.property.ClearArray(); } #endif // Chartboost setup EditorGUILayout.Space(); EditorGUILayout.LabelField("CHARTBOOST SETUP", EditorStyles.boldLabel); #if !EM_CHARTBOOST EditorGUILayout.HelpBox(ChartboostImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadChartboostPlugin(); } #else EditorGUILayout.HelpBox(ChartboostAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Chartboost Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadChartboostPlugin(); } if (GUILayout.Button("Setup Chartboost", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { // Open Chartboost settings window. ChartboostSDK.CBSettings.Edit(); } #endif // Heyzap setup EditorGUILayout.Space(); EditorGUILayout.LabelField("HEYZAP SETUP", EditorStyles.boldLabel); #if !EM_HEYZAP EditorGUILayout.HelpBox(HeyzapImportInstruction, MessageType.Warning); EditorGUILayout.Space(); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } #else EditorGUILayout.HelpBox(HeyzapAvailMsg, MessageType.Info); EditorGUILayout.Space(); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } EditorGUILayout.Space(); AdProperties.heyzapPublisherId.property.stringValue = EditorGUILayout.TextField(AdProperties.heyzapPublisherId.content, AdProperties.heyzapPublisherId.property.stringValue); AdProperties.heyzapShowTestSuite.property.boolValue = EditorGUILayout.Toggle(AdProperties.heyzapShowTestSuite.content, AdProperties.heyzapShowTestSuite.property.boolValue); #endif // UnityAds setup EditorGUILayout.Space(); EditorGUILayout.LabelField("UNITY ADS SETUP", EditorStyles.boldLabel); #if !UNITY_ADS EditorGUILayout.HelpBox(UnityAdsUnvailableWarning, MessageType.Warning); #else EditorGUILayout.HelpBox(UnityAdsAvailableMsg, MessageType.Info); #endif // Ads auto-load setup EditorGUILayout.Space(); EditorGUILayout.LabelField("AUTO AD-LOADING CONFIG", EditorStyles.boldLabel); AdProperties.autoLoadDefaultAds.property.boolValue = EditorGUILayout.Toggle(AdProperties.autoLoadDefaultAds.content, AdProperties.autoLoadDefaultAds.property.boolValue); AdProperties.adCheckingInterval.property.floatValue = EditorGUILayout.FloatField(AdProperties.adCheckingInterval.content, AdProperties.adCheckingInterval.property.floatValue); AdProperties.adLoadingInterval.property.floatValue = EditorGUILayout.FloatField(AdProperties.adLoadingInterval.content, AdProperties.adLoadingInterval.property.floatValue); EditorGUILayout.Space(); EditorGUILayout.LabelField("DEFAULT AD NETWORKS", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosDefaultAdNetworks.property, AdProperties.iosDefaultAdNetworks.content, true); EditorGUILayout.PropertyField(AdProperties.androidDefaultAdNetworks.property, AdProperties.androidDefaultAdNetworks.content, true); EditorGUI.indentLevel--; // Now check if there's any default ad network that doesn't have plugin imported and show warnings. AdSettings.DefaultAdNetworks iosDefault = EM_Settings.Advertising.IosDefaultAdNetworks; AdSettings.DefaultAdNetworks androidDefault = EM_Settings.Advertising.AndroidDefaultAdNetworks; List <AdNetwork> usedNetworks = new List <AdNetwork>(); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.bannerAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.interstitialAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)iosDefault.rewardedAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.bannerAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.interstitialAdNetwork); AddWithoutRepeat(usedNetworks, (AdNetwork)androidDefault.rewardedAdNetwork); bool addedSpace = false; foreach (AdNetwork network in usedNetworks) { if (!IsPluginAvail(network)) { if (!addedSpace) { EditorGUILayout.Space(); addedSpace = true; } EditorGUILayout.HelpBox("Default ad network " + network.ToString() + " has no SDK. Please import its plugin.", MessageType.Warning); } } } EditorGUILayout.EndVertical(); }