Exemple #1
0
 private static void applySettings(ref Text text, TUILabelSettings settings)
 {
     text.alignment          = settings.Alignment;
     text.fontSize           = settings.FontSize;
     text.font               = settings.Font;
     text.fontStyle          = settings.FontStyle;
     text.horizontalOverflow = settings.HorizontalWrapping;
     text.lineSpacing        = settings.LineSpacing;
     text.verticalOverflow   = settings.VerticalWrapping;
     text.color              = settings.TextColor;
 }
Exemple #2
0
        // TODO: auto set size

        public static TUILabel Create(string text, TUILabelSettings settings = null, LayoutElementData element = null)
        {
            TUILabel label = createBaseWidget <TUILabel>(element);

            Text uiText = label.gameObject.AddComponent <Text>();

            label.Graphic = uiText;
            uiText.text   = text;

            applySettings(ref uiText, settings ?? new TUILabelSettings());

            return(label);
        }