Beispiel #1
0
        public static void Paragraph(string text, bool lead)
        {
            var style = lead?FlatFonts.LatoLightStyle(16, false) : FlatFonts.LatoStyle(14, false);

            style.wordWrap = true;

            var content   = new GUIContent(text);
            var titleRect = GUILayoutUtility.GetRect(content, style);

            titleRect.height += EditorGUIUtility.singleLineHeight;
            GUI.Label(titleRect, TypographyUtilities.ColoredText(FlatEditor.TextColor, text), style);
        }
Beispiel #2
0
        public static void Blockquote(Color blockColor, string quote, string source, bool reverse)
        {
            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            var offset = 20;

            var style = new GUIStyle(FlatFonts.LatoStyle(16, false));

            style.alignment = reverse ? TextAnchor.MiddleRight : TextAnchor.MiddleLeft;

            var quoteContent = new GUIContent(quote);
            var quoteRect    = GUILayoutUtility.GetRect(quoteContent, style);

            if (!reverse)
            {
                quoteRect.x += offset;
            }

            quoteRect.width -= offset;

            GUI.Label(quoteRect, TypographyUtilities.ColoredText(FlatEditor.TextColor, quote), style);

            //BUG: Unity editor suddenly not rendering em-dash
//            source = reverse ? source + " ¡ª " : " ¡ª " + source;

            var sourceContent = new GUIContent(source);
            var sourceRect    = GUILayoutUtility.GetRect(sourceContent, style);

            if (!reverse)
            {
                sourceRect.x += offset;
            }

            sourceRect.width -= offset;

            var lightened = new Color32(125, 125, 125, 255);

            GUI.Label(sourceRect, TypographyUtilities.ColoredText(lightened, source), style);
            GUILayout.Space(EditorGUIUtility.singleLineHeight);

            var drawRect = reverse
                ? new Rect(quoteRect.xMax + 15, quoteRect.y, 5, quoteRect.height + sourceRect.height)
                : new Rect(10, quoteRect.y, 5, quoteRect.height + sourceRect.height);

            GUI.color = blockColor;
            GUI.DrawTexture(drawRect, Drawing.Pixel, ScaleMode.StretchToFill);
            Colors.ResetUIColor();
        }