namespace UIWidgets { using UnityEngine; using UnityEngine.UI; /// /// TextUnity. /// public class TextUnity : ITextProxy { /// /// Text component. /// protected Text Component; /// /// GameObject. /// public GameObject GameObject { get { return Component.gameObject; } } /// /// Text. /// public string text { get { return Component.text; } set { Component.text = value; } } /// /// Graphic component. /// public Graphic Graphic { get { return Component; } } /// /// Color. /// public Color color { get { return Component.color; } set { Component.color = value; } } /// /// Font size. /// public float fontSize { get { return Component.fontSize; } set { Component.fontSize = Mathf.RoundToInt(value); } } /// /// Font style. /// public FontStyle fontStyle { get { return Component.fontStyle; } set { Component.fontStyle = value; } } /// /// Bold. /// public bool Bold { get { return (Component.fontStyle == FontStyle.Bold) || (Component.fontStyle == FontStyle.BoldAndItalic); } set { if (Bold == value) { return; } if (value) { Component.fontStyle = (Component.fontStyle == FontStyle.Normal) ? FontStyle.Bold : FontStyle.BoldAndItalic; } else { Component.fontStyle = (Component.fontStyle == FontStyle.Bold) ? FontStyle.Normal : FontStyle.Italic; } } } /// /// Italic. /// public bool Italic { get { return (Component.fontStyle == FontStyle.Italic) || (Component.fontStyle == FontStyle.BoldAndItalic); } set { if (Italic == value) { return; } if (value) { Component.fontStyle = (Component.fontStyle == FontStyle.Normal) ? FontStyle.Italic : FontStyle.BoldAndItalic; } else { Component.fontStyle = (Component.fontStyle == FontStyle.Italic) ? FontStyle.Normal : FontStyle.Bold; } } } /// /// Initializes a new instance of the class. /// /// Component. public TextUnity(Text component) { Component = component; } } }