private static float GetAssetConfigElementHeight() { float totalHeight = 0f; if (OVRPlatformToolSettings.AssetConfigs.Count > 0) { for (int i = 0; i < OVRPlatformToolSettings.AssetConfigs.Count; i++) { AssetConfig config = OVRPlatformToolSettings.AssetConfigs[i]; totalHeight += config.GetFoldoutState() ? SINGLE_LINE_SPACING * 4 : SINGLE_LINE_SPACING; } } else { totalHeight += SINGLE_LINE_SPACING; } return(totalHeight + ASSET_CONFIG_BACKGROUND_PADDING); }
private static void DrawAssetConfigElement(Rect rect) { Rect elementRect = new Rect(rect.x, rect.y + SINGLE_LINE_SPACING + ASSET_CONFIG_BACKGROUND_PADDING / 2, rect.width, SINGLE_LINE_SPACING); if (OVRPlatformToolSettings.AssetConfigs.Count > 0) { for (int i = 0; i < OVRPlatformToolSettings.AssetConfigs.Count; i++) { AssetConfig config = OVRPlatformToolSettings.AssetConfigs[i]; GUIContent fieldLabel; config.SetFoldoutState(EditorGUI.Foldout(elementRect, config.GetFoldoutState(), config.name, boldFoldoutStyle)); if (config.GetFoldoutState()) { Rect attributeRect = new Rect(elementRect.x + INDENT_SPACING, elementRect.y + SINGLE_LINE_SPACING, elementRect.width - INDENT_SPACING - 3f, SINGLE_LINE_SPACING); // Extra asset config params are disabled for now until CLI supports them #if !DISABLE_EXTRA_ASSET_CONFIG fieldLabel = new GUIContent("Required Asset [?]", "Whether or not this asset file is required for the app to run."); config.required = EditorGUI.Toggle(attributeRect, fieldLabel, config.required); attributeRect.y += SINGLE_LINE_SPACING; fieldLabel = new GUIContent("Asset Type [?]", "The asset file type."); config.type = (AssetConfig.AssetType)EditorGUI.EnumPopup(attributeRect, fieldLabel, config.type); attributeRect.y += SINGLE_LINE_SPACING; #endif fieldLabel = new GUIContent("Asset SKU [?]", "The Oculus store SKU for this asset file."); config.sku = EditorGUI.TextField(attributeRect, fieldLabel, config.sku); elementRect.y = attributeRect.y; } elementRect.y += SINGLE_LINE_SPACING; } } else { EditorGUI.LabelField(elementRect, "No asset files found. Choose a valid assets directory."); } }
private static bool genUploadCommand(TargetPlatform targetPlatform, out string command) { bool success = true; command = ""; switch (targetPlatform) { case TargetPlatform.Rift: command = "upload-rift-build"; break; case TargetPlatform.OculusGoGearVR: command = "upload-mobile-build"; break; case TargetPlatform.Quest: command = "upload-quest-build"; break; default: OVRPlatformTool.log += "ERROR: Invalid target platform selected"; success = false; break; } // Add App ID ValidateTextField(AppIDFieldValidator, OVRPlatformToolSettings.AppID, "App ID", ref success); command += " --app-id \"" + OVRPlatformToolSettings.AppID + "\""; // Add App Token ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.AppToken, "App Token", ref success); command += " --app-secret \"" + OVRPlatformToolSettings.AppToken + "\""; // Add Platform specific fields if (targetPlatform == TargetPlatform.Rift) { // Add Rift Build Directory ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.RiftBuildDirectory, "Rift Build Directory", ref success); command += " --build-dir \"" + OVRPlatformToolSettings.RiftBuildDirectory + "\""; // Add Rift Launch File ValidateTextField(FileValidator, OVRPlatformToolSettings.RiftLaunchFile, "Rift Launch File Path", ref success); command += " --launch-file \"" + OVRPlatformToolSettings.RiftLaunchFile + "\""; // Add Rift Build Version ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.RiftBuildVersion, "Build Version", ref success); command += " --version \"" + OVRPlatformToolSettings.RiftBuildVersion + "\""; // Add Rift Launch Parameters if (!string.IsNullOrEmpty(OVRPlatformToolSettings.RiftLaunchParams)) { ValidateTextField(LaunchParameterValidator, OVRPlatformToolSettings.RiftLaunchParams, "Launch Parameters", ref success); command += " --launch_params \"" + OVRPlatformToolSettings.RiftLaunchParams + "\""; } // Add 2D Launch File if (!string.IsNullOrEmpty(OVRPlatformToolSettings.Rift2DLaunchFile)) { ValidateTextField(FileValidator, OVRPlatformToolSettings.Rift2DLaunchFile, "2D Launch File", ref success); command += " --launch_file_2d \"" + OVRPlatformToolSettings.Rift2DLaunchFile + "\""; if (!string.IsNullOrEmpty(OVRPlatformToolSettings.Rift2DLaunchParams)) { ValidateTextField(LaunchParameterValidator, OVRPlatformToolSettings.Rift2DLaunchParams, "2D Launch Parameters", ref success); command += " --launch_params_2d \"" + OVRPlatformToolSettings.Rift2DLaunchParams + "\""; } } // Add Firewall Exception if (OVRPlatformToolSettings.RiftFirewallException) { command += " --firewall_exceptions true"; } // Add Redistributable Packages List <string> redistCommandIds = new List <string>(); for (int i = 0; i < OVRPlatformToolSettings.RiftRedistPackages.Count; i++) { if (OVRPlatformToolSettings.RiftRedistPackages[i].include) { redistCommandIds.Add(OVRPlatformToolSettings.RiftRedistPackages[i].id); } } if (redistCommandIds.Count > 0) { command += " --redistributables \"" + string.Join(",", redistCommandIds.ToArray()) + "\""; } // Add Gamepad Emulation if (OVRPlatformToolSettings.RiftGamepadEmulation > OVRPlatformToolSettings.GamepadType.OFF && OVRPlatformToolSettings.RiftGamepadEmulation <= OVRPlatformToolSettings.GamepadType.LEFT_D_PAD) { command += " --gamepad-emulation "; switch (OVRPlatformToolSettings.RiftGamepadEmulation) { case OVRPlatformToolSettings.GamepadType.TWINSTICK: command += "TWINSTICK"; break; case OVRPlatformToolSettings.GamepadType.RIGHT_D_PAD: command += "RIGHT_D_PAD"; break; case OVRPlatformToolSettings.GamepadType.LEFT_D_PAD: command += "LEFT_D_PAD"; break; default: command += "OFF"; break; } } // Add Rift Language Pack Directory if (!string.IsNullOrEmpty(OVRPlatformToolSettings.LanguagePackDirectory)) { ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.LanguagePackDirectory, "Language Pack Directory", ref success); command += " --language_packs_dir \"" + OVRPlatformToolSettings.LanguagePackDirectory + "\""; } } else { // Add APK Build Path ValidateTextField(FileValidator, OVRPlatformToolSettings.ApkBuildPath, "APK Build Path", ref success); command += " --apk \"" + OVRPlatformToolSettings.ApkBuildPath + "\""; // Add OBB File Path if (!string.IsNullOrEmpty(OVRPlatformToolSettings.ObbFilePath)) { ValidateTextField(FileValidator, OVRPlatformToolSettings.ObbFilePath, "OBB File Path", ref success); command += " --obb \"" + OVRPlatformToolSettings.ObbFilePath + "\""; } if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR) { // Go and Gear VR specific commands } else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest) { // Quest specific commands } } // Add Assets Directory if (!string.IsNullOrEmpty(OVRPlatformToolSettings.AssetsDirectory)) { ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.AssetsDirectory, "Assets Directory", ref success); command += " --assets-dir \"" + OVRPlatformToolSettings.AssetsDirectory + "\""; // Add Asset Configurations if (OVRPlatformToolSettings.AssetConfigs.Count > 0) { List <string> assetConfigs = new List <string>(); for (int i = 0; i < OVRPlatformToolSettings.AssetConfigs.Count; i++) { List <string> configParameters = new List <string>(); AssetConfig config = OVRPlatformToolSettings.AssetConfigs[i]; if (config.required) { configParameters.Add("\"required\": true"); } if (config.type > AssetConfig.AssetType.DEFAULT) { string typeCommand = "\"type\": "; switch (config.type) { case AssetConfig.AssetType.LANGUAGE_PACK: configParameters.Add(typeCommand + "LANGUAGE_PACK"); break; case AssetConfig.AssetType.STORE: configParameters.Add(typeCommand + "STORE"); break; default: configParameters.Add(typeCommand + "DEFAULT"); break; } } if (!string.IsNullOrEmpty(config.sku)) { configParameters.Add("\"sku\": " + config.sku); } if (configParameters.Count > 0) { string configString = "\"" + config.name + "\": {" + string.Join(",", configParameters.ToArray()) + "}"; assetConfigs.Add(configString); } } if (assetConfigs.Count > 0) { command += " --asset_files_config='{" + string.Join(",", assetConfigs.ToArray()) + "}'"; } } } // Add Release Channel ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.ReleaseChannel, "Release Channel", ref success); command += " --channel \"" + OVRPlatformToolSettings.ReleaseChannel + "\""; // Add Notes if (!string.IsNullOrEmpty(OVRPlatformToolSettings.ReleaseNote)) { string sanatizedReleaseNote = OVRPlatformToolSettings.ReleaseNote; sanatizedReleaseNote = sanatizedReleaseNote.Replace("\"", "\"\""); command += " --notes \"" + sanatizedReleaseNote + "\""; } return(success); }