void DrawHeyzapSettings() { EditorGUILayout.Space(); DrawUppercaseSection("HEYZAP_SETUP_FOLDOUT_KEY", "HEYZAP (FYBER)", () => { #if !EM_HEYZAP EditorGUILayout.HelpBox(HeyzapImportInstruction, MessageType.Warning); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } #else EditorGUILayout.HelpBox(HeyzapAvailMsg, MessageType.Info); if (GUILayout.Button("Download Heyzap Plugin", GUILayout.Height(EM_GUIStyleManager.buttonHeight))) { EM_ExternalPluginManager.DownloadHeyzapPlugin(); } EditorGUILayout.Space(); // Publisher ID. EditorGUILayout.LabelField("Publisher ID", EditorStyles.boldLabel); AdProperties.heyzapPublisherId.property.stringValue = EditorGUILayout.TextField(AdProperties.heyzapPublisherId.content, AdProperties.heyzapPublisherId.property.stringValue); // Placements. EditorGUILayout.Space(); EditorGUILayout.LabelField("Default Placement", EditorStyles.boldLabel); EditorGUILayout.HelpBox(HeyzapDefaultAdPlacementMsg, MessageType.None); // Custom Placements. EditorGUILayout.Space(); EditorGUILayout.LabelField("Custom Placements", EditorStyles.boldLabel); EditorGUILayout.HelpBox(HeyzapCustomAdPlacementMsg, MessageType.None); EditorGUI.indentLevel++; if (DrawPropertyAsResizableArray(AdProperties.heyzapCustomInterstitialPlacements.property, AdProperties.heyzapCustomInterstitialPlacements.content, null, null, true)) { DrawAllElementsInArrayProperty(AdProperties.heyzapCustomInterstitialPlacements.property); } EditorGUI.indentLevel--; EditorGUI.indentLevel++; if (DrawPropertyAsResizableArray(AdProperties.heyzapCustomRewardedPlacements.property, AdProperties.heyzapCustomRewardedPlacements.content, null, null, true)) { DrawAllElementsInArrayProperty(AdProperties.heyzapCustomRewardedPlacements.property); } EditorGUI.indentLevel--; // Test mode. EditorGUILayout.Space(); EditorGUILayout.LabelField("Test Mode", EditorStyles.boldLabel); AdProperties.heyzapShowTestSuite.property.boolValue = EditorGUILayout.Toggle(AdProperties.heyzapShowTestSuite.content, AdProperties.heyzapShowTestSuite.property.boolValue); #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_Manager.DisableAdModule(prefab); } else { EM_Manager.EnableAdModule(prefab); } } // Now draw the GUI. if (!isAdModuleEnable.boolValue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(AdModuleIntro, MessageType.Info); } else { // 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(); } EditorGUILayout.Space(); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(AdProperties.iosAdMobConfig.property, AdProperties.iosAdMobConfig.content, true); EditorGUILayout.PropertyField(AdProperties.androidAdMobConfig.property, AdProperties.androidAdMobConfig.content, true); EditorGUI.indentLevel--; #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(); }