Пример #1
0
 private void OnWarningGUI(string title, string message, MessageType type)
 {
     HelpStyles.BeginBoxScope();
     EditorGUILayout.HelpBox(title, type);
     EditorGUILayout.LabelField(message, EditorStyles.wordWrappedLabel);
     HelpStyles.EndBoxScope();
 }
Пример #2
0
        private void OnUserTrackingDesctiptionGUI()
        {
            if (platform != BuildTarget.iOS)
            {
                return;
            }
            HelpStyles.BeginBoxScope();
            var enabled = userTrackingUsageDescriptionProp.arraySize > 0;

            EditorGUILayout.BeginHorizontal();
            if (enabled != EditorGUILayout.ToggleLeft("Set User Tracking Usage description in Info.plist", enabled))
            {
                enabled = !enabled;
                if (enabled)
                {
                    var defDescr = Utils.DefaultUserTrackingUsageDescription();
                    userTrackingUsageDescriptionProp.arraySize = defDescr.Length;
                    for (int i = 0; i < defDescr.Length; i++)
                    {
                        var pair = userTrackingUsageDescriptionProp.GetArrayElementAtIndex(i);
                        pair.Next(true);
                        pair.stringValue = defDescr[i].key;
                        pair.Next(false);
                        pair.stringValue = defDescr[i].value;
                    }
                }
                else
                {
                    userTrackingUsageDescriptionProp.ClearArray();
                }
            }
            HelpStyles.HelpButton(Utils.gitUnityRepoURL + "/wiki/App-Tracking-Transparency");
            EditorGUILayout.EndHorizontal();
            if (enabled)
            {
                userTrackingList.DoLayoutList();
            }
            HelpStyles.EndBoxScope();
        }
Пример #3
0
        internal void OnGUI(BuildTarget platform)
        {
            if (!installedAny)
            {
                EditorGUILayout.HelpBox("Dependencies of native SDK were not found. " +
                                        "Please use the following options to integrate solutions or any SDK separately.",
                                        MessageType.Error);
            }

            CheckDependencyUpdates(platform);

            columnWidth = GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth * 0.15f);


            if (simple.Length > 0)
            {
                HelpStyles.BeginBoxScope();
                solutionsFoldout = GUILayout.Toggle(solutionsFoldout, "Solutions", EditorStyles.foldout);
                if (solutionsFoldout)
                {
                    OnHeaderGUI();
                    for (int i = 0; i < simple.Length; i++)
                    {
                        simple[i].OnGUI(this, platform);
                    }
                }
                HelpStyles.EndBoxScope();
            }

            if (advanced.Length > 0)
            {
                HelpStyles.BeginBoxScope();

                if (advancedFoldout)
                {
                    advancedFoldout = GUILayout.Toggle(advancedFoldout, "Advanced Integration", EditorStyles.foldout);
                    OnHeaderGUI();
                    for (int i = 0; i < advanced.Length; i++)
                    {
                        advanced[i].OnGUI(this, platform);
                    }
                }
                else
                {
                    int installed = 0;

                    for (int i = 0; i < advanced.Length; i++)
                    {
                        if (advanced[i].installedVersion.Length > 0)
                        {
                            installed++;
                            if (advanced[i].notSupported && Event.current.type == EventType.Repaint)
                            {
                                advancedFoldout = true;
                                Debug.LogError(Utils.logTag + advanced[i].name +
                                               " Dependencies found that are not valid for the applications of the selected audience.");
                            }
                        }
                    }
                    advancedFoldout = GUILayout.Toggle(advancedFoldout, "Advanced Integration (" + installed + ")", EditorStyles.foldout);
                }
                HelpStyles.EndBoxScope();
            }
            if (other.Count > 0)
            {
                HelpStyles.BeginBoxScope();
                otherFoldout = GUILayout.Toggle(otherFoldout, "Other Active Dependencies: " + other.Count, EditorStyles.foldout);
                if (otherFoldout)
                {
                    for (int i = 0; i < other.Count; i++)
                    {
                        other[i].OnGUI(this);
                    }
                }
                HelpStyles.EndBoxScope();
            }
        }
