private void OnGUI()

in RealityMaterialExplorer/Assets/Oculus/VR/Editor/OVRBundleTool.cs [112:316]


	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();
		}
	}