Ejemplo n.º 1
0
        void bgwExecuteQuery_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch ((GuiAction)e.ProgressPercentage)
            {
            case GuiAction.ReadStart:
                tbInput.Text        = null;
                tbInput.Enabled     = true;
                btnXeqQuery.Enabled = false;
                pnlInput.BackColor  = Color.Red;
                tbInput.Focus();
                break;

            case GuiAction.ReadEnd:
                tbInput.Enabled     = false;
                btnXeqQuery.Enabled = true;
                pnlInput.BackColor  = tpInterpreter.BackColor;
                break;

            case GuiAction.ReadLn:
                readMode = GuiAction.ReadLn;
                break;

            case GuiAction.ReadCh:
                readMode = GuiAction.ReadCh;
                break;

            case GuiAction.Write:
                tbAnswer.Write(e.UserState as string);
                break;

            case GuiAction.WriteLn:
                tbAnswer.WriteLine(e.UserState as string);
                break;

            case GuiAction.NewLn:
                tbAnswer.WriteLine();
                break;

            case GuiAction.Clear:
                tbAnswer.Clear();
                break;

            case GuiAction.Reset:
                tbInput.Clear();
                break;

            case GuiAction.BtnsOn:
                btnMore.Enabled       = btnStop.Enabled = true;
                btnXeqQuery.Enabled   = false;
                lblMoreOrStop.Visible = true;
                break;

            case GuiAction.BtnsOff:
                tbInput.Enabled       = false;
                btnMore.Enabled       = btnStop.Enabled = false;
                lblMoreOrStop.Visible = false;
                break;
            }
        }
Ejemplo n.º 2
0
    private void Update()
    {
        switch (action)
        {
        case GuiAction.OpenBuildSettingsWindow:
            OpenBuildSettingsWindow();
            break;

        case GuiAction.BuildAndDeployScenes:
            OVRBundleManager.BuildDeployScenes(buildableScenes, forceRestart);
            CheckForDeployedScenes();
            break;

        case GuiAction.BuildAndDeployApp:
            OVRBundleManager.BuildDeployTransitionAPK();
            CheckForTransitionAPK();
            if (deployScenesWhenDeployingApk)
            {
                buildableScenes.ForEach(x => x.shouldDeploy = true);
                OVRBundleManager.BuildDeployScenes(buildableScenes, false);
                CheckForDeployedScenes();
            }
            OVRBundleManager.LaunchApplication();
            break;

        case GuiAction.ClearDeviceBundles:
            OVRBundleManager.DeleteRemoteAssetBundles();
            CheckForDeployedScenes();
            break;

        case GuiAction.ClearLocalBundles:
            OVRBundleManager.DeleteLocalAssetBundles();
            break;

        case GuiAction.LaunchApp:
            OVRBundleManager.LaunchApplication();
            break;

        case GuiAction.UninstallApk:
            OVRBundleManager.UninstallAPK();
            CheckForTransitionAPK();
            CheckForDeployedScenes();
            break;

        case GuiAction.ClearLog:
            PrintLog("", true);
            break;

        default:
            break;
        }

        action = GuiAction.None;
    }
Ejemplo n.º 3
0
        GuiAction readMode; // for distinguishing between various ways of reading input

        public MainForm()
        {
            InitializeComponent();
            Text = "C# Prolog -- basic Windows version";
            persistentSettings = new PrologEngine.ApplicationStorage();
            stop         = null;
            semaGetInput = new ManualResetEvent(false);
            charBuffer   = new Queue <int> ();
            winIO        = new WinIO(bgwExecuteQuery, semaGetInput, tbInput, charBuffer);
            bgwExecuteQuery.DoGuiAction(GuiAction.BtnsOff);
            pe       = new PrologEngine(winIO);
            readMode = GuiAction.None;
        }
