internal static SearchProvider CreateProvider()
        {
            return(new SearchProvider(type, displayName)
            {
                priority = 90,
                filterId = "pkg:",
                isExplicitProvider = true,

                onEnable = () =>
                {
                    s_ListRequest = UnityEditor.PackageManager.Client.List(true);
                    s_SearchRequest = UnityEditor.PackageManager.Client.SearchAll();
                },

                onDisable = () =>
                {
                    s_ListRequest = null;
                    s_SearchRequest = null;
                },

                fetchItems = (context, items, provider) => SearchPackages(context, provider),

                fetchThumbnail = (item, context) => (item.thumbnail = item.score == 0 ? Icons.packageUpdate : Icons.packageInstalled)
            });
        }
 bool MemoryProfilerPackageAvailabilityCheckMoveNext()
 {
     if (m_MemoryProfilerSearchRequest != null)
     {
         if (m_MemoryProfilerSearchRequest.IsCompleted)
         {
             if (m_MemoryProfilerSearchRequest.Result != null)
             {
                 foreach (var result in m_MemoryProfilerSearchRequest.Result)
                 {
                     if (!result.version.StartsWith("0."))
                     {
                         m_MemoryProfilerPackageStage          = PackageStage.PreviewOrReleased;
                         Styles.packageInstallSuggestionButton = new GUIContent(string.Format(Styles.packageInstallSuggestion, string.Format(Styles.packageInstallSuggestionVersionPart, m_MemoryProfilerSearchRequest.Result[0].versions.latestCompatible)));
                         break;
                     }
                 }
             }
             m_MemoryProfilerSearchRequest = null;
             return(false);
         }
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
            public static void RetreivePackageList()
            {
                UnityEditor.PackageManager.Requests.SearchRequest listRequest = Client.SearchAll(true);

                while (listRequest.Status == StatusCode.InProgress)
                {
                    //Waiting...
                }

                if (listRequest.Status == StatusCode.Failure)
                {
                    Debug.LogError("Failed to retreived packages from Package Manager...");

                    return;
                }

                foreach (PackageInfo p in packages)
                {
                    if (p.name == URP_PACKAGE_ID)
                    {
                        lastestURPVersion = p.versions.latestCompatible;
                    }
                }

                packages = listRequest.Result;
            }
        bool InitiateMemoryProfilerPackageAvailabilityCheck()
        {
            if (IsMemoryProfilerPackageInstalled())
            {
                m_MemoryProfilerPackageStage = PackageStage.Installed;
                return(true);
            }

            m_MemoryProfilerSearchRequest = UnityEditor.PackageManager.Client.Search(m_MemoryProfilerPackageName, true);
            return(false);
        }
        bool InitiateMemoryProfilerPackageAvailabilityCheck()
        {
            var installedPackages = UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages();

            foreach (var package in installedPackages)
            {
                if (package.name == m_MemoryProfilerPackageName)
                {
                    m_MemoryProfilerPackageStage = PackageStage.Installed;
                    return(true);
                }
            }

            m_MemoryProfilerSearchRequest = UnityEditor.PackageManager.Client.Search(m_MemoryProfilerPackageName, true);
            return(false);
        }
Exemplo n.º 6
0
            public static void RetreivePackageList()
            {
                UnityEditor.PackageManager.Requests.SearchRequest listRequest = Client.SearchAll(true);

                while (listRequest.Status == StatusCode.InProgress)
                {
                    //Waiting...
                }

                if (listRequest.Status == StatusCode.Failure)
                {
                    Debug.LogError("Failed to retreived packages from Package Manager...");

                    return;
                }

                packages = listRequest.Result;
            }
        private PackageInfo[] GetPackageList()
        {
            UnityEditor.PackageManager.Requests.SearchRequest listRequest = Client.SearchAll(true);

            while (listRequest.Status == StatusCode.InProgress)
            {
                continue;
            }

            if (listRequest.Status == StatusCode.Failure)
            {
                _packageManagerError = true;
                Debug.LogWarning("[Flat Kit] Failed to get packages from Package Manager.");
                return(new PackageInfo[0]);
            }

            return(listRequest.Result);
        }
Exemplo n.º 8
0
        public static Configuration CheckPackageInstallation()
        {
            IS_INSTALLED = false;
            Config       = Configuration.Auto;

            if (PackageManager.packages == null)
            {
                PackageManager.RetreivePackageList();
            }

            foreach (UnityEditor.PackageManager.PackageInfo p in PackageManager.packages)
            {
                if (p.name == PACKAGE_ID)
                {
                    PPS_VERSION = p.version.Replace("-preview", string.Empty);
                    LATEST_COMPATIBLE_VERSION = p.versions.latestCompatible;

                    //Validate installed version against compatible range
                    System.Version curVersion    = new System.Version(PPS_VERSION);
                    System.Version minVersion    = new System.Version(MIN_PPS_VERSION);
                    System.Version maxVersion    = new System.Version(MAX_PPS_VERSION);
                    System.Version latestVersion = new System.Version(LATEST_COMPATIBLE_VERSION);

                    //Clamp to maximum compatible version
                    if (latestVersion > maxVersion)
                    {
                        latestVersion = maxVersion;
                    }

                    if (curVersion >= minVersion && curVersion <= maxVersion)
                    {
                        PPSVersionStatus = VersionStatus.Compatible;
                    }
                    if (curVersion < minVersion || curVersion < latestVersion)
                    {
                        PPSVersionStatus = VersionStatus.Outdated;
                    }
                    if (curVersion < minVersion || curVersion > maxVersion)
                    {
                        PPSVersionStatus = VersionStatus.InCompatible;
                    }
#if SCPE_DEV
                    Debug.Log("<b>CheckPPSInstallation</b> PPS version " + p.version + " Installed. Required: " + MIN_PPS_VERSION);
#endif

                    IS_INSTALLED = true;
                    Config       = Configuration.PackageManager;
                }
            }

            //PPS not installed
            if (IS_INSTALLED == false)
            {
#if UNITY_2019_3_OR_NEWER //URP is available and has integrated PP
                if (RenderPipelineInstallation.CurrentPipeline == RenderPipelineInstallation.Pipeline.URP && RenderPipelineInstallation.VersionStatus == RenderPipelineInstallation.Version.Compatible)
                {
                    IS_INSTALLED = true;
                    Config       = Configuration.Integrated;

                    PPSVersionStatus = VersionStatus.Compatible;

#if SCPE_DEV
                    Debug.Log("<b>CheckPPSInstallation</b> URP installed, integrated PP available");
#endif
                }
#else //On older versions, fetch latest compatible PSS package
                UnityEditor.PackageManager.Requests.SearchRequest r = Client.Search(PACKAGE_ID);
                while (r.Status == StatusCode.InProgress)
                {
                    //Waiting
                }
                if (r.IsCompleted)
                {
                    LATEST_COMPATIBLE_VERSION = r.Result[0].versions.latestCompatible;

                    //Clamp to maximum compatible version
                    System.Version maxVersion    = new System.Version(MAX_PPS_VERSION);
                    System.Version latestVersion = new System.Version(LATEST_COMPATIBLE_VERSION);
                    if (latestVersion > maxVersion)
                    {
                        LATEST_COMPATIBLE_VERSION = MAX_PPS_VERSION;
                    }
                }
#endif
            }

#if SCPE_DEV
            if (IS_INSTALLED)
            {
                Debug.Log("<b>PostProcessingInstallation</b> " + Config + " version is installed");
            }
            else
            {
                Debug.Log("<b>PostProcessingInstallation</b> Post Processing Stack is not installed");
            }
#endif
            return(Config);
        }