コード例 #1
0
		public bool drawInspector()
		{
			ErrorReporter errorReporter = new ErrorReporter();
			
			// -------------------
			// Product parameters
			// -------------------
			ProductParametersRenderer productParametersRenderer = new ProductParametersRenderer(m_advancedBuilder.getProductParameters());
			productParametersRenderer.checkWarningsAndErrors(errorReporter);

			if (GUIUtils.DrawHeader("Product Parameters", "ab_product_parameters"))
			{
				GUIUtils.BeginContents();
				productParametersRenderer.drawInspector();
				GUIUtils.EndContents();
			}
			
			
			
			// --------------
			// Release Types
			// --------------
			ReleaseTypesRenderer releaseTypesRenderer = new ReleaseTypesRenderer(m_advancedBuilder.getReleaseTypes());
			releaseTypesRenderer.checkWarningsAndErrors(errorReporter);

			if (GUIUtils.DrawHeader("Release Types", "ab_release_types"))
			{
				GUIUtils.BeginContents();
				releaseTypesRenderer.drawInspector();
				GUIUtils.EndContents();
			}
			
			
			
			// ----------
			// Platforms
			// ----------
			PlatformsRenderer platformsRenderer = new PlatformsRenderer(m_advancedBuilder.getPlatforms());
			platformsRenderer.checkWarningsAndErrors(errorReporter);

			if (GUIUtils.DrawHeader("Platforms", "ab_platforms"))
			{
				GUIUtils.BeginContents();
				platformsRenderer.drawInspector();
				GUIUtils.EndContents();
			}



			// ------------------
			// Advanced Settings
			// ------------------
			AdvancedSettingsRenderer advancedSettingsRenderer = new AdvancedSettingsRenderer(m_advancedBuilder.getAdvancedSettings());
			advancedSettingsRenderer.checkWarningsAndErrors(errorReporter);

			if (GUIUtils.DrawHeader("Advanced Settings", "ab_advanced_settings"))
			{
				GUIUtils.BeginContents();
				advancedSettingsRenderer.drawInspector();
				GUIUtils.EndContents();
			}



			// ------------------
			// App Configuration
			// ------------------
			ProjectConfigurationsRenderer projectConfigurationsRenderer = new ProjectConfigurationsRenderer(m_advancedBuilder, m_advancedBuilder.getProjectConfigurations());
			projectConfigurationsRenderer.checkWarningsAndErrors(errorReporter);

			if (GUIUtils.DrawHeader("Project Configurations", "ab_project_configurations"))
			{
				GUIUtils.BeginContents();
				bool wasBuildProcessLaunched = projectConfigurationsRenderer.drawInspector(platformsRenderer, errorReporter);
				if (wasBuildProcessLaunched)
				{
					return true;
				}
				GUIUtils.EndContents();
			}



			// ------------------
			// Perform Build
			// ------------------
			if (GUIUtils.DrawHeader("Perform Build", "ab_perform_build", true))
			{
				GUIUtils.BeginContents();
				{
					if (errorReporter.getWarningCount() > 0 || errorReporter.getErrorCount() > 0)
					{
						foreach (string iMessage in errorReporter.getErrorList())
						{
							EditorGUILayout.HelpBox(iMessage, MessageType.Error, true);
						}

						foreach (string iMessage in errorReporter.getWarningList())
						{
							EditorGUILayout.HelpBox(iMessage, MessageType.Warning, true);
						}
					}


					bool isBuildAllowed = m_advancedBuilder.getProjectConfigurations().getTotalBuildCount() != 0 && errorReporter.getErrorCount() <= 0;
					
					
					/*
					 * Perform the build
					 */
					GUI.enabled = isBuildAllowed;
					
					if (GUIUtils.DrawBigButton("Perform a total of " + m_advancedBuilder.getProjectConfigurations().getTotalBuildCount() + " builds", Color.green))
					{
						if (m_advancedBuilder.getProjectConfigurations().getTotalAutoRunBuildCount() > 3)
						{
							if (EditorUtility.DisplayDialog("Launch build?", "You have selected the 'Autorun Build' option and you are making multiple builds, are you sure you want to continue?", "Yes", "Cancel"))
							{
								AdvancedBuilder.PerformBuild();
							}
						}
						else
						{
							AdvancedBuilder.PerformBuild();
						}

						return true;
					}
					
					GUI.enabled = true;
						
						
					/*
					 * Button to open build folder
					 */
					if (GUIUtils.DrawBigButton("Open Build folder"))
					{
						string buildFolderPath = Application.dataPath.Replace("Assets", "Builds");
						
						if (!Directory.Exists(buildFolderPath))
						{
							Directory.CreateDirectory(buildFolderPath);
						}
						
						EditorUtility.OpenWithDefaultApp(buildFolderPath);
					}
					
					GUILayout.Space(5f);
				}
				GUIUtils.EndContents();
			}

			return false;
		}
		private bool drawConfigurationDetail(PlatformsRenderer platformsRenderer, ErrorReporter errorReporter)
		{
			if (m_projectConfigurations.selectedConfigurationIndex >= m_projectConfigurations.configurationList.Count)
			{
				m_projectConfigurations.selectedConfigurationIndex = -1;
				return false;
			}

			Configuration configuration = m_projectConfigurations.configurationList[m_projectConfigurations.selectedConfigurationIndex];

			if (GUIUtils.DrawHeader("Configuration information", true))
			{
				GUIUtils.BeginContents();
				
				GUILayout.BeginHorizontal();
				{
					GUILayout.BeginVertical();
					{
						configuration.name = EditorGUILayout.TextField("Name:", configuration.name);

						EditorGUILayout.LabelField("Default Defines:", configuration.getDefines());
						configuration.customDefines = EditorGUILayout.TextField("Custom Defines:", configuration.customDefines);

						if (configuration.platformType == PlatformType.WindowsStore)
						{
							if (PlatformWindowsStore.IsUniversal(configuration.platformArchitecture.name))
							{
								configuration.wsaBuildAndRunDeployTarget = (WSABuildAndRunDeployTarget)EditorGUILayout.EnumPopup("Build and Deploy Target", configuration.wsaBuildAndRunDeployTarget);
							}
						}

						/*if (configuration.platformType == PlatformType.Android)
						{
							configuration.appendProject = EditorGUILayout.ToggleLeft(new GUIContent("Append project", "(Used when building Eclipse project) This setting will create a new Eclipse project. Existing Eclipse project setting changes will be discarded."), configuration.appendProject);
						}
						else */if (configuration.platformType == PlatformType.iOS)
						{
							configuration.appendProject = EditorGUILayout.ToggleLeft(new GUIContent("Append project", "This setting will append an existing Xcode project. Existing Xcode project setting changes will be preserved."), configuration.appendProject);
						}
						else if (configuration.platformType == PlatformType.WindowsStore)
						{
							configuration.appendProject = EditorGUILayout.ToggleLeft(new GUIContent("Append project", "This setting will append an existing project instead of replacing it."), configuration.appendProject);
						}

						configuration.openBuildFolder = EditorGUILayout.ToggleLeft("Open build folder after build", configuration.openBuildFolder);
						configuration.isDevelopmentBuild = EditorGUILayout.ToggleLeft("Development build", configuration.isDevelopmentBuild);
						configuration.shouldAutoconnectProfiler = EditorGUILayout.ToggleLeft("Autoconnect Profiler", configuration.shouldAutoconnectProfiler);
						configuration.allowDebugging = EditorGUILayout.ToggleLeft("Allow script debugging", configuration.allowDebugging);
						configuration.shouldAutoRunPlayer = EditorGUILayout.ToggleLeft("Autorun Build", configuration.shouldAutoRunPlayer);

						m_configurationSceneRenderer.drawInspector(configuration);

						if (GUIUtils.DrawHeader("Build information"))
						{
							GUIUtils.BeginContents();
							{
								PlatformRenderer platformRenderer = platformsRenderer.getPlatformRendererFromPlatform(configuration.platform.getPlatformProperties().platformType);
								platformRenderer.drawBuildSummary(m_advancedBuilder.getAdvancedSettings(), configuration, m_advancedBuilder.getProductParameters().bundleVersion);
							}
							GUIUtils.EndContents();
						}
						
						GUILayout.BeginHorizontal();
						{
							if (GUILayout.Button("Apply this config" + (m_projectConfigurations.isCurrentConfig(configuration) ? " (Current)" : "")))
							{
								configuration.applyConfiguration();
							}

							GUI.enabled = errorReporter.getErrorCount() == 0;
							if (GUILayout.Button("Build"))
							{
								AdvancedBuilder.PerformBuild(configuration);
								return true;
							}
							GUI.enabled = true;
						}
						GUILayout.EndHorizontal();
					}
					GUILayout.EndVertical();
				}
				GUILayout.EndHorizontal();
				
				GUIUtils.EndContents();
			}

			return false;
		}