public Texture2D GetPluginStatusIcon(SimplePluginManagerPlugin repository_plugin, SimplePluginManagerPlugin project_plugin) { if (project_plugin == null) { return(m_IconNotInstalled); } if (repository_plugin == null) { return(m_IconCanDowngradeOrExport); } SimplePluginManagerVersion repository_version_number = repository_plugin.ParseVersion; SimplePluginManagerVersion project_version_number = project_plugin.ParseVersion; if (repository_version_number == project_version_number) { return(m_IconUpToDate); } if (repository_version_number > project_version_number) { return(m_IconCanUpgrade); } return(m_IconCanDowngradeOrExport); }
private void GuiButtons( SimplePluginManagerSettings settings, SimplePluginManagerCollections collections, SimplePluginManagerPlugin repository_plugin, SimplePluginManagerPlugin project_plugin, bool is_any_plugin_dependent_on_this, bool is_error, Action on_collections_changed ) { if (repository_plugin != null) { if (project_plugin == null) { if (!is_error && GUILayout.Button("Install", GUILayout.Width(256))) { collections.CopyDependenciesFromRepositoryToProject(repository_plugin, settings); repository_plugin.CopyFromRepositoryToProject(settings); on_collections_changed(); AssetDatabase.Refresh(); } GUILayout.Label(" ", GUILayout.Width(256)); } else { SimplePluginManagerVersion repository_version_number = repository_plugin.ParseVersion; SimplePluginManagerVersion project_version_number = project_plugin.ParseVersion; if (project_version_number < repository_version_number) { if (!is_error && GUILayout.Button("Upgrade", GUILayout.Width(256))) { collections.CopyDependenciesFromRepositoryToProject(repository_plugin, settings); repository_plugin.CopyFromRepositoryToProject(settings); on_collections_changed(); AssetDatabase.Refresh(); } if (is_any_plugin_dependent_on_this) { GUILayout.Label("Required by other plugin.", GUILayout.Width(256)); } else if (GUILayout.Button("Uninstall", GUILayout.Width(256))) { project_plugin.RemoveFromProject(); on_collections_changed(); AssetDatabase.Refresh(); } } else if (project_version_number == repository_version_number) { GUILayout.Label("Up to date.", EditorStyles.boldLabel, GUILayout.Width(256)); if (is_any_plugin_dependent_on_this) { GUILayout.Label("Required by other plugin.", GUILayout.Width(256)); } else if (GUILayout.Button("Uninstall", GUILayout.Width(256))) { project_plugin.RemoveFromProject(); on_collections_changed(); AssetDatabase.Refresh(); } } else { if (!is_error && GUILayout.Button("Downgrade", GUILayout.Width(256))) { collections.CopyDependenciesFromRepositoryToProject(repository_plugin, settings); repository_plugin.CopyFromRepositoryToProject(settings); on_collections_changed(); AssetDatabase.Refresh(); } if (!is_error && GUILayout.Button("Copy to repository", GUILayout.Width(256))) { project_plugin.CopyFromProjectToRepository(settings); on_collections_changed(); AssetDatabase.Refresh(); } } } } else { if (project_plugin != null) { if (!is_error && GUILayout.Button("Copy to repository", GUILayout.Width(256))) { project_plugin.CopyFromProjectToRepository(settings); on_collections_changed(); AssetDatabase.Refresh(); } } } }