Пример #4
0
        private void OnEDMAreaGUI()
        {
            if (edmVersion == null)
            {
                HelpStyles.BeginBoxScope();
                EditorGUILayout.HelpBox("In order to properly include third party dependencies in your project, " +
                                        "an External Dependency Manager is required.", MessageType.Error);
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("1. Download latest EDM4U.unitypackage", GUILayout.ExpandWidth(false));
                if (GUILayout.Button("here", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                {
                    Application.OpenURL(Utils.latestEMD4uURL);
                }
                EditorGUILayout.EndHorizontal();
                GUILayout.Label("2. Import the EDM4U.unitypackage into your project.");
                HelpStyles.EndBoxScope();
                return;
            }
            if (edmRequiredNewer)
            {
                if (HelpStyles.WarningWithButton("To properly include third-party dependencies in your project, " +
                                                 "you need an External Dependency Manager version " + Utils.minEDM4UVersion + " or later.",
                                                 "Download"))
                {
                    Application.OpenURL(Utils.latestEMD4uURL);
                }
            }

            if (platform == BuildTarget.Android)
            {
#if UNITY_2019_3_OR_NEWER
                OnGradleTemplateDisabledGUI("Base Gradle", Utils.projectGradlePath);
                OnGradleTemplateDisabledGUI("Launcher Gradle", Utils.launcherGradlePath);
                OnGradleTemplateDisabledGUI("Gradle Properties", Utils.propertiesGradlePath);
#else
                OnGradleTemplateDisabledGUI("Gradle", Utils.mainGradlePath);
#endif

                if (HelpStyles.WarningWithButton("Changing dependencies will change the project settings. " +
                                                 "Please use Android Resolver after the change complete.", "Resolve", MessageType.Info))
                {
                    if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
                    {
                        var succses = Utils.TryResolveAndroidDependencies();
                        EditorUtility.DisplayDialog("Android Dependencies",
                                                    succses ? "Resolution Succeeded" : "Resolution Failed. See the log for details.",
                                                    "OK");
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("Android Dependencies",
                                                    "Android resolver not enabled. Unity Android platform target must be selected.",
                                                    "OK");
                    }
                }
                return;
            }
            if (platform == BuildTarget.iOS)
            {
                if (edmIOSStaticLinkProp != null && !( bool )edmIOSStaticLinkProp.GetValue(null, null))
                {
                    OnWarningGUI("Link frameworks statically disabled",
                                 "Please enable 'Add use_frameworks!' and 'Link frameworks statically' found under " +
                                 "'Assets -> External Dependency Manager -> iOS Resolver -> Settings' menu.\n" +
                                 "Failing to do this step may result in undefined behavior of the plugin and doubled import of frameworks.",
                                 MessageType.Warning);
                }

                if (PlayerSettings.muteOtherAudioSources)
                {
                    OnWarningGUI("Mute Other AudioSources enabled in PlayerSettings",
                                 "Known issue with muted all sounds in Unity Game after closing interstitial ads. " +
                                 "We recommend not using 'Mute Other AudioSources'.",
                                 MessageType.Warning);
                }
            }
        }
Пример #5
0
        private void OnOtherSettingsGUI()
        {
            HelpStyles.BeginBoxScope();
            otherSettingsFoldout = GUILayout.Toggle(otherSettingsFoldout, "Other settings", EditorStyles.foldout);
            if (!otherSettingsFoldout)
            {
                HelpStyles.EndBoxScope();
                return;
            }

            OnLoadingModeGUI();

            debugModeProp.boolValue = EditorGUILayout.ToggleLeft(
                HelpStyles.GetContent("Verbose Debug logging", null,
                                      "The enabled Debug Mode will display a lot of useful information for debugging about the states of the sdk with tag CAS. " +
                                      "Disabling the Debug Mode may improve application performance."),
                debugModeProp.boolValue);

            analyticsCollectionEnabledProp.boolValue = EditorGUILayout.ToggleLeft(
                HelpStyles.GetContent("Impression Analytics collection (Firebase)", null,
                                      "If your application uses Google Analytics(Firebase) then CAS collects ad impressions and states to analytic.\n" +
                                      "Disabling analytics collection may save internet traffic and improve application performance.\n" +
                                      "The Analytics collection has no effect on ad revenue."),
                analyticsCollectionEnabledProp.boolValue);

            buildPreprocessEnabledProp.boolValue = EditorGUILayout.ToggleLeft(
                "Build preprocess enabled",
                buildPreprocessEnabledProp.boolValue);

            if (!buildPreprocessEnabledProp.boolValue)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.HelpBox("Automatic configuration at build time is disabled.\n" +
                                        "You can use `Assets > CleverAdsSolutions > Configure project` to call configuration manually.",
                                        MessageType.None);
                EditorGUI.indentLevel--;
            }

            if (platform == BuildTarget.Android)
            {
                EditorGUI.indentLevel++;
                updateGradlePluginVersionProp.boolValue = EditorGUILayout.ToggleLeft(
                    HelpStyles.GetContent("Update Gradle Plugin enabled", null,
                                          "The Gradle plugin version will be updated during build to be optimal " +
                                          "for the current Gradle Wrapper version."),
                    updateGradlePluginVersionProp.boolValue);

                EditorGUILayout.BeginHorizontal();
                multiDexEnabledProp.boolValue = EditorGUILayout.ToggleLeft(
                    "Multi DEX enabled",
                    multiDexEnabledProp.boolValue);
                HelpStyles.HelpButton(Utils.gitUnityRepoURL + "/wiki/Include-Android#enable-multidex");
                EditorGUILayout.EndHorizontal();

                exoPlayerIncludedProp.boolValue = EditorGUILayout.ToggleLeft(
                    HelpStyles.GetContent("ExoPlayer included", null,
                                          "ExoPlayer can be used instead of MediaPlayer to play videos " +
                                          "with better performance and avoid known ANR errors."),
                    exoPlayerIncludedProp.boolValue);

                EditorGUI.indentLevel--;
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                var reportEndpointEnabled = attributionReportEndpointProp.stringValue.Length > 0;
                if (reportEndpointEnabled != EditorGUILayout.ToggleLeft(
                        "Set Attribution Report endpoint", reportEndpointEnabled))
                {
                    reportEndpointEnabled = !reportEndpointEnabled;
                    if (reportEndpointEnabled)
                    {
                        attributionReportEndpointProp.stringValue = Utils.attributionReportEndPoint;
                    }
                    else
                    {
                        attributionReportEndpointProp.stringValue = string.Empty;
                    }
                }
                HelpStyles.HelpButton(Utils.gitUnityRepoURL + "/wiki/Include-iOS#ios-15-global-skadnetwork-reporting");
                EditorGUILayout.EndHorizontal();
                if (reportEndpointEnabled)
                {
                    EditorGUI.indentLevel++;
                    attributionReportEndpointProp.stringValue = EditorGUILayout.TextField(
                        attributionReportEndpointProp.stringValue);
                    EditorGUI.indentLevel--;
                }
            }

            autoCheckForUpdatesEnabledProp.boolValue = EditorGUILayout.ToggleLeft(
                "Auto check for CAS updates enabled",
                autoCheckForUpdatesEnabledProp.boolValue);

            delayAppMeasurementGADInitProp.boolValue = EditorGUILayout.ToggleLeft(
                "Delay measurement of the Google SDK initialization",
                delayAppMeasurementGADInitProp.boolValue);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Most popular country of users (ISO2)", GUILayout.ExpandWidth(false));
            EditorGUI.BeginChangeCheck();
            var countryCode = mostPopularCountryOfUsersProp.stringValue;

            countryCode = EditorGUILayout.TextField(countryCode, GUILayout.Width(25.0f));
            if (EditorGUI.EndChangeCheck())
            {
                if (countryCode.Length > 2)
                {
                    countryCode = countryCode.Substring(0, 2);
                }
                mostPopularCountryOfUsersProp.stringValue = countryCode.ToUpper();
            }
            EditorGUILayout.EndHorizontal();

            HelpStyles.EndBoxScope();
        }
Пример #6
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            editorSettingsObj.Update();

            if (managerIdsList.count > 1)
            {
                var appId = managerIdsProp.GetArrayElementAtIndex(0).stringValue;
                if (!string.IsNullOrEmpty(appId))
                {
                    EditorGUILayout.LabelField("Application id in CAS:", appId);
                }
            }
            managerIdsList.DoLayoutList();
            OnManagerIDVerificationGUI();
            DrawTestAdMode();
            DrawSeparator();

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            var mediumFlag = ( int )AdFlags.MediumRectangle;

            EditorGUI.BeginDisabledGroup((allowedAdFlagsProp.intValue & mediumFlag) == mediumFlag);
            var banner = DrawAdFlagToggle(AdFlags.Banner);

            EditorGUI.EndDisabledGroup();
            EditorGUI.BeginDisabledGroup(!banner);
            DrawAdFlagToggle(AdFlags.MediumRectangle);
            EditorGUI.EndDisabledGroup();
            var inter  = DrawAdFlagToggle(AdFlags.Interstitial);
            var reward = DrawAdFlagToggle(AdFlags.Rewarded);

            DrawAdFlagToggle(AdFlags.Native);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            if (banner)
            {
                DrawBannerScope();
            }
            if (inter)
            {
                DrawInterstitialScope();
            }
            if (reward)
            {
                DrawRewardedScope(inter);
            }

            IsAdFormatsNotUsed();
            DrawSeparator();
            OnEditroRuntimeActiveAdGUI();
            OnAudienceGUI();
            DeprecatedDependenciesGUI();

            if (dependencyManager == null)
            {
                EditorGUILayout.HelpBox("The integrity of CAS Unity package is broken. " +
                                        "Please try to reimport the package or contact support.", MessageType.Error);
            }
            else
            {
                dependencyManager.OnGUI(platform);
                OnEDMAreaGUI();
            }

            OnUserTrackingDesctiptionGUI();
            OnOtherSettingsGUI();

            HelpStyles.BeginBoxScope();
            GUILayout.TextField(environmentDetails, EditorStyles.wordWrappedMiniLabel);
            HelpStyles.EndBoxScope();

            OnAppAdsTxtGUI();
            editorSettingsObj.ApplyModifiedProperties();
            serializedObject.ApplyModifiedProperties();
        }