コード例 #1
0
        internal static void InstallPackageAndAssignLoaderForBuildTarget(string package, string loaderType, BuildTargetGroup buildTargetGroup)
        {
            LoaderAssignmentRequest req = new LoaderAssignmentRequest();

            req.packageId         = package;
            req.loaderType        = loaderType;
            req.buildTargetGroup  = buildTargetGroup;
            req.installationState = InstallationState.New;
            QueueLoaderRequest(req);
        }
コード例 #2
0
        internal static void RebuildInstalledCache()
        {
            if (isRebuildingCache)
            {
                return;
            }

            LoaderAssignmentRequest req = new LoaderAssignmentRequest();

            req.installationState = InstallationState.RebuildInstalledCache;
            req.timeOut           = Time.realtimeSinceStartup + k_TimeOutDelta;
            QueueLoaderRequest(req);
        }
コード例 #3
0
        internal static void RebuildInstalledCache()
        {
            if (isRebuildingCache)
            {
                return;
            }

            LoaderAssignmentRequest req = new LoaderAssignmentRequest();

            req.installationState  = InstallationState.RebuildInstalledCache;
            req.rebuildRequestOnly = true;
            QueueLoaderRequest(req);
        }
コード例 #4
0
        private static void QueueLoaderRequest(LoaderAssignmentRequest req)
        {
            EditorApplication.update += ReportProgressOnActiveWork;
            switch (req.installationState)
            {
            case InstallationState.New:
                if (!HasInstallablePackageData() && s_SearchRequest == null)
                {
                    s_SearchRequest           = Client.SearchAll(false);
                    EditorApplication.update += UpdateInstallablePackages;
                }
                AddRequestToQueue(req, k_WaitingPackmanQuery);
                EditorApplication.update += WaitingOnSearchQuery;
                break;

            case InstallationState.RebuildInstalledCache:
                req.packageListRequest = Client.List(true, false);
                AddRequestToQueue(req, k_RebuildCache);
                EditorApplication.update += RebuildCache;
                break;

            case InstallationState.StartInstallation:
                req.needsAddRequest   = true;
                req.packageAddRequest = null;
                req.timeOut           = Time.realtimeSinceStartup + k_TimeOutDelta;
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Installing:
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Assigning:
                AddRequestToQueue(req, k_AssigningPackage);
                EditorApplication.update += AssignAnyRequestedLoadersUpdate;
                break;

            case InstallationState.Uninstalling:
                AddRequestToQueue(req, k_UninstallingPackage);
                EditorApplication.update += MonitorPackageUninstall;
                break;

            case InstallationState.Error:
                Debug.LogError($"Package Metadata store error. Check if there are any other errors in the console and make sure they are corrected before trying again.\n Failure reason: {req.errorText}");
                ResetManagerUiIfAvailable();
                break;
            }
        }
コード例 #5
0
        private static void QueueLoaderRequest(LoaderAssignmentRequest req)
        {
            switch (req.installationState)
            {
            case InstallationState.New:
                if (!HasInstallablePackageData() && s_SearchRequest == null)
                {
                    s_SearchRequest           = Client.SearchAll(false);
                    EditorApplication.update += UpdateInstallablePackages;
                }
                AddRequestToQueue(req, k_WaitingPackmanQuery);
                EditorApplication.update += WaitingOnSearchQuery;
                break;

            case InstallationState.StartInstallation:
                req.needsAddRequest   = true;
                req.packageAddRequest = null;
                req.timeOut           = Time.realtimeSinceStartup + k_TimeOutDelta;
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Installing:
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Assigning:
                AddRequestToQueue(req, k_AssigningPackage);
                EditorApplication.update += AssignAnyRequestedLoadersUpdate;
                break;

            case InstallationState.Uninstalling:
                AddRequestToQueue(req, k_UninstallingPackage);
                EditorApplication.update += MonitorPackageUninstall;
                break;

            case InstallationState.Error:
                Debug.LogError($"Could not install or assign any package with id {req.packageId}. Check if there are any other errors in the console and make sure they are corrected before trying again.\n Failure reason: {req.errorText}");
                XRSettingsManager.Instance.ResetUi = true;
                break;
            }
        }
コード例 #6
0
        private static void AddRequestToQueue(LoaderAssignmentRequest request, string queueName)
        {
            LoaderAssignmentRequests reqs;

            if (EditorPrefs.HasKey(queueName))
            {
                string fromJson = EditorPrefs.GetString(queueName);
                reqs = JsonUtility.FromJson <LoaderAssignmentRequests>(fromJson);
            }
            else
            {
                reqs = new LoaderAssignmentRequests();
                reqs.activeRequests = new List <LoaderAssignmentRequest>();
            }

            reqs.activeRequests.Add(request);
            string json = JsonUtility.ToJson(reqs);

            EditorPrefs.SetString(queueName, json);
        }
コード例 #7
0
        static void AddRequestToQueue(LoaderAssignmentRequest request, string queueName)
        {
            LoaderAssignmentRequests reqs;

            if (XRPackageMetadataStore.SessionStateHasStoredData(queueName))
            {
                string fromJson = SessionState.GetString(queueName, k_DefaultSessionStateString);
                reqs = JsonUtility.FromJson <LoaderAssignmentRequests>(fromJson);
            }
            else
            {
                reqs = new LoaderAssignmentRequests();
                reqs.activeRequests = new List <LoaderAssignmentRequest>();
            }

            reqs.activeRequests.Add(request);
            string json = JsonUtility.ToJson(reqs);

            SessionState.SetString(queueName, json);
        }
コード例 #8
0
        static void QueueLoaderRequest(LoaderAssignmentRequest req)
        {
            switch (req.installationState)
            {
            case InstallationState.New:
                if (!s_CachedMDStoreInformation.hasAlreadyRequestedData && !HasInstallablePackageData() && s_SearchRequest == null)
                {
                    s_SearchRequest           = Client.SearchAll(false);
                    EditorApplication.update += UpdateInstallablePackages;
                }
                AddRequestToQueue(req, k_WaitingPackmanQuery);
                EditorApplication.update += WaitingOnSearchQuery;
                break;

            case InstallationState.RebuildInstalledCache:
                AddRequestToQueue(req, k_RebuildCache);
                EditorApplication.update += RebuildCache;
                break;

            case InstallationState.StartInstallation:
                req.needsAddRequest   = true;
                req.packageAddRequest = null;
                req.timeOut           = Time.realtimeSinceStartup + k_TimeOutDelta;
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Installing:
                AddRequestToQueue(req, k_InstallingPackage);
                EditorApplication.update += MonitorPackageInstallation;
                break;

            case InstallationState.Assigning:
                AddRequestToQueue(req, k_AssigningPackage);
                EditorApplication.update += AssignAnyRequestedLoadersUpdate;
                break;

            case InstallationState.Uninstalling:
                AddRequestToQueue(req, k_UninstallingPackage);
                EditorApplication.update += MonitorPackageUninstall;
                break;

            case InstallationState.Log:
                const string header = "XR Plug-in Management";
                switch (req.logLevel)
                {
                case LogLevel.Info:
                    Debug.Log($"{header}: {req.logMessage}");
                    break;

                case LogLevel.Warning:
                    Debug.LogWarning($"{header} Warning: {req.logMessage}");
                    break;

                case LogLevel.Error:
                    Debug.LogError($"{header} error. Failure reason: {req.logMessage}.\n Check if there are any other errors in the console and make sure they are corrected before trying again.");
                    break;
                }
                ResetManagerUiIfAvailable();
                break;
            }
        }