static UltraleapPackageInstaller()
 {
     if (!EditorPreferences.Get($"{nameof(UltraleapPackageInstaller)}", false))
     {
         EditorPreferences.Set($"{nameof(UltraleapPackageInstaller)}", PackageInstaller.TryInstallAssets(HiddenPath, DefaultPath));
     }
 }
示例#2
0
 private static void CheckPackage()
 {
     if (!EditorPreferences.Get($"{nameof(LuminPackageInstaller)}.Profiles", false))
     {
         EditorPreferences.Set($"{nameof(LuminPackageInstaller)}.Profiles", PackageInstaller.TryInstallAssets(HiddenPath, $"{DefaultPath}{Path.DirectorySeparatorChar}Profiles"));
     }
 }
示例#3
0
 private static void CheckPackage()
 {
     if (!EditorPreferences.Get($"{nameof(SDKPackageInstaller)}.Assets", false))
     {
         EditorPreferences.Set($"{nameof(SDKPackageInstaller)}.Assets", PackageInstaller.TryInstallAssets(DefaultSdkAssets));
     }
 }
示例#4
0
文件: LuminRemote.cs 项目: XRTK/Lumin
        static LuminRemote()
        {
            if (Application.isBatchMode)
            {
                return;
            }
            if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Lumin)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(LuminSDKRoot))
            {
                Debug.LogWarning("Failed to resolve Magic Leap Sdk Path! Be sure to set this path in the 'External Tools' section of the editor preferences.");
                return;
            }

            if (!Directory.Exists(LuminRemoteSupportFullPath) ||
                EditorPreferences.Get($"ReImport_{nameof(LuminRemote)}", false))
            {
                EditorPreferences.Set($"ReImport_{nameof(LuminRemote)}", false);

                try
                {
                    if (Directory.Exists(LuminRemoteSupportFullPath))
                    {
                        var files = Directory.GetFiles(LuminRemoteSupportFullPath, "*", SearchOption.AllDirectories);

                        foreach (var file in files)
                        {
                            File.Delete(file);
                        }

                        File.Delete($"{LuminRemoteSupportFullPath}.meta");
                        Directory.Delete(LuminRemoteSupportFullPath);
                    }

                    InstallLuminRemoteLibraries();
                }
                catch (Exception e)
                {
                    Debug.LogError(e);
                }
            }
            else
            {
                EditorApplication.playModeStateChanged += EditorApplication_OnPlayModeStateChanged;
                EditorApplication.delayCall            += () => MLRemoteIsServerConfigured(ref isRemoteConfigured);
            }
        }
示例#5
0
文件: LuminRemote.cs 项目: XRTK/Lumin
        private static void UpdateLuminRemoteSupportLibraries()
        {
            if (EditorUtility.DisplayDialog("Attention!",
                                            "To reimport the remote support libraries, we have to restart the editor, is this ok?",
                                            "Restart",
                                            "Cancel"))
            {
                EditorAssemblyReloadManager.LockReloadAssemblies = true;

                EditorApplication.delayCall += () =>
                {
                    EditorPreferences.Set($"ReImport_{nameof(LuminRemote)}", true);
                    EditorApplication.OpenProject(Directory.GetParent(Application.dataPath).FullName);
                };
            }
        }
示例#6
0
 private static void ImportPackageAssets()
 {
     EditorPreferences.Set($"{nameof(SDKPackageInstaller)}.Assets", false);
     EditorApplication.delayCall += CheckPackage;
 }
 private static void ImportPackageAssets()
 {
     EditorPreferences.Set($"{nameof(WindowsMixedRealityPackageInstaller)}.Profiles", false);
     EditorApplication.delayCall += CheckPackage;
 }
示例#8
0
        private void OnGUI()
        {
            if (window == null)
            {
                Close();
            }

            EditorGUILayout.BeginVertical();
            MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();
            EditorGUILayout.LabelField("Mixed Reality Toolkit Unity Package Manager");

            if (packages == null)
            {
                EditorGUILayout.LabelField(isError ? "Failed to find packages!" : "Gathering Package data...");
                EditorGUILayout.EndVertical();
                return;
            }

            var prevLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 256;

            for (var i = 0; i < packages.Length; i++)
            {
                (MixedRealityPackageInfo package, bool packageEnabled, bool packageInstalled) = packages[i];

                bool CheckDependency(Tuple <MixedRealityPackageInfo, bool, bool> packageSetting)
                {
                    (MixedRealityPackageInfo packageInfo, bool isEnabled, bool isInstalled) = packageSetting;
                    return(packageEnabled && packageInstalled && isEnabled && isInstalled && packageInfo.Dependencies.Contains(package.Name));
                }

                var hasDependency = packages.Any(CheckDependency);
                GUI.enabled = !package.IsRequiredPackage && !hasDependency;
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(16);
                isPackageEnabled[i] = EditorGUILayout.Toggle(isPackageEnabled[i], GUILayout.Width(12));
                var packageName = package.DisplayName.Replace("XRTK.", package.IsRequiredPackage
                    ? " (Required) " : hasDependency
                        ? " (Dependency) " : "");
                EditorGUILayout.LabelField(new GUIContent(packageName));
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                GUI.enabled = true;
            }

            EditorGUIUtility.labelWidth = prevLabelWidth;

            if (GUILayout.Button("Apply"))
            {
                for (var i = 0; i < packages.Length; i++)
                {
                    (MixedRealityPackageInfo package, bool _, bool _) = packages[i];

                    if (!isPackageEnabled[i] && isPackageInstalled[i])
                    {
                        EditorPreferences.Set($"{package.Name}_enabled", false);

                        if (MixedRealityPackageUtilities.DebugEnabled)
                        {
                            Debug.LogWarning($"{package.Name}_enabled == false");
                        }
                    }

                    if (isPackageEnabled[i] && !isPackageInstalled[i])
                    {
                        EditorPreferences.Set($"{package.Name}_enabled", true);

                        if (MixedRealityPackageUtilities.DebugEnabled)
                        {
                            Debug.LogWarning($"{package.Name}_enabled == true");
                        }
                    }
                }

                MixedRealityPackageUtilities.CheckPackageManifest();
                Close();
            }

            EditorGUILayout.EndVertical();
        }