示例#1
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
        }
示例#2
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);
                }
            }
        }
示例#4
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;
     }
 }
示例#5
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);
                }
            }
        }