Ejemplo n.º 1
0
 static void didReloadScripts()
 {
     #if AR_FOUNDATION_REMOTE_INSTALLED
     if (AutoARFoundationFixes.Enabled)
     {
         FixesForEditorSupport.Apply();
     }
     else
     {
         log("skipping fixes");
     }
     #endif
 }
Ejemplo n.º 2
0
        static void showMethodsInInspector(params Object[] targets)
        {
            var target = targets.First() as ARFoundationRemoteInstaller;

            Assert.IsNotNull(target);

            #if AR_FOUNDATION_REMOTE_INSTALLED
            GUILayout.Space(16);
            GUILayout.Label("AR Companion app", EditorStyles.boldLabel);
            if (GUILayout.Button("Install AR Companion app", new GUIStyle(GUI.skin.button)
            {
                fontStyle = FontStyle.Bold
            }))
            {
                execute(() => CompanionAppInstaller.BuildAndRun(target.optionalCompanionAppExtension));
            }
            if (GUILayout.Button("Build AR Companion and show in folder", new GUIStyle(GUI.skin.button)))
            {
                execute(() => CompanionAppInstaller.Build(target.optionalCompanionAppExtension));
            }
            if (GUILayout.Button("Open Plugin Settings"))
            {
                Selection.activeObject = ARFoundationRemote.Runtime.Settings.Instance;
            }
            if (GUILayout.Button("Delete AR Companion app build folder"))
            {
                execute(CompanionAppInstaller.DeleteCompanionAppBuildFolder);
            }
            #endif

            GUILayout.Space(16);
            GUILayout.Label(ARFoundationRemoteInstaller.pluginName, EditorStyles.boldLabel);
            if (GUILayout.Button("Install or Update Plugin"))
            {
                execute(ARFoundationRemoteInstaller.InstallPlugin);
            }
            #if AR_FOUNDATION_REMOTE_INSTALLED
            if (GUILayout.Button("Apply fixes"))
            {
                FixesForEditorSupport.Apply();
            }
            if (GUILayout.Button("Un-install Plugin", new GUIStyle(GUI.skin.button)
            {
                normal = { textColor = Color.red }
            }))
            {
                execute(ARFoundationRemoteInstaller.UnInstallPlugin);
            }
            #endif
        }
Ejemplo n.º 3
0
        public static void UnInstallPlugin()
        {
            #if AR_FOUNDATION_REMOTE_INSTALLED
            if (FixesForEditorSupport.Undo())
            {
                Debug.LogError($"{displayName}: undoing AR Foundation fixes... Please press the 'Un-install Plugin' button again.");
                return;
            }
            #endif

            var listRequest = Client.List(true, false);
            runRequest(listRequest, () => {
                Assert.AreEqual(StatusCode.Success, listRequest.Status);
                var plugin = listRequest.Result.SingleOrDefault(_ => _.name == pluginId);
                Assert.IsNotNull(plugin);
                if (plugin.source == PackageSource.Embedded)
                {
                    moveFolder(destinationFolderName, sourceFolderName);
                    logUninstallSuccess();
                }
                else
                {
                    Debug.LogError("Removing plugin via Package Manager. This error should not be visible in production!");
                    var removeRequest = Client.Remove(pluginId);
                    runRequest(removeRequest, () => {
                        if (removeRequest.Status == StatusCode.Success)
                        {
                            logUninstallSuccess();
                        }
                        else
                        {
                            Debug.LogError($"removeRequest failed {removeRequest.Error}");
                        }
                    });
                }
            });

            void logUninstallSuccess()
            {
                Debug.Log($"{displayName} was uninstalled from Packages folder. To uninstall the plugin completely, please delete the ARFoundationRemoteInstaller folder.");
            }
        }
Ejemplo n.º 4
0
        public static void UnInstallPlugin()
        {
            /*#if AR_FOUNDATION_REMOTE_INSTALLED
             *  FixesForEditorSupport.Apply();
             #endif
             * return;*/

            #if AR_FOUNDATION_REMOTE_INSTALLED
            FixesForEditorSupport.Undo();
            #endif

            var removalRequest = Client.Remove("com.kyrylokuzyk.arfoundationremote");
            runRequest(removalRequest, () => {
                if (removalRequest.Status == StatusCode.Success)
                {
                    Debug.Log(pluginName + " removed successfully" + ". If you want to delete the plugin completely, please delete the folder: Assets/Plugins/ARFoundationRemoteInstaller");
                }
                else
                {
                    Debug.LogError(pluginName + " removal failed: " + removalRequest.Error.message);
                }
            });
        }
Ejemplo n.º 5
0
        static void showMethodsInInspector(params Object[] targets)
        {
            var target = targets.First() as ARFoundationRemoteInstaller;

            Assert.IsNotNull(target);

            if (isInstalled)
            {
                GUILayout.Space(16);
                GUILayout.Label("AR Companion app", EditorStyles.boldLabel);
                if (GUILayout.Button("Install AR Companion App", new GUIStyle(GUI.skin.button)
                {
                    fontStyle = FontStyle.Bold
                }))
                {
                    execute(() => CompanionAppInstaller.BuildAndRun(target.optionalCompanionAppExtension, target.modifyAppId));
                }

                if (GUILayout.Button("Build AR Companion and show in folder", new GUIStyle(GUI.skin.button)))
                {
                    execute(() => CompanionAppInstaller.Build(target.optionalCompanionAppExtension, target.modifyAppId));
                }

                if (GUILayout.Button("Open Plugin Settings"))
                {
                    #if AR_FOUNDATION_REMOTE_INSTALLED
                    Selection.activeObject = Runtime.Settings.Instance;
                    #endif
                }

                if (GUILayout.Button("Delete AR Companion app build folder"))
                {
                    execute(CompanionAppInstaller.DeleteCompanionAppBuildFolder);
                }

                GUILayout.Space(16);
                if (GUILayout.Button("Apply AR Foundation fixes"))
                {
                    #if AR_FOUNDATION_REMOTE_INSTALLED
                    AutoARFoundationFixes.Enabled = true;
                    FixesForEditorSupport.Apply(true);
                    #endif
                }

                GUILayout.Space(16);
                GUILayout.Label(ARFoundationRemoteInstaller.displayName, EditorStyles.boldLabel);
                if (GUILayout.Button("Un-install Plugin", new GUIStyle(GUI.skin.button)
                {
                    normal = { textColor = Color.red }
                }))
                {
                    AutoARFoundationFixes.Enabled = false;
                    ARFoundationRemoteInstaller.UnInstallPlugin();
                }
            }
            else
            {
                if (GUILayout.Button("Install Plugin"))
                {
                    ARFoundationRemoteInstaller.InstallPlugin(true);
                }
            }
        }