Ejemplo n.º 4
0
        private void PerformAction(GuiAction action, Object arg, bool pausePlayback)
        {
            bool timerEnabled = false;

            if (timer != null)
            {
                timerEnabled  = timer.Enabled;
                timer.Enabled = false;
            }

            bool playbackPaused = false;

            if (_context != null && pausePlayback)
            {
                playbackPaused  = _context.Paused;
                _context.Paused = true;
            }

            try
            {
                action(arg);
            }
            catch (VersionConflictException ex)
            { UserErrors.VersionConflict(ex.RequiredVersion); }
            catch (FailedToLoadSimResultsException ex)
            { UserErrors.FailedToLoadSimulationResults(ex.Message); }
            catch (ApplicationException ex)
            { UserErrors.UnhandledException(ex, true); }
            finally
            {
                if (_context != null && pausePlayback)
                {
                    _context.Paused = playbackPaused;
                }
                if (timer != null)
                {
                    timer.Enabled = timerEnabled;
                }
            }
        }
Ejemplo n.º 5
0
 // BackgroundWorker
 public static void DoGuiAction(this BackgroundWorker bgw, GuiAction a)
 {
     bgw.ReportProgress((int)a, null);
 }
Ejemplo n.º 6
0
 protected abstract void UpdateUi(GuiAction action = GuiAction.Add);
