private bool DrawWarningMessage(ref Rect rect, Dictionary <int, int> frequencyInLanguageAppearance) { // Adjust the bools LastMessage = GetWarning(frequencyInLanguageAppearance); ShowHelpBox.target = (string.IsNullOrEmpty(LastMessage) == false); bool isShown = ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)); if (isShown == true) { // Calculate range of warning float helpBoxHeight = EditorUiUtility.GetHelpBoxHeight(LastMessage, rect.width); rect.height = helpBoxHeight * ShowHelpBox.faded; // Show warning GUI.BeginGroup(rect); Rect helpBox = new Rect(0, 0, rect.width, helpBoxHeight); EditorGUI.HelpBox(helpBox, LastMessage, MessageType.Warning); GUI.EndGroup(); // Adjust the rectangle rect.y += rect.height; } return(isShown); }
public float CalculateHeight(Dictionary <int, int> frequencyInLanguageAppearance) { // Calculate the key height float height = VerticalMargin; height += EditorGUIUtility.singleLineHeight; height += VerticalSpace; // Check if we're showing a warning if ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)) { // If so, calculate the height of this warning height += EditorUiUtility.GetHelpBoxHeight(LastMessage, Width) * ShowHelpBox.faded; height += VerticalSpace; } // Add one for the fold-out height += EditorGUIUtility.singleLineHeight; // If so, calculate the height of translations bool isExpandable; height += GetTextAreaHeight(TextProperty.stringValue, Width, ExpandToggle.faded, out isExpandable); //height += VerticalMargin; height += VerticalMargin; return(height); }
public float CalculateHeight(Dictionary <string, int> frequencyInKeyAppearance) { // Calculate the key height float height = VerticalMargin; height += EditorGUIUtility.singleLineHeight; height += VerticalSpace; // Check if we're showing a warning if ((ShowHelpBox.target == true) || (ShowHelpBox.isAnimating == true)) { // If so, calculate the height of this warning height += EditorUiUtility.GetHelpBoxHeight(LastMessage, Width) * ShowHelpBox.faded; height += VerticalSpace; } // Add one for the fold-out height += EditorGUIUtility.singleLineHeight; // Check if we're showing the translations if ((ShowAllTranslationsList.target == true) || (ShowAllTranslationsList.isAnimating == true)) { // If so, calculate the height of translations height += (translationsList.GetHeight() + VerticalMargin) * ShowAllTranslationsList.faded; } height += VerticalMargin; return(height); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { float height = EditorGUIUtility.singleLineHeight; if (property.isExpanded == true) { // Grab every field SerializedProperty key = property.FindPropertyRelative("key"); SerializedProperty dictionary = property.FindPropertyRelative("dictionary"); // Allocate key field height += EditorUiUtility.GetHeight(2); // Update status TranslationDictionary translationDictionary = dictionary.objectReferenceValue as TranslationDictionary; string translationKey = key.stringValue; Status status = UpdateMessageStatus(translationDictionary, translationKey); // Check status if (string.IsNullOrEmpty(Message) == false) { // Allocate help box height += EditorUiUtility.VerticalMargin; height += EditorUiUtility.GetHelpBoxHeight(Message, Width); } // Check button if (IsButtonDrawn(status) == true) { // Allocate button height += EditorUiUtility.VerticalMargin; height += ButtonHeight; } // Check preview if (IsTextPreviewDrawn(status) == true) { // Allocate preview height += EditorUiUtility.VerticalSpace; height += EditorGUIUtility.singleLineHeight; height += TextPreview.CalculateHeight(null, !translationDictionary.IsAllTranslationsSerialized); } } return(height); }
private Rect DrawHelpBox(Rect rect) { // Check whether to show the help box if (string.IsNullOrEmpty(Message) == false) { // Add indentation rect.x += IndentLeft; rect.width -= IndentLeft; // Draw a header message rect.y += EditorUiUtility.VerticalMargin + rect.height; rect.height = EditorUiUtility.GetHelpBoxHeight(Message, rect.width); EditorGUI.HelpBox(rect, Message, MessageType); // Remove indentation rect.x -= IndentLeft; rect.width += IndentLeft; } return(rect); }