public static string GetTransitionTooltip(UIGraphicEventState.EventTransitionType transitionType) { switch (transitionType) { case UIGraphicEventState.EventTransitionType.Color: return("ALL GRAPHIC TYPES: \n\nChanges this Graphic's Color. For Text objects, it changes the Text color. For Image objects, it changes the Image background color"); case UIGraphicEventState.EventTransitionType.Material: return("ALL GRAPHIC TYPES: \n\nAdjusts the Graphic's Material by immediately assigning it a new material"); case UIGraphicEventState.EventTransitionType.Rotation: return("ALL GRAPHIC TYPES: \n\nAdjusts the Graphic's Rotation. For 2D UI, use the positive and negative Z-axis to rotate the object right and left, respectively"); case UIGraphicEventState.EventTransitionType.Scale: return("ALL GRAPHIC TYPES: \n\nAdjusts the Graphic's Scale. in 2D UI, the Z-axis will have no influence on the object's scale"); case UIGraphicEventState.EventTransitionType.SpriteAndFill: return("IMAGE GRAPHICS ONLY! \n\nIf a sprite is chosen, you will have the option to make this transition fill in the sprite over the Event's duration"); case UIGraphicEventState.EventTransitionType.TextFontSize: return("TEXT GRAPHICS ONLY! \n\nAdjusts the font size of a text object. This has much more predictable results than scaling a Text object"); case UIGraphicEventState.EventTransitionType.TextWriteout: return("TEXT GRAPHICS ONLY! \n\nAdjusts a Text graphic's text all at once, or over the Event's duration"); default: return(""); } }
private void ShowTransitionConfiguration(UIGraphicEventState.EventStateSingle eventState) { /* * Allows the user to Preview their Event transitions as well */ if (eventState == null) { return; } GUI_ShowTransitionSelectionUI(eventState); // Show Base Properties UIGraphicEventState.EventTransitionType transitionType = _thisEventStateObject.selectedEventTransitionInternal; switch (_thisEventStateObject.selectedEventTransitionInternal) { case UIGraphicEventState.EventTransitionType.Rotation: { // ----- Show Rotation in Custom Inspector ---- // UIGraphicEventState.RotationTransition rotationTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { rotationTransition = (UIGraphicEventState.RotationTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (rotationTransition != null) { // Transition Rotation GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); rotationTransition.rotation = EditorGUILayout.Vector3Field("Rotation", rotationTransition.rotation); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Rotation Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } break; case UIGraphicEventState.EventTransitionType.Scale: { // ----- Show Scale in Custom Inspector ---- // UIGraphicEventState.ScaleTransition scaleTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { scaleTransition = (UIGraphicEventState.ScaleTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (scaleTransition != null) { // Transition Scale GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); scaleTransition.scale = EditorGUILayout.Vector3Field("Scale", scaleTransition.scale); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Scale Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } break; case UIGraphicEventState.EventTransitionType.Color: { // ----- Show Image Color in Custom Inspector ---- // UIGraphicEventState.ColorTransition imageColorTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { imageColorTransition = (UIGraphicEventState.ColorTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (imageColorTransition != null) { // The color we end on GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); imageColorTransition.color = EditorGUILayout.ColorField("Color", imageColorTransition.color); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Image Color Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } break; case UIGraphicEventState.EventTransitionType.Material: { // ----- Show Material transition in Custom Inspector ---- // UIGraphicEventState.MaterialTransition materialTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { materialTransition = (UIGraphicEventState.MaterialTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (materialTransition != null) { // Transition Material GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); materialTransition.finalMaterial = (Material)EditorGUILayout.ObjectField("Material to use", materialTransition.finalMaterial, typeof(Material), true); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Material Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } break; case UIGraphicEventState.EventTransitionType.SpriteAndFill: { // ----- Show Image Sprite in Custom Inspector ---- // if (_thisEventStateObject.imageElement != null) { UIGraphicEventState.SpriteAndFillTransition spriteAndFillTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { spriteAndFillTransition = (UIGraphicEventState.SpriteAndFillTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (spriteAndFillTransition != null) { // Only show other properties if there is a sprite, otherwise it's useless if (spriteAndFillTransition.finalSprite != null) { // Use Image Fill GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); spriteAndFillTransition.useImageFill = EditorGUILayout.Toggle("Use Image Fill", spriteAndFillTransition.useImageFill); GUILayout.EndHorizontal(); // Fill Type enum GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); spriteAndFillTransition.fillType = (UIGraphicEventState.SpriteAndFillTransition.FillType)EditorGUILayout.EnumPopup("Image Fill Type", spriteAndFillTransition.fillType); GUILayout.EndHorizontal(); // Fill Method enum GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); spriteAndFillTransition.fillMethod = (UnityEngine.UI.Image.FillMethod)EditorGUILayout.EnumPopup("Image Fill Method", spriteAndFillTransition.fillMethod); GUILayout.EndHorizontal(); } // Transition Sprite GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); spriteAndFillTransition.finalSprite = (Sprite)EditorGUILayout.ObjectField("Sprite to Fill", spriteAndFillTransition.finalSprite, typeof(Sprite), true); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Sprite and Fill Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } else { ShowInvalidElementTypeForTransition("Image"); } } break; case UIGraphicEventState.EventTransitionType.TextFontSize: { // ----- Show Font Size in Custom Inspector ---- // if (_thisEventStateObject.textElement != null) { UIGraphicEventState.TextFontSizeTransition fontSizeTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { fontSizeTransition = (UIGraphicEventState.TextFontSizeTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (fontSizeTransition != null) { // Transition Font Size GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); fontSizeTransition.finalFontSize = EditorGUILayout.IntField("Font Size", fontSizeTransition.finalFontSize); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Font Size Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } else { ShowInvalidElementTypeForTransition("Text"); } } break; case UIGraphicEventState.EventTransitionType.TextWriteout: { // ----- Show Font Size in Custom Inspector ---- // if (_thisEventStateObject.textElement != null) { UIGraphicEventState.TextWriteoutTransition fontSizeTransition = null; if (eventState.eventTransitionCollection.ContainsKey(_thisEventStateObject.selectedEventTransitionInternal)) { fontSizeTransition = (UIGraphicEventState.TextWriteoutTransition)eventState.eventTransitionCollection[_thisEventStateObject.selectedEventTransitionInternal]; } if (fontSizeTransition != null) { // Writeout Text GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); fontSizeTransition.writeoutOverDuration = EditorGUILayout.Toggle("Writeout Text", fontSizeTransition.writeoutOverDuration); GUILayout.EndHorizontal(); // Text Label GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); EditorGUILayout.LabelField("Display Text:"); GUILayout.EndHorizontal(); // Display Text GUILayout.BeginHorizontal(); GUILayout.Space(InspectorUtility.columnSize); fontSizeTransition.finalString = EditorGUILayout.TextArea(fontSizeTransition.finalString, GUILayout.Height(100)); GUILayout.EndHorizontal(); } else { Debug.LogError("Error: The Font Size Transition property attached to the " + _thisEventStateObject.name + " GameObject is NULL! Ensure you aren't setting this null!"); } } else { ShowInvalidElementTypeForTransition("Text"); } } break; } EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); }