예제 #1
0
 public bool Contains(string id, PluginDependencyType type)
 {
     foreach (DependencyError error in errors)
     {
         if (error.type == type && error.invalidItems.Contains(id))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
            public void RegisterInvalidItem(string id, PluginDependencyType type)
            {
                DependencyError error = errors.Find(e => e.type == type);

                if (error == null)
                {
                    error = new DependencyError()
                    {
                        type = type
                    };
                    errors.Add(error);
                }

                error.invalidItems.Add(id);
            }
예제 #3
0
        private void EnableDependencyWarning(PluginDependencyType type, PluginInfo.ErrorSummary summary, string id, bool installed, Color defaultColor, Rect rect)
        {
            if (summary == null)
            {
                return;
            }
            if (summary.Contains(id, type))
            {
                GUI.color = EditorGUIEx.WarningRedColor;

                if (GUI.Button(new Rect(rect.x + rect.width - 90, rect.y, 90, rect.height), "Resolve"))
                {
                    ResolveDependency(type, id);
                }
            }
            else
            {
                GUI.color = installed ? EditorGUIEx.GreenColor : defaultColor;
            }
        }
예제 #4
0
        private void ResolveDependency(PluginDependencyType type, string id)
        {
            switch (type)
            {
            case PluginDependencyType.Plugin:
                Install(AssetDatabase.LoadAssetAtPath <PluginInfo>(id));
                break;

            case PluginDependencyType.DefineSymbol:
                DefineSymbols.Add(id, "");
                break;

            case PluginDependencyType.Package:
                string[] package = id.Split(':');
                Util.AddDependencyToPackageManifest(package[0], package[1]);
                break;

            case PluginDependencyType.Module:
                ModuleInstaller.Install(AssetDatabase.LoadAssetAtPath <ModuleInstallInfo>(id).GenerateLink());
                break;
            }
            EditorApplication.delayCall += Refresh;
        }