Ejemplo n.º 7
0
 public MainForm()
 {
     InitializeComponent ();
       Text = "C# Prolog -- basic Windows version";
       persistentSettings = new PrologEngine.ApplicationStorage ();
       stop = null;
       semaGetInput = new ManualResetEvent (false);
       charBuffer = new Queue<int> ();
       winIO = new WinIO (bgwExecuteQuery, semaGetInput, tbInput, charBuffer);
       bgwExecuteQuery.DoGuiAction (GuiAction.BtnsOff);
       pe = new PrologEngine (winIO);
       readMode = GuiAction.None;
 }
    private void OnGUI()
    {
        this.titleContent.text = "OVR Scene Quick Preview";

        if (panelInitialized)
        {
            CheckForTransitionAPK();
            panelInitialized = false;
        }

        if (logBoxStyle == null)
        {
            logBoxStyle                  = new GUIStyle();
            logBoxStyle.margin.left      = 5;
            logBoxStyle.wordWrap         = true;
            logBoxStyle.normal.textColor = logBoxStyle.focused.textColor = EditorStyles.label.normal.textColor;
            logBoxStyle.richText         = true;
        }

        GUILayout.Space(10.0f);

        GUILayout.Label("Scenes", EditorStyles.boldLabel);
        GUIContent buildSettingsBtnTxt = new GUIContent("Open Build Settings");

        if (buildableScenes == null || buildableScenes.Count == 0)
        {
            string sceneErrorMessage;
            if (invalidBuildableScene)
            {
                sceneErrorMessage = "Invalid scene selection. \nPlease remove OVRTransitionScene in the project's build settings.";
            }
            else
            {
                sceneErrorMessage = "No scenes detected. \nTo get started, add scenes in the project's build settings.";
            }
            GUILayout.Label(sceneErrorMessage);

            var buildSettingBtnRt = GUILayoutUtility.GetRect(buildSettingsBtnTxt, GUI.skin.button, GUILayout.Width(150));
            if (GUI.Button(buildSettingBtnRt, buildSettingsBtnTxt))
            {
                action = GuiAction.OpenBuildSettingsWindow;
            }
        }
        else
        {
            foreach (EditorSceneInfo scene in buildableScenes)
            {
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField(scene.sceneName, GUILayout.ExpandWidth(true));
                    GUILayout.FlexibleSpace();

                    if (scene.buildStatus != SceneBundleStatus.UNKNOWN)
                    {
                        string status = GetEnumDescription(scene.buildStatus);
                        EditorGUILayout.LabelField(status, GUILayout.Width(70));
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                GUIContent sceneBtnTxt = new GUIContent("Build and Deploy Scene(s)");
                var        sceneBtnRt  = GUILayoutUtility.GetRect(sceneBtnTxt, GUI.skin.button, GUILayout.Width(200));
                if (GUI.Button(sceneBtnRt, sceneBtnTxt))
                {
                    action = GuiAction.BuildAndDeployScenes;
                }

                GUIContent forceRestartLabel = new GUIContent("Force Restart [?]", "Relaunch the application after scene bundles are finished deploying.");
                forceRestart = GUILayout.Toggle(forceRestart, forceRestartLabel, GUILayout.ExpandWidth(true));
            }
            EditorGUILayout.EndHorizontal();
        }

        GUILayout.Space(10.0f);
        GUIContent transitionContent = new GUIContent("Transition APK [?]", "Build and deploy an APK that will transition into the scene you are working on. This enables fast iteration on a specific scene.");

        GUILayout.Label(transitionContent, EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        {
            GUIStyle statusStyle = EditorStyles.label;
            statusStyle.richText = true;
            GUILayout.Label("Status: ", statusStyle, GUILayout.ExpandWidth(false));

            string statusMesssage;
            switch (currentApkStatus)
            {
            case ApkStatus.OK:
                statusMesssage = "<color=green>APK installed. Ready to build and deploy scenes.</color>";
                break;

            case ApkStatus.NOT_INSTALLED:
                statusMesssage = "<color=red>APK not installed. Press build and deploy to install the transition APK.</color>";
                break;

            case ApkStatus.DEVICE_NOT_CONNECTED:
                statusMesssage = "<color=red>Device not connected via ADB. Please connect device and allow debugging.</color>";
                break;

            case ApkStatus.UNKNOWN:
            default:
                statusMesssage = "<color=red>Failed to get APK status!</color>";
                break;
            }
            GUILayout.Label(statusMesssage, statusStyle, GUILayout.ExpandWidth(true));
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        {
            GUIContent btnTxt = new GUIContent("Build and Deploy App");
            var        rt     = GUILayoutUtility.GetRect(btnTxt, GUI.skin.button, GUILayout.Width(200));
            if (GUI.Button(rt, btnTxt))
            {
                action = GuiAction.BuildAndDeployApp;
            }
        }
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(10.0f);
        GUILayout.Label("Utilities", EditorStyles.boldLabel);

        showBundleManagement = EditorGUILayout.Foldout(showBundleManagement, "Bundle Management");
        if (showBundleManagement)
        {
            EditorGUILayout.BeginHorizontal();
            {
                GUIContent clearDeviceBundlesTxt   = new GUIContent("Delete Device Bundles");
                var        clearDeviceBundlesBtnRt = GUILayoutUtility.GetRect(clearDeviceBundlesTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(clearDeviceBundlesBtnRt, clearDeviceBundlesTxt))
                {
                    action = GuiAction.ClearDeviceBundles;
                }

                GUIContent clearLocalBundlesTxt   = new GUIContent("Delete Local Bundles");
                var        clearLocalBundlesBtnRt = GUILayoutUtility.GetRect(clearLocalBundlesTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(clearLocalBundlesBtnRt, clearLocalBundlesTxt))
                {
                    action = GuiAction.ClearLocalBundles;
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        showOther = EditorGUILayout.Foldout(showOther, "Other");
        if (showOther)
        {
            EditorGUILayout.BeginHorizontal();
            {
                GUIContent useOptionalTransitionPackageLabel = new GUIContent("Use optional APK package name [?]",
                                                                              "This allows both full build APK and transition APK to be installed on device. However, platform services like Entitlement check may fail.");

                EditorGUILayout.LabelField(useOptionalTransitionPackageLabel, GUILayout.ExpandWidth(false));
                bool newToggleValue = EditorGUILayout.Toggle(useOptionalTransitionApkPackage);

                if (newToggleValue != useOptionalTransitionApkPackage)
                {
                    useOptionalTransitionApkPackage = newToggleValue;
                    // Update transition APK status after changing package name option
                    CheckForTransitionAPK();
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                GUIContent launchBtnTxt = new GUIContent("Launch App");
                var        launchBtnRt  = GUILayoutUtility.GetRect(launchBtnTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(launchBtnRt, launchBtnTxt))
                {
                    action = GuiAction.LaunchApp;
                }

                var buildSettingBtnRt = GUILayoutUtility.GetRect(buildSettingsBtnTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(buildSettingBtnRt, buildSettingsBtnTxt))
                {
                    action = GuiAction.OpenBuildSettingsWindow;
                }

                GUIContent uninstallTxt   = new GUIContent("Uninstall APK");
                var        uninstallBtnRt = GUILayoutUtility.GetRect(uninstallTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(uninstallBtnRt, uninstallTxt))
                {
                    action = GuiAction.UninstallApk;
                }

                GUIContent clearLogTxt   = new GUIContent("Clear Log");
                var        clearLogBtnRt = GUILayoutUtility.GetRect(clearLogTxt, GUI.skin.button, GUILayout.ExpandWidth(true));
                if (GUI.Button(clearLogBtnRt, clearLogTxt))
                {
                    action = GuiAction.ClearLog;
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        GUILayout.Space(10.0f);
        GUILayout.Label("Log", EditorStyles.boldLabel);

        if (!string.IsNullOrEmpty(toolLog))
        {
            debugLogScroll = EditorGUILayout.BeginScrollView(debugLogScroll, GUILayout.ExpandHeight(true));
            EditorGUILayout.SelectableLabel(toolLog, logBoxStyle, GUILayout.Height(logBoxSize.y + logBoxSpacing));
            EditorGUILayout.EndScrollView();
        }
    }
Ejemplo n.º 9
0
 // BackgroundWorker
 public static void DoGuiAction(this BackgroundWorker bgw, GuiAction a)
 {
     bgw.ReportProgress ((int)a, null);
 }
Ejemplo n.º 10
0
 public static void DoGuiAction(this BackgroundWorker bgw, GuiAction a, string s)
 {
     bgw.ReportProgress ((int)a, s);
 }
Ejemplo n.º 11
0
 void bgwExecuteQuery_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     switch ((GuiAction)e.ProgressPercentage)
       {
     case GuiAction.ReadStart:
       tbInput.Text = null;
       tbInput.Enabled = true;
       btnXeqQuery.Enabled = false;
       pnlInput.BackColor = Color.Red;
       tbInput.Focus ();
       break;
     case GuiAction.ReadEnd:
       tbInput.Enabled = false;
       btnXeqQuery.Enabled = true;
       pnlInput.BackColor = tpInterpreter.BackColor;
       break;
     case GuiAction.ReadLn:
       readMode = GuiAction.ReadLn;
       break;
     case GuiAction.ReadCh:
       readMode = GuiAction.ReadCh;
       break;
     case GuiAction.Write:
       tbAnswer.Write (e.UserState as string);
       break;
     case GuiAction.WriteLn:
       tbAnswer.WriteLine (e.UserState as string);
       break;
     case GuiAction.NewLn:
       tbAnswer.WriteLine ();
       break;
     case GuiAction.Clear:
       tbAnswer.Clear ();
       break;
     case GuiAction.Reset:
       tbInput.Clear ();
       break;
     case GuiAction.BtnsOn:
       btnMore.Enabled = btnStop.Enabled = true;
       btnXeqQuery.Enabled = false;
       lblMoreOrStop.Visible = true;
       break;
     case GuiAction.BtnsOff:
       tbInput.Enabled = false;
       btnMore.Enabled = btnStop.Enabled = false;
       lblMoreOrStop.Visible = false;
       break;
       }
 }
Ejemplo n.º 12
0
 protected override void UpdateUi(GuiAction action = GuiAction.Add)
 {
     if (action == GuiAction.Remove)
         CreateNewCommand.Execute(null);
 }
Ejemplo n.º 13
0
    private void Update()
    {
        switch (action)
        {
        case GuiAction.OpenBuildSettingsWindow:
            OpenBuildSettingsWindow();
            break;

        case GuiAction.BuildAndDeployScenes:
            // Check the latest transition apk status
            CheckForTransitionAPK();
            // Show a dialog to prompt for building and deploying transition APK
            if (currentApkStatus != ApkStatus.OK &&
                EditorUtility.DisplayDialog("Build and Deploy OVR Transition APK?",
                                            "OVR Transition APK status not ready, it is required to load your scene bundle for quick preview.",
                                            "Yes",
                                            "No"))
            {
                PrintLog("Building OVR Transition APK");
                OVRBundleManager.BuildDeployTransitionAPK(useOptionalTransitionApkPackage);
                CheckForTransitionAPK();
            }

            for (int i = 0; i < buildableScenes.Count; i++)
            {
                buildableScenes[i].buildStatus = SceneBundleStatus.QUEUED;
            }
            OVRBundleManager.BuildDeployScenes(buildableScenes, forceRestart);
            break;

        case GuiAction.BuildAndDeployApp:
            OVRBundleManager.BuildDeployTransitionAPK(useOptionalTransitionApkPackage);
            CheckForTransitionAPK();
            break;

        case GuiAction.ClearDeviceBundles:
            OVRBundleManager.DeleteRemoteAssetBundles();
            break;

        case GuiAction.ClearLocalBundles:
            OVRBundleManager.DeleteLocalAssetBundles();
            break;

        case GuiAction.LaunchApp:
            OVRBundleManager.LaunchApplication();
            break;

        case GuiAction.UninstallApk:
            OVRBundleManager.UninstallAPK();
            CheckForTransitionAPK();
            break;

        case GuiAction.ClearLog:
            PrintLog("", true);
            break;

        default:
            break;
        }

        action = GuiAction.None;
    }
Ejemplo n.º 14
0
 public static void DoGuiAction(this BackgroundWorker bgw, GuiAction a, string s)
 {
     bgw.ReportProgress((int)a, s);
 }
Ejemplo n.º 15
0
    private void OnGUI()
    {
        this.titleContent.text = "OVR Scene Quick Preview";

        if (panelInitialized)
        {
            CheckForTransitionAPK();
            CheckForDeployedScenes();
            panelInitialized = false;
        }

        if (windowStyle == null)
        {
            windowStyle        = new GUIStyle();
            windowStyle.margin = new RectOffset(10, 10, 10, 10);
        }

        if (logBoxStyle == null)
        {
            logBoxStyle                  = new GUIStyle();
            logBoxStyle.margin.left      = 5;
            logBoxStyle.wordWrap         = true;
            logBoxStyle.normal.textColor = logBoxStyle.focused.textColor = EditorStyles.label.normal.textColor;
            logBoxStyle.richText         = true;
        }

        if (statusStyle == null)
        {
            statusStyle          = new GUIStyle(EditorStyles.label);
            statusStyle.richText = true;
        }

        EditorGUILayout.BeginVertical(windowStyle);

        GUILayout.BeginHorizontal(EditorStyles.helpBox);
        GUILayout.BeginVertical();
        EditorGUILayout.LabelField("OVR Scene Quick Preview generates a version of your app which supports hot-reloading "
                                   + "content changes to individual scenes, reducing iteration time.",
                                   EditorStyles.wordWrappedLabel);

#if UNITY_2021_1_OR_NEWER
        if (EditorGUILayout.LinkButton("Documentation"))
#else
        if (GUILayout.Button("Documentation", GUILayout.ExpandWidth(false)))
#endif
        {
            Application.OpenURL("https://developer.oculus.com/documentation/unity/unity-build-android-tools/");
        }
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);
        GUIContent transitionContent = new GUIContent("Modified APK [?]",
                                                      "Build and deploy an APK that can hot-reload scenes. This enables fast iteration on content changes to scenes.");
        GUILayout.Label(transitionContent, EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        {
            GUILayout.Label("Status: ", statusStyle, GUILayout.ExpandWidth(false));

            string statusMesssage;
            switch (currentApkStatus)
            {
            case ApkStatus.OK:
                statusMesssage = "<color=green>APK installed. Ready to build and deploy scenes.</color>";
                break;

            case ApkStatus.NOT_INSTALLED:
                statusMesssage = "<color=red>APK not installed. Press \"Build and Deploy APK\" to install the modified APK.</color>";
                break;

            case ApkStatus.DEVICE_NOT_CONNECTED:
                statusMesssage = "<color=red>Device not connected via ADB. Please connect device and allow debugging.</color>";
                break;

            case ApkStatus.UNKNOWN:
            default:
                statusMesssage = "<color=red>Failed to get APK status!</color>";
                break;
            }
            GUILayout.Label(statusMesssage, statusStyle, GUILayout.ExpandWidth(true));
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Build and Deploy APK", GUILayout.Width(200)))
        {
            action = GuiAction.BuildAndDeployApp;
        }
        EditorGUI.BeginDisabledGroup(currentApkStatus != ApkStatus.OK);
        if (GUILayout.Button("Launch APK", GUILayout.Width(120)))
        {
            action = GuiAction.LaunchApp;
        }
        EditorGUI.EndDisabledGroup();
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(10f);

        GUIContent scenesContent = new GUIContent("Scenes [?]",
                                                  "Build and deploy individual scenes, which can be hot-reloaded at runtime by the modified APK.");
        GUILayout.Label(scenesContent, EditorStyles.boldLabel);

        GUIContent buildSettingsBtnTxt = new GUIContent("Open Build Settings");
        GUIContent deployLabelTxt      = new GUIContent("Deploy?",
                                                        "If true, this scene will be hot-reloaded. To reduce iteration time, only deploy scenes under active iteration.");
        if (buildableScenes == null || buildableScenes.Count == 0)
        {
            string sceneErrorMessage;
            if (invalidBuildableScene)
            {
                sceneErrorMessage = "Invalid scene selection. \nPlease remove OVRTransitionScene in the project's build settings.";
            }
            else
            {
                sceneErrorMessage = "No scenes detected. \nTo get started, add scenes in the project's build settings.";
            }
            GUILayout.Label(sceneErrorMessage);

            var buildSettingBtnRt = GUILayoutUtility.GetRect(buildSettingsBtnTxt, GUI.skin.button, GUILayout.Width(150));
            if (GUI.Button(buildSettingBtnRt, buildSettingsBtnTxt))
            {
                action = GuiAction.OpenBuildSettingsWindow;
            }
        }
        else
        {
            float currWidth      = EditorGUIUtility.currentViewWidth;
            float sceneNameWidth = Math.Max(EditorGUIUtility.currentViewWidth - 170, 60);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Scene Name", GUI.skin.box, GUILayout.Width(sceneNameWidth));
            EditorGUILayout.LabelField("Status", GUI.skin.box, GUILayout.Width(80));
            EditorGUILayout.LabelField(deployLabelTxt, GUI.skin.box, GUILayout.Width(60));
            EditorGUILayout.EndHorizontal();

            foreach (EditorSceneInfo scene in buildableScenes)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(scene.sceneName, GUILayout.Width(sceneNameWidth + 8));
                EditorGUILayout.LabelField(GetEnumDescription(scene.buildStatus), GUILayout.Width(80));
                scene.shouldDeploy = EditorGUILayout.Toggle(scene.shouldDeploy, GUILayout.Width(50));
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Build and Deploy Scene(s)", GUILayout.Width(200)))
                {
                    action = GuiAction.BuildAndDeployScenes;
                }
                GUILayout.Space(10);
                GUIContent forceRestartLabel = new GUIContent("Force Restart [?]", "Relaunch the application after scene bundles are finished deploying.");
                forceRestart = GUILayout.Toggle(forceRestart, forceRestartLabel, GUILayout.ExpandWidth(true));
            }
            EditorGUILayout.EndHorizontal();
        }

        GUILayout.Space(10.0f);
        GUILayout.Label("Utilities", EditorStyles.boldLabel);

        showBundleManagement = EditorGUILayout.BeginFoldoutHeaderGroup(showBundleManagement, "Bundle Management", EditorStyles.foldoutHeader);
        if (showBundleManagement)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.Space(EditorGUI.indentLevel * spacesPerIndent, false);                 //to match indentLevel
                GUIContent clearDeviceBundlesTxt = new GUIContent("Delete Device Bundles [?]",
                                                                  "Asset bundles to support hot-reloading are stored in an external location on-device. Click to delete them, freeing up space on-device.");
                if (GUILayout.Button(clearDeviceBundlesTxt, GUILayout.ExpandWidth(true)))
                {
                    action = GuiAction.ClearDeviceBundles;
                }

                GUIContent clearLocalBundlesTxt = new GUIContent("Delete Local Bundles [?]",
                                                                 $"Locally, asset bundles are built into the \"{OVRBundleManager.BUNDLE_MANAGER_OUTPUT_PATH}\" folder at project root. "
                                                                 + "Click to delete them, freeing up local space.");
                if (GUILayout.Button(clearLocalBundlesTxt, GUILayout.ExpandWidth(true)))
                {
                    action = GuiAction.ClearLocalBundles;
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndFoldoutHeaderGroup();

        GUILayout.Space(5.0f);
        showOther = EditorGUILayout.BeginFoldoutHeaderGroup(showOther, "Other", EditorStyles.foldoutHeader);
        if (showOther)
        {
            const float otherLabelsWidth = 240f;
            EditorGUI.indentLevel++;
            EditorGUILayout.BeginHorizontal();

            GUIContent deployScenesWithApkLabel = new GUIContent("Deploy scenes with APK deploy [?]",
                                                                 "If checked, all scenes will be built & deployed when pressing \"Build and Deploy APK\". This takes longer, but provides more expected behavior.");

            EditorGUILayout.LabelField(deployScenesWithApkLabel, GUILayout.Width(otherLabelsWidth));
            bool newToggleValue = EditorGUILayout.Toggle(deployScenesWhenDeployingApk);

            if (newToggleValue != deployScenesWhenDeployingApk)
            {
                deployScenesWhenDeployingApk = newToggleValue;
                EditorPrefs.SetBool(deployScenesWhenDeployingApkPrefName, deployScenesWhenDeployingApk);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUIContent useOptionalTransitionPackageLabel = new GUIContent("Use optional APK package name [?]",
                                                                          "This allows both full build APK and transition APK to be installed on device. However, platform services like Entitlement check may fail.");

            EditorGUILayout.LabelField(useOptionalTransitionPackageLabel, GUILayout.Width(otherLabelsWidth));
            newToggleValue = EditorGUILayout.Toggle(useOptionalTransitionApkPackage);

            if (newToggleValue != useOptionalTransitionApkPackage)
            {
                useOptionalTransitionApkPackage = newToggleValue;
                EditorPrefs.SetBool(useOptionalTransitionApkPackagePrefName, useOptionalTransitionApkPackage);
                // New package name = new check for associated data
                CheckForTransitionAPK();
                CheckForDeployedScenes();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space(EditorGUI.indentLevel * spacesPerIndent, false);             //to match indentLevel
            if (GUILayout.Button(buildSettingsBtnTxt, GUILayout.ExpandWidth(true)))
            {
                action = GuiAction.OpenBuildSettingsWindow;
            }
            if (GUILayout.Button("Uninstall APK", GUILayout.ExpandWidth(true)))
            {
                action = GuiAction.UninstallApk;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.EndFoldoutHeaderGroup();

        GUILayout.Space(6f);
        GUILayout.Label("", GUI.skin.horizontalSlider);
        GUILayout.Space(10f);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Log", EditorStyles.boldLabel);
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Clear Log", EditorStyles.miniButton))
        {
            action = GuiAction.ClearLog;
        }
        EditorGUILayout.EndHorizontal();

        debugLogScroll = EditorGUILayout.BeginScrollView(debugLogScroll, EditorStyles.helpBox, GUILayout.ExpandHeight(true));
        if (!string.IsNullOrEmpty(toolLog))
        {
            EditorGUILayout.SelectableLabel(toolLog, logBoxStyle, GUILayout.Height(logBoxSize.y));
        }
        EditorGUILayout.EndScrollView();

        EditorGUILayout.EndVertical();
    }
Ejemplo n.º 16
0
 protected override void UpdateUi(GuiAction action = GuiAction.Add)
 {
     switch (action) {
         case GuiAction.Add:
             Categories.Add(SelectedCategory);
             break;
         case GuiAction.Remove:
             Categories.Remove(SelectedCategory);
             CreateNewCommand.Execute(null);
             break;
     }
 }
Ejemplo n.º 17
0
 /// <summary>Adds an action to the pending list.</summary>
 /// <param name="actionFn">An action callback.</param>
 public void Add(GuiAction actionFn)
 {
     guiActions.Add(actionFn);
 }