Exemplo n.º 1
0
 public void OnGUI(DependencyManager mediation)
 {
     HelpStyles.Devider();
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label(name);
     //if (GUILayout.Button( "Select", EditorStyles.miniButton, mediation.columnWidth ))
     //{
     //    var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>( path );
     //    EditorGUIUtility.PingObject( asset );
     //}
     if (GUILayout.Button("Remove", EditorStyles.miniButton, mediation.columnWidth))
     {
         AssetDatabase.MoveAssetToTrash(path);
         for (int i = mediation.other.Count - 1; i >= 0; i--)
         {
             if (mediation.other[i].path == path)
             {
                 mediation.other.RemoveAt(i);
             }
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUI.indentLevel++;
     EditorGUILayout.LabelField(path, EditorStyles.wordWrappedMiniLabel, GUILayout.ExpandHeight(false));
     EditorGUI.indentLevel--;
 }
Exemplo n.º 2
0
 private void OnLoadingModeGUI()
 {
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.PropertyField(loadingModeProp, HelpStyles.GetContent("Loading mode", null));
     HelpStyles.HelpButton(Utils.gitUnityRepoURL + "/wiki/Configuring-SDK#loading-mode");
     EditorGUILayout.EndHorizontal();
 }
Exemplo n.º 3
0
 private void OnWarningGUI(string title, string message, MessageType type)
 {
     HelpStyles.BeginBoxScope();
     EditorGUILayout.HelpBox(title, type);
     EditorGUILayout.LabelField(message, EditorStyles.wordWrappedLabel);
     HelpStyles.EndBoxScope();
 }
Exemplo n.º 4
0
        private void OnAppAdsTxtGUI()
        {
            var content = HelpStyles.GetContent(" Don’t forget to implement app-ads.txt", HelpStyles.helpIconContent.image);

            if (GUILayout.Button(content, EditorStyles.label, GUILayout.ExpandWidth(false)))
            {
                Application.OpenURL(Utils.gitAppAdsTxtRepoUrl);
            }
        }
Exemplo n.º 5
0
        private void DrawBannerScope()
        {
            EditorGUILayout.LabelField("Ad View:");
            EditorGUI.indentLevel++;
            bannerRefreshProp.intValue = Mathf.Clamp(
                EditorGUILayout.IntField("Refresh rate(sec)", bannerRefreshProp.intValue), 0, short.MaxValue);

            var obsoleteAPI = bannerSizeProp.intValue > 0;

            if (obsoleteAPI != EditorGUILayout.Toggle("Use Single Banner(Obsolete)", obsoleteAPI))
            {
                obsoleteAPI             = !obsoleteAPI;
                bannerSizeProp.intValue = obsoleteAPI ? 1 : 0;
            }
            if (obsoleteAPI)
            {
                EditorGUILayout.PropertyField(bannerSizeProp, HelpStyles.GetContent("Single Ad size", null));
                //if (settings.bannerSize == AdSize.Banner && Utils.IsPortraitOrientation())
                //{
                //    DialogOrCancel( "For portrait applications, we recommend using the adaptive banner size." +
                //            "This will allow you to get more expensive advertising.", target );
                //}
                EditorGUI.indentLevel++;
                switch (( AdSize )bannerSizeProp.intValue)
                {
                case AdSize.Banner:
                    EditorGUILayout.HelpBox("Size in DPI: 320:50", MessageType.None);
                    break;

                case AdSize.AdaptiveBanner:
                    EditorGUILayout.HelpBox("Pick the best ad size in full width screen for improved performance.", MessageType.None);
                    break;

                case AdSize.SmartBanner:
                    EditorGUILayout.HelpBox("Typically, Smart Banners on phones have a Banner size. " +
                                            "Or on tablets a Leaderboard size", MessageType.None);
                    break;

                case AdSize.Leaderboard:
                    EditorGUILayout.HelpBox("Size in DPI: 728:90", MessageType.None);
                    break;

                case AdSize.MediumRectangle:
                    EditorGUILayout.HelpBox("Size in DPI: 300:250", MessageType.None);
                    var enableMrec = allowedAdFlagsProp.intValue | ( int )AdFlags.MediumRectangle;
                    if (enableMrec != allowedAdFlagsProp.intValue)
                    {
                        allowedAdFlagsProp.intValue = enableMrec;
                    }
                    break;
                }
                EditorGUI.indentLevel--;
            }
            EditorGUI.indentLevel--;
        }
Exemplo n.º 6
0
 private void DrawRewardedScope(bool allowInter)
 {
     EditorGUILayout.LabelField("Rewarded ads:");
     EditorGUI.indentLevel++;
     EditorGUI.BeginDisabledGroup(!allowInter);
     interWhenNoRewardedAdProp.boolValue = EditorGUILayout.ToggleLeft(
         HelpStyles.GetContent("Increase filling by Interstitial ads", null,
                               "Sometimes a situation occurs when filling Rewarded ads is not enough, " +
                               "in this case, you can allow the display of Interstitial ads to receiving a reward in any case."),
         allowInter && interWhenNoRewardedAdProp.boolValue);
     EditorGUI.EndDisabledGroup();
     EditorGUI.indentLevel--;
 }
Exemplo n.º 7
0
        private void OnGradleTemplateDisabledGUI(string prefix, string path)
        {
            if (File.Exists(path))
            {
                return;
            }
#if UNITY_ANDROID || CASDeveloper
            var msg = prefix + " template feature is disabled!\n" +
                      "A successful build requires do modifications to " + prefix + " template.";
            if (HelpStyles.WarningWithButton(msg, "Enable", MessageType.Error))
            {
                CASPreprocessGradle.TryEnableGradleTemplate(path);
            }
#endif
        }
Exemplo n.º 8
0
        private void CheckDependencyUpdates(BuildTarget platform)
        {
            bool updatesFound = false;

            for (int i = 0; !updatesFound && i < simple.Length; i++)
            {
                updatesFound = simple[i].isNewer;
            }

            for (int i = 0; !updatesFound && i < advanced.Length; i++)
            {
                updatesFound = advanced[i].isNewer;
            }

            if (updatesFound)
            {
                if (HelpStyles.WarningWithButton("Found one or more updates for native dependencies.",
                                                 "Update all", MessageType.Info))
                {
                    for (int i = 0; i < simple.Length; i++)
                    {
                        if (simple[i].filter == -1) // remove deprecated
                        {
                            simple[i].DisableDependencies(platform, this);
                        }
                        else if (simple[i].isNewer)
                        {
                            simple[i].ActivateDependencies(platform, this);
                        }
                    }

                    for (int i = 0; i < advanced.Length; i++)
                    {
                        if (advanced[i].filter == -1) // remove deprecated
                        {
                            advanced[i].DisableDependencies(platform, this);
                        }
                        else if (advanced[i].isNewer)
                        {
                            advanced[i].ActivateDependencies(platform, this);
                        }
                    }
                }
            }
        }
        public static void OnHeaderGUI(string gitRepoName, bool allowedPackageUpdate, string currVersion, ref string newCASVersion)
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            HelpStyles.HelpButton(gitRootURL + gitRepoName + "/wiki");

            if (GUILayout.Button(gitRepoName + " " + currVersion, EditorStyles.toolbarButton))
            {
                Application.OpenURL(gitRootURL + gitRepoName + "/releases");
            }
            if (GUILayout.Button("Check for Updates", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
            {
                newCASVersion = GetNewVersionOrNull(gitRepoName, currVersion, true);
                string message = string.IsNullOrEmpty(newCASVersion) ? "You are using the latest version."
                    : "There is a new version " + newCASVersion + " of the " + gitRepoName + " available for update.";
                EditorUtility.DisplayDialog("Check for Updates", message, "OK");
            }

            if (GUILayout.Button("Support", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
            {
                Application.OpenURL(gitRootURL + gitRepoName + "#support");
            }
            EditorGUILayout.EndHorizontal();

            if (!string.IsNullOrEmpty(newCASVersion))
            {
                var updateMessage = "There is a new version " + newCASVersion + " of the " + gitRepoName + " available for update.";
#if UNITY_2018_4_OR_NEWER
                if (allowedPackageUpdate)
                {
                    if (HelpStyles.WarningWithButton(updateMessage, "Update"))
                    {
                        UpdatePackageManagerRepo(gitRepoName, newCASVersion);
                    }
                }
                else
#endif
                {
                    EditorGUILayout.HelpBox(updateMessage, MessageType.Warning);
                }
            }
        }
Exemplo n.º 10
0
 private void DeprecatedDependenciesGUI()
 {
     if (!deprecateDependenciesExist)
     {
         return;
     }
     if (HelpStyles.WarningWithButton("Deprecated dependencies found. " +
                                      "Please remove them and use the new dependencies below.",
                                      "Remove", MessageType.Error))
     {
         for (int i = 0; i < deprecatedAssets.Length; i++)
         {
             var assets = AssetDatabase.FindAssets(deprecatedAssets[i]);
             for (int assetI = 0; assetI < assets.Length; assetI++)
             {
                 AssetDatabase.MoveAssetToTrash(AssetDatabase.GUIDToAssetPath(assets[assetI]));
             }
         }
         deprecateDependenciesExist = false;
     }
 }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
0
        private void OnLabelGUI(Label label)
        {
            if (label == Label.None)
            {
                return;
            }
            string title   = "";
            string tooltip = "";

            if ((label & Label.Banner) == Label.Banner)
            {
                title   += "b ";
                tooltip += "'b' - Support Banner Ad\n";
            }
            if ((label & Label.Inter) == Label.Inter)
            {
                title   += "i ";
                tooltip += "'i' - Support Interstitial Ad\n";
            }
            if ((label & Label.Reward) == Label.Reward)
            {
                title   += "r ";
                tooltip += "'r' - Support Rewarded Ad\n";
            }
            if ((label & Label.Beta) == Label.Beta)
            {
                title   += "beta";
                tooltip += "'beta' - Dependencies in closed beta and available upon invite only. " +
                           "If you would like to be considered for the beta, please contact Support.";
            }
            if ((label & Label.Obsolete) == Label.Obsolete)
            {
                title   += "obsolete";
                tooltip += "'obsolete' - The mediation of the network is considered obsolete and not recommended for install.";
            }
            GUILayout.Label(HelpStyles.GetContent(title, null, tooltip), HelpStyles.labelStyle);
        }
Exemplo n.º 13
0
        private bool DrawAdFlagToggle(AdFlags flag)
        {
            var flagInt = ( int )flag;
            var enabled = (allowedAdFlagsProp.intValue & flagInt) == flagInt;
            var icon    = HelpStyles.GetFormatIcon(flag, enabled);
            var content = HelpStyles.GetContent("", icon, "Use " + flag.ToString() + " placement");

            EditorGUI.BeginDisabledGroup(flag == AdFlags.Native);
            if (flag == AdFlags.Native)
            {
                if (enabled)
                {
                    allowedAdFlagsProp.intValue = allowedAdFlagsProp.intValue ^ flagInt;
                    enabled = false;
                }
                content.tooltip = "Native ads coming soon";
            }
            if (icon == null)
            {
                content.text    = content.tooltip;
                content.tooltip = "";
            }
            if (enabled != GUILayout.Toggle(enabled, content, "button", GUILayout.ExpandWidth(false), GUILayout.MinWidth(45)))
            {
                enabled = !enabled;
                if (enabled)
                {
                    allowedAdFlagsProp.intValue = allowedAdFlagsProp.intValue | flagInt;
                }
                else
                {
                    allowedAdFlagsProp.intValue = allowedAdFlagsProp.intValue ^ flagInt;
                }
            }
            EditorGUI.EndDisabledGroup();
            return(enabled);
        }
Exemplo n.º 14
0
        internal void OnGUI(DependencyManager mediation, BuildTarget platform)
        {
            bool installed = !string.IsNullOrEmpty(installedVersion);

            if (notSupported && filter < 0 && !installed)
            {
                return;
            }
            HelpStyles.Devider();
            EditorGUILayout.BeginHorizontal();

            //OnLabelGUI( labels );

            string sdkVersion = null;

            for (int i = 0; i < depsSDK.Count; i++)
            {
                if (depsSDK[i].version != version)
                {
                    sdkVersion = depsSDK[i].version;
                    break;
                }
            }

            if (installed || locked)
            {
                EditorGUI.BeginDisabledGroup((!installed && locked) || (installed && isRequired && !locked));
                if (!GUILayout.Toggle(true, " " + name + altName, GUILayout.ExpandWidth(false)))
                {
                    DisableDependencies(platform, mediation);
                }
                if (sdkVersion != null)
                {
                    GUILayout.Label(sdkVersion, EditorStyles.centeredGreyMiniLabel, GUILayout.ExpandWidth(false));
                }
                GUILayout.FlexibleSpace();

                if (notSupported || (locked && installed))
                {
                    GUILayout.Label(version, mediation.columnWidth);
                    if (GUILayout.Button("Remove", EditorStyles.miniButton, mediation.columnWidth))
                    {
                        DisableDependencies(platform, mediation);
                        GUIUtility.ExitGUI();
                    }
                }
                else if (locked)
                {
                    GUILayout.Label(version, mediation.columnWidth);
                    GUILayout.Label("-", mediation.columnWidth);
                }
                else
                {
                    GUILayout.Label(installedVersion, mediation.columnWidth);
                    if (isNewer)
                    {
                        if (GUILayout.Button(version, EditorStyles.miniButton, mediation.columnWidth))
                        {
                            ActivateDependencies(platform, mediation);
                            GUIUtility.ExitGUI();
                        }
                    }
                    else
                    {
                        GUILayout.Label(isRequired ? "Required" : "-", mediation.columnWidth);
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
            else
            {
                EditorGUI.BeginDisabledGroup(notSupported || (dependencies.Length == 0 && depsSDK.Count == 0));

                if (GUILayout.Toggle(false, " " + name + altName, GUILayout.ExpandWidth(false)))
                {
                    ActivateDependencies(platform, mediation);
                    GUIUtility.ExitGUI();
                }
                if (sdkVersion != null)
                {
                    GUILayout.Label(sdkVersion, EditorStyles.centeredGreyMiniLabel, GUILayout.ExpandWidth(false));
                }
                GUILayout.FlexibleSpace();
                GUILayout.Label("none", mediation.columnWidth);
                if (isRequired)
                {
                    if (GUILayout.Button(version, EditorStyles.miniButton, mediation.columnWidth))
                    {
                        ActivateDependencies(platform, mediation);
                        GUIUtility.ExitGUI();
                    }
                }
                else
                {
                    GUILayout.Label(version, mediation.columnWidth);
                }
                EditorGUI.EndDisabledGroup();
            }

            if ((notSupported && installed) || (installed && locked) || (isRequired && !locked && !installed))
            {
                GUILayout.Label(HelpStyles.errorIconContent, GUILayout.Width(20));
            }
            else if (string.IsNullOrEmpty(url))
            {
                GUILayout.Space(25);
            }
            else if (GUILayout.Button(HelpStyles.helpIconContent, EditorStyles.label, GUILayout.Width(20)))
            {
                Application.OpenURL(url);
            }

            EditorGUILayout.EndHorizontal();
            if (contains.Length > 0)
            {
                var footerText = new StringBuilder();
                for (int i = 0; i < contains.Length; i++)
                {
                    if (contains[i] != adBase)
                    {
                        if (footerText.Length > 0)
                        {
                            footerText.Append(", ");
                        }
                        footerText.Append(contains[i]);
                    }
                }

                if (footerText.Length > 0)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField(footerText.ToString(), EditorStyles.wordWrappedMiniLabel);
                    //EditorGUILayout.HelpBox( string.Join( ", ", contains ), MessageType.None );
                    EditorGUI.indentLevel--;
                }
            }

            if (!string.IsNullOrEmpty(comment))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.LabelField(comment, EditorStyles.wordWrappedMiniLabel);
                EditorGUI.indentLevel--;
            }
        }
Exemplo n.º 15
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();
        }
Exemplo n.º 16
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();
            }
        }
Exemplo n.º 17
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);
                }
            }
        }
Exemplo n.º 18
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();
        }