public void SplashSectionGUI(BuildPlatform platform, ISettingEditorExtension settingsExtension, int sectionIndex = 2) { if (m_Owner.BeginSettingsBox(sectionIndex, k_Texts.title)) { if (platform.namedBuildTarget == NamedBuildTarget.Server) { PlayerSettingsEditor.ShowNoSettings(); EditorGUILayout.Space(); } else { ObjectReferencePropertyField <Texture2D>(m_VirtualRealitySplashScreen, k_Texts.vrSplashScreen); if (TargetSupportsOptionalBuiltinSplashScreen(platform.namedBuildTarget.ToBuildTargetGroup(), settingsExtension)) { BuiltinCustomSplashScreenGUI(platform.namedBuildTarget.ToBuildTargetGroup(), settingsExtension); } if (settingsExtension != null) { settingsExtension.SplashSectionGUI(); } if (m_ShowUnitySplashScreen.boolValue) { m_Owner.ShowSharedNote(); } } } m_Owner.EndSettingsBox(); }
public void SplashSectionGUI(BuildPlatform platform, BuildTargetGroup targetGroup, ISettingEditorExtension settingsExtension, int sectionIndex = 2) { if (m_Owner.BeginSettingsBox(sectionIndex, k_Texts.title)) { ObjectReferencePropertyField <Texture2D>(m_VirtualRealitySplashScreen, k_Texts.vrSplashScreen); if (TargetSupportsOptionalBuiltinSplashScreen(targetGroup, settingsExtension)) { BuiltinCustomSplashScreenGUI(); } if (settingsExtension != null) { settingsExtension.SplashSectionGUI(); } if (m_ShowUnitySplashScreen.boolValue) { m_Owner.ShowSharedNote(); } } m_Owner.EndSettingsBox(); }
private static bool TargetSupportsOptionalBuiltinSplashScreen(BuildTargetGroup targetGroup, ISettingEditorExtension settingsExtension) { if (settingsExtension != null) { return(settingsExtension.CanShowUnitySplashScreen()); } return(targetGroup == BuildTargetGroup.Standalone); }
public void SplashSectionGUI(BuildPlayerWindow.BuildPlatform platform, BuildTargetGroup targetGroup, ISettingEditorExtension settingsExtension) { GUI.changed = false; if (this.m_Owner.BeginSettingsBox(2, PlayerSettingsSplashScreenEditor.k_Texts.title)) { if (targetGroup == BuildTargetGroup.Standalone) { PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Texture2D>(this.m_ResolutionDialogBanner, PlayerSettingsSplashScreenEditor.k_Texts.configDialogBanner); EditorGUILayout.Space(); } if (this.m_Owner.m_VRSettings.TargetGroupSupportsVirtualReality(targetGroup)) { PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Texture2D>(this.m_VirtualRealitySplashScreen, PlayerSettingsSplashScreenEditor.k_Texts.vrSplashScreen); } if (PlayerSettingsSplashScreenEditor.TargetSupportsOptionalBuiltinSplashScreen(targetGroup, settingsExtension)) { this.BuiltinCustomSplashScreenGUI(); } if (settingsExtension != null) { settingsExtension.SplashSectionGUI(); } if (this.m_ShowUnitySplashScreen.boolValue) { this.m_Owner.ShowSharedNote(); } } this.m_Owner.EndSettingsBox(); }
public void SplashSectionGUI(BuildPlatform platform, BuildTargetGroup targetGroup, ISettingEditorExtension settingsExtension, int sectionIndex = 2) { if (m_Owner.BeginSettingsBox(sectionIndex, k_Texts.title)) { if (targetGroup == BuildTargetGroup.Standalone) { ObjectReferencePropertyField <Texture2D>(m_ResolutionDialogBanner, k_Texts.configDialogBanner); if (m_ResolutionDialogBanner.objectReferenceValue != null) { EditorGUILayout.HelpBox(k_Texts.configDialogBannerDeprecationWarning.text, MessageType.Warning, true); } EditorGUILayout.Space(); } if (m_Owner.m_VRSettings.TargetGroupSupportsVirtualReality(targetGroup)) { ObjectReferencePropertyField <Texture2D>(m_VirtualRealitySplashScreen, k_Texts.vrSplashScreen); } if (TargetSupportsOptionalBuiltinSplashScreen(targetGroup, settingsExtension)) { BuiltinCustomSplashScreenGUI(); } if (settingsExtension != null) { settingsExtension.SplashSectionGUI(); } if (m_ShowUnitySplashScreen.boolValue) { m_Owner.ShowSharedNote(); } } m_Owner.EndSettingsBox(); }
public void IconSectionGUI(NamedBuildTarget namedBuildTarget, ISettingEditorExtension settingsExtension, int platformID, int sectionIndex) { m_SelectedPlatform = platformID; if (!m_Owner.BeginSettingsBox(sectionIndex, SettingsContent.iconTitle)) { m_Owner.EndSettingsBox(); return; } var platformUsesStandardIcons = true; if (settingsExtension != null) { platformUsesStandardIcons = settingsExtension.UsesStandardIcons(); } if (platformUsesStandardIcons) { var selectedDefault = (m_SelectedPlatform < 0); // Set default platform variables BuildPlatform platform = null; namedBuildTarget = NamedBuildTarget.Standalone; var platformName = ""; // Override if a platform is selected if (!selectedDefault) { platform = m_ValidPlatforms[m_SelectedPlatform]; namedBuildTarget = platform.namedBuildTarget; platformName = platform.name; } if (namedBuildTarget == NamedBuildTarget.WebGL || namedBuildTarget == NamedBuildTarget.Server) { PlayerSettingsEditor.ShowNoSettings(); EditorGUILayout.Space(); } else if (namedBuildTarget != NamedBuildTarget.WindowsStoreApps) // UWP does this in its editor extension { // Both default icon and Legacy icons are serialized to the same map // That's why m_LegacyPlatformIcons can be excluded in two places (other place in CommonSettings()) using (var vertical = new EditorGUILayout.VerticalScope()) using (new EditorGUI.PropertyScope(vertical.rect, GUIContent.none, m_LegacyPlatformIcons)) { // Get icons and icon sizes for selected platform (or default) var icons = PlayerSettings.GetPlatformIconsForTargetIcons(platformName, IconKind.Any, m_AllLegacyIcons); var widths = PlayerSettings.GetIconWidthsForPlatform(platformName, IconKind.Any); var heights = PlayerSettings.GetIconHeightsForPlatform(platformName, IconKind.Any); var kinds = PlayerSettings.GetIconKindsForPlatform(platformName); var overrideIcons = true; if (!selectedDefault) { // If the list of icons for this platform is not empty (and has the correct size), // consider the icon overridden for this platform EditorGUI.BeginChangeCheck(); overrideIcons = (icons.Length == widths.Length); overrideIcons = GUILayout.Toggle(overrideIcons, string.Format(L10n.Tr("Override for {0}"), platform.title.text)); EditorGUI.BeginDisabled(!overrideIcons); var changed = EditorGUI.EndChangeCheck(); if (changed || (!overrideIcons && icons.Length > 0)) { // Set the list of icons to correct length if overridden, otherwise to an empty list if (overrideIcons) { icons = new Texture2D[widths.Length]; } else { icons = new Texture2D[0]; } if (changed) { SetLegacyPlatformIcons(platformName, icons, IconKind.Any, ref m_AllLegacyIcons); } } } // Show the icons for this platform (or default) EditorGUI.BeginChangeCheck(); for (int i = 0; i < widths.Length; i++) { var previewWidth = Mathf.Min(kMaxPreviewSize, widths[i]); var previewHeight = (int)((float)heights[i] * previewWidth / widths[i]); // take into account the aspect ratio if (namedBuildTarget == NamedBuildTarget.iOS) { // Spotlight icons begin with 120 but there are two in the list. // So check if the next one is 80. if (kinds[i] == IconKind.Spotlight && kinds[i - 1] != IconKind.Spotlight) { var labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20); GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Spotlight icons", EditorStyles.boldLabel); } if (kinds[i] == IconKind.Settings && kinds[i - 1] != IconKind.Settings) { var labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20); GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Settings icons", EditorStyles.boldLabel); } if (kinds[i] == IconKind.Notification && kinds[i - 1] != IconKind.Notification) { var labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20); GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Notification icons", EditorStyles.boldLabel); } if (kinds[i] == IconKind.Store && kinds[i - 1] != IconKind.Store) { var labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20); GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "App Store icons", EditorStyles.boldLabel); } } var rect = GUILayoutUtility.GetRect(kSlotSize, Mathf.Max(kSlotSize, previewHeight) + kIconSpacing); var width = Mathf.Min(rect.width, EditorGUIUtility.labelWidth + 4 + kSlotSize + kIconSpacing + kMaxPreviewSize); // Label var label = widths[i] + "x" + heights[i]; GUI.Label(new Rect(rect.x, rect.y, width - kMaxPreviewSize - kSlotSize - 2 * kIconSpacing, 20), label); // Texture slot if (overrideIcons) { var slotWidth = kSlotSize; var slotHeight = (int)((float)heights[i] / widths[i] * kSlotSize); // take into account the aspect ratio icons[i] = (Texture2D)EditorGUI.ObjectField( new Rect(rect.x + width - kMaxPreviewSize - kSlotSize - kIconSpacing, rect.y, slotWidth, slotHeight), icons[i], typeof(Texture2D), false); } // Preview var previewRect = new Rect(rect.x + width - kMaxPreviewSize, rect.y, previewWidth, previewHeight); var closestIcon = PlayerSettings.GetPlatformIconForSizeForTargetIcons(platformName, widths[i], heights[i], kinds[i], m_AllLegacyIcons); if (closestIcon != null) { GUI.DrawTexture(previewRect, closestIcon); } else { GUI.Box(previewRect, ""); } } // Save changes if (EditorGUI.EndChangeCheck()) { Undo.RecordObjects(m_Owner.targets, SettingsContent.undoChangedIconString); SetLegacyPlatformIcons(platformName, icons, IconKind.Any, ref m_AllLegacyIcons); } EditorGUI.EndDisabled(); if (namedBuildTarget == NamedBuildTarget.iOS || namedBuildTarget == NamedBuildTarget.tvOS) { EditorGUILayout.PropertyField(m_UIPrerenderedIcon, SettingsContent.UIPrerenderedIcon); EditorGUILayout.Space(); } } } } if (settingsExtension != null) { settingsExtension.IconSectionGUI(); } m_Owner.EndSettingsBox(); }
private void BuiltinCustomSplashScreenGUI(BuildTargetGroup targetGroup, ISettingEditorExtension settingsExtension) { EditorGUILayout.LabelField(k_Texts.splashTitle, EditorStyles.boldLabel); using (new EditorGUI.DisabledScope(!licenseAllowsDisabling)) { EditorGUILayout.PropertyField(m_ShowUnitySplashScreen, k_Texts.showSplash); if (!m_ShowUnitySplashScreen.boolValue) { return; } } GUIContent buttonLabel = SplashScreen.isFinished ? k_Texts.previewSplash : k_Texts.cancelPreviewSplash; Rect previewButtonRect = GUILayoutUtility.GetRect(buttonLabel, "button"); previewButtonRect = EditorGUI.PrefixLabel(previewButtonRect, new GUIContent(" ")); if (GUI.Button(previewButtonRect, buttonLabel)) { if (SplashScreen.isFinished) { SplashScreen.Begin(); PlayModeView.RepaintAll(); var playModeView = PlayModeView.GetMainPlayModeView(); if (playModeView) { playModeView.Focus(); } EditorApplication.update += PollSplashState; } else { SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); EditorApplication.update -= PollSplashState; } GameView.RepaintAll(); } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_SplashScreenLogoStyle, k_Texts.splashStyle); if (EditorGUI.EndChangeCheck()) { if (m_SplashScreenLogoStyle.intValue == (int)PlayerSettings.SplashScreen.UnityLogoStyle.DarkOnLight) { m_SplashScreenBackgroundColor.colorValue = k_DarkOnLightBgColor; } else { m_SplashScreenBackgroundColor.colorValue = k_LightOnDarkBgColor; } } // Animation EditorGUILayout.PropertyField(m_SplashScreenAnimation, k_Texts.animate); m_ShowAnimationControlsAnimator.target = m_SplashScreenAnimation.intValue == (int)PlayerSettings.SplashScreen.AnimationMode.Custom; if (EditorGUILayout.BeginFadeGroup(m_ShowAnimationControlsAnimator.faded)) { EditorGUI.indentLevel++; EditorGUILayout.Slider(m_SplashScreenLogoAnimationZoom, 0.0f, 1.0f, k_Texts.logoZoom); EditorGUILayout.Slider(m_SplashScreenBackgroundAnimationZoom, 0.0f, 1.0f, k_Texts.backgroundZoom); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); EditorGUILayout.Space(); // Logos EditorGUILayout.LabelField(k_Texts.logosTitle, EditorStyles.boldLabel); using (new EditorGUI.DisabledScope(!Application.HasProLicense())) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_ShowUnitySplashLogo, k_Texts.showLogo); if (EditorGUI.EndChangeCheck()) { if (!m_ShowUnitySplashLogo.boolValue) { RemoveUnityLogoFromLogosList(); } else if (m_SplashScreenDrawMode.intValue == (int)PlayerSettings.SplashScreen.DrawMode.AllSequential) { AddUnityLogoToLogosList(); } } m_ShowLogoControlsAnimator.target = m_ShowUnitySplashLogo.boolValue; } if (EditorGUILayout.BeginFadeGroup(m_ShowLogoControlsAnimator.faded)) { EditorGUI.BeginChangeCheck(); var oldDrawmode = m_SplashScreenDrawMode.intValue; EditorGUILayout.PropertyField(m_SplashScreenDrawMode, k_Texts.drawMode); if (oldDrawmode != m_SplashScreenDrawMode.intValue) { if (m_SplashScreenDrawMode.intValue == (int)PlayerSettings.SplashScreen.DrawMode.UnityLogoBelow) { RemoveUnityLogoFromLogosList(); } else { AddUnityLogoToLogosList(); } } } EditorGUILayout.EndFadeGroup(); using (var vertical = new EditorGUILayout.VerticalScope()) using (new EditorGUI.PropertyScope(vertical.rect, GUIContent.none, m_SplashScreenLogos)) { m_LogoList.DoLayoutList(); } EditorGUILayout.Space(); // Background EditorGUILayout.LabelField(k_Texts.backgroundTitle, EditorStyles.boldLabel); EditorGUILayout.Slider(m_SplashScreenOverlayOpacity, Application.HasProLicense() ? k_MinProEditionOverlayOpacity : k_MinPersonalEditionOverlayOpacity, 1.0f, k_Texts.overlayOpacity); m_ShowBackgroundColorAnimator.target = m_SplashScreenBackgroundLandscape.objectReferenceValue == null; if (EditorGUILayout.BeginFadeGroup(m_ShowBackgroundColorAnimator.faded)) { EditorGUILayout.PropertyField(m_SplashScreenBackgroundColor, k_Texts.backgroundColor); } EditorGUILayout.EndFadeGroup(); EditorGUILayout.PropertyField(m_SplashScreenBlurBackground, k_Texts.blurBackground); EditorGUI.BeginChangeCheck(); ObjectReferencePropertyField <Sprite>(m_SplashScreenBackgroundLandscape, k_Texts.backgroundImage); if (EditorGUI.EndChangeCheck() && m_SplashScreenBackgroundLandscape.objectReferenceValue == null) { m_SplashScreenBackgroundPortrait.objectReferenceValue = null; } using (new EditorGUI.DisabledScope(m_SplashScreenBackgroundLandscape.objectReferenceValue == null)) { ObjectReferencePropertyField <Sprite>(m_SplashScreenBackgroundPortrait, k_Texts.backgroundPortraitImage); } }