Esempio n. 1
0
    public override UIStyleInfoInterface GetStyle(Component component)
    {
        Text            comp  = (Text)component;
        UITextStyleInfo style = (UITextStyleInfo)base.GetStyle(component);;

        style.font               = comp.font;
        style.fontStyle          = comp.fontStyle;
        style.fontSize           = comp.fontSize;
        style.lineSpacing        = comp.lineSpacing;
        style.alignment          = comp.alignment;
        style.horizontalOverflow = comp.horizontalOverflow;
        style.verticalOverflow   = comp.verticalOverflow;
        style.alignByGeometry    = comp.alignByGeometry;

        style.richText = comp.supportRichText;
        style.bestFit  = comp.resizeTextForBestFit;
        return(style);
    }
Esempio n. 2
0
    void TextStyleGUI(UITextStyleInfo style, UIStyleInfo info)
    {
        EditorGUI.indentLevel = 3;

        EditorGUILayout.BeginHorizontal();
        style.isFold = EditorGUILayout.Foldout(style.isFold, "Text:");

        if (GUILayout.Button("删除"))
        {
            info.m_TextInfo.isActive = false;
        }

        EditorGUILayout.EndHorizontal();

        if (style.isFold)
        {
            EditorGUI.indentLevel = 4;
            EditorGUILayout.LabelField("Character:");

            EditorGUI.indentLevel = 5;

            style.font        = (Font)EditorGUILayout.ObjectField("Font:", style.font, typeof(Font));
            style.fontStyle   = (FontStyle)EditorGUILayout.EnumPopup("FontStyle", style.fontStyle);
            style.fontSize    = EditorGUILayout.IntField("FontSize", style.fontSize);
            style.lineSpacing = EditorGUILayout.FloatField("LineSpacing", style.lineSpacing);
            style.richText    = EditorGUILayout.Toggle("RichText", style.richText);

            EditorGUI.indentLevel = 4;
            EditorGUILayout.LabelField("Paragraph:");

            EditorGUI.indentLevel    = 5;
            style.alignment          = (TextAnchor)EditorGUILayout.EnumPopup("FontStyle", style.alignment);
            style.alignByGeometry    = EditorGUILayout.Toggle("AlignByGeometry", style.alignByGeometry);
            style.horizontalOverflow = (HorizontalWrapMode)EditorGUILayout.EnumPopup("HorizontalOverflow", style.horizontalOverflow);
            style.verticalOverflow   = (VerticalWrapMode)EditorGUILayout.EnumPopup("VerticalOverflow", style.verticalOverflow);
            style.bestFit            = EditorGUILayout.Toggle("BestFit", style.bestFit);

            EditorGUI.indentLevel = 4;
            GraphicGUI(style);
        }
    }