public override void OnGUI() { // independent of actual window if (uploadInProgress) { int timeRemaining = Mathf.Max(1, Mathf.RoundToInt((DateTime.Now.Subtract(uploadStartTime).Seconds / uploadProgress) * (1 - uploadProgress))); Progress.SetRemainingTime(uploadProgressId, timeRemaining); Progress.Report(uploadProgressId, uploadProgress, "Uploading worlds to server..."); } base.OnGUI(); GUILayout.Label("Packaging ensures that the editor shows the most up to date version of your world.", EditorStyles.wordWrappedLabel); // TODO: cache string[] worlds = GetWorldPaths(); if (worlds.Length == 0) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("There are no worlds created yet. Use the Setup tool to create one.", MessageType.Info); } else { if (worlds.Length > 1) { EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.Label("Packaging Mode:", EditorStyles.wordWrappedLabel); packageMode = EditorGUILayout.Popup(packageMode, PACKAGE_OPTIONS); GUILayout.EndHorizontal(); } else { packageMode = 0; } EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress); string buttonText = "Package"; if (packageMode == 1) { string[] worldsToBuild = GetWorldsToBuild(packageMode).Select(Path.GetFileName).ToArray(); buttonText += " (" + ((dirWatcher.affectedFiles.Count > 0) ? string.Join(", ", worldsToBuild) : "everything") + ")"; } if (GUILayout.Button(buttonText)) { EditorCoroutineUtility.StartCoroutine(PackageWorlds(packageMode, releaseChannel, packageMode == 2, packageMode == 2), this); } EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); GUILayout.Label("To test inside the Quest or to make the world accessible to others, upload it to the traVRsal server.", EditorStyles.wordWrappedLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Release Channel:", EditorStyles.wordWrappedLabel); releaseChannel = EditorGUILayout.Popup(releaseChannel, RELEASE_CHANNELS); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress || verifyInProgress || documentationInProgress); if (GUILayout.Button("Prepare Upload")) { EditorCoroutineUtility.StartCoroutine(PrepareUpload(), this); } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); CheckTokenGUI(); if (worldListMismatch && !SDKUtil.networkIssue) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("The worlds inside your Worlds folder do not match your registered worlds on www.traVRsal.com. You probably need to rename these locally to match exactly.", MessageType.Error); if (GUILayout.Button("Refresh")) { EditorCoroutineUtility.StartCoroutine(RefreshVerify(), this); } } if (uncompressedTextures > 0) { EditorGUILayout.Space(); GUILayout.BeginHorizontal(); EditorGUILayout.HelpBox("Uncompressed Textures in Project: " + uncompressedTextures, MessageType.Warning); if (GUILayout.Button("Fix")) { EditorCoroutineUtility.StartCoroutine(CompressTextures(), this); } GUILayout.EndHorizontal(); } if (verifications.Count > 0) { EditorGUILayout.Space(); GUILayout.Label("Verification Results", EditorStyles.boldLabel); foreach (string dir in GetWorldPaths()) { string worldName = Path.GetFileName(dir); if (!verifications.ContainsKey(worldName)) { continue; } VerificationResult v = verifications[worldName]; v.showDetails = EditorGUILayout.Foldout(v.showDetails, worldName); if (v.showDetails) { PrintTableRow("Size (Quest)", v.distroExistsAndroid ? SDKUtil.BytesToString(v.distroSizeAndroid) : "not packaged yet"); PrintTableRow("Size (Windows)", v.distroExistsStandaloneWin ? SDKUtil.BytesToString(v.distroSizeStandaloneWin) : "not packaged yet"); if (linuxSupport) { PrintTableRow("Size (Linux)", v.distroExistsStandaloneLinux ? SDKUtil.BytesToString(v.distroSizeStandaloneLinux) : "not packaged yet"); } if (v.documentationExists) { BeginPartialTableRow("Documentation"); if (GUILayout.Button("Open")) { Help.BrowseURL(GetDocuPath(worldName) + "index.html"); } EndPartialTableRow(); } else { PrintTableRow("Documentation", "not created yet"); } BeginPartialTableRow("Actions"); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress || !uploadPossible); if (GUILayout.Button("Upload")) { EditorCoroutineUtility.StartCoroutine(UploadWorld(worldName), this); } if (debugMode && GUILayout.Button("Register")) { EditorCoroutineUtility.StartCoroutine(PublishWorldUpdates(worldName), this); } EditorGUI.EndDisabledGroup(); EndPartialTableRow(); } } } if (debugMode) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("Debug mode is enabled.", MessageType.Warning); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress || verifyInProgress || documentationInProgress); if (GUILayout.Button("Create Documentation")) { EditorCoroutineUtility.StartCoroutine(CreateDocumentation(), this); } EditorGUI.EndDisabledGroup(); } } OnGUIDone(); }
public override void OnGUI() { // independent of actual window if (uploadInProgress) { int timeRemaining = Mathf.Max(1, Mathf.RoundToInt((DateTime.Now.Subtract(uploadStartTime).Seconds / uploadProgress) * (1 - uploadProgress))); EditorUtility.DisplayProgressBar("Progress", "Uploading levels to server... " + timeRemaining + "s", uploadProgress); } base.OnGUI(); GUILayout.Label("Packaging ensures that the editor shows the most up to date version of your level.", EditorStyles.wordWrappedLabel); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Packaging Mode:", EditorStyles.wordWrappedLabel); packageMode = GUILayout.SelectionGrid(packageMode, PACKAGE_OPTIONS, 2, EditorStyles.radioButton); GUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress); string buttonText = "Package"; if (packageMode == 1) { string[] levelsToBuild = GetLevelsToBuild().Select(path => Path.GetFileName(path)).ToArray(); buttonText += " (" + ((dirWatcher.affectedFiles.Count > 0) ? string.Join(", ", levelsToBuild) : "everything") + ")"; } if (GUILayout.Button(buttonText)) { EditorCoroutineUtility.StartCoroutine(PackageLevels(packageMode == 2 ? true : false, packageMode == 2 ? true : false), this); } EditorGUI.EndDisabledGroup(); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress || verifyInProgress); if (GUILayout.Button("Prepare Upload")) { EditorCoroutineUtility.StartCoroutine(PrepareUpload(), this); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(packagingInProgress || uploadInProgress || !uploadPossible); if (GUILayout.Button("Upload")) { EditorCoroutineUtility.StartCoroutine(UploadLevels(), this); } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); if (verifications.Count() > 0) { GUILayout.Space(10); GUILayout.Label("Verification Results", EditorStyles.boldLabel); foreach (string dir in GetLevelPaths()) { string levelName = Path.GetFileName(dir); if (!verifications.ContainsKey(levelName)) { continue; } VerificationResult v = verifications[levelName]; v.showDetails = EditorGUILayout.Foldout(v.showDetails, levelName); if (v.showDetails) { // PrintTableRow("Size (Original)", SDKUtil.BytesToString(v.sourceSize)); PrintTableRow("Size (Quest)", v.distroExistsAndroid ? SDKUtil.BytesToString(v.distroSizeAndroid) : "not packaged yet"); PrintTableRow("Size (PC)", v.distroExistsStandalone ? SDKUtil.BytesToString(v.distroSizeStandalone) : "not packaged yet"); if (v.documentationExists) { BeginPartialTableRow("Documentation"); if (GUILayout.Button("Open")) { Help.BrowseURL(GetDocuPath(levelName) + "index.html"); } EndPartialTableRow(); } else { PrintTableRow("Documentation", "not created yet"); } } } } if (debugMode) { EditorGUI.BeginDisabledGroup(documentationInProgress); if (GUILayout.Button("Create Documentation")) { EditorCoroutineUtility.StartCoroutine(CreateDocumentation(), this); } EditorGUI.EndDisabledGroup(); } OnGUIDone(); }