Ejemplo n.º 1
0
 public void SetContentColor(Color color)
 {
     if (m_Text != null)
     {
         m_Text.SetColor(color);
     }
 }
Ejemplo n.º 2
0
 public void SetLabelColor(Color color)
 {
     if (m_LabelText != null)
     {
         m_LabelText.SetColor(color);
     }
 }
Ejemplo n.º 3
0
        public static GameObject Get(string name, Transform parent, SerieLabel label, Color color,
                                     float iconWidth, float iconHeight, ChartTheme theme)
        {
            GameObject element;

            if (m_Stack.Count == 0 || !Application.isPlaying)
            {
                element = CreateSerieLabel(name, parent, label, color, iconWidth, iconHeight, theme);
            }
            else
            {
                element = m_Stack.Pop();
                if (element == null)
                {
                    element = CreateSerieLabel(name, parent, label, color, iconWidth, iconHeight, theme);
                }
                m_ReleaseDic.Remove(element.GetInstanceID());
                element.name = name;
                element.transform.SetParent(parent);
                element.transform.localEulerAngles = new Vector3(0, 0, label.textStyle.rotate);
                var text = new ChartText(element);
                text.SetColor(color);
                text.SetFontAndSizeAndStyle(label.textStyle, theme.common);
                ChartHelper.SetActive(element, true);
            }
            return(element);
        }
Ejemplo n.º 4
0
 public static void ResetLabel(ChartText labelObject, SerieLabel label, ChartTheme theme, int colorIndex)
 {
     if (labelObject == null)
     {
         return;
     }
     labelObject.SetColor(!ChartHelper.IsClearColor(label.textStyle.color) ? label.textStyle.color :
                          (Color)theme.GetColor(colorIndex));
     labelObject.SetFontSize(label.textStyle.GetFontSize(theme.common));
     labelObject.SetFontStyle(label.textStyle.fontStyle);
 }
Ejemplo n.º 5
0
        public static ChartText AddTextObject(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax,
                                              Vector2 pivot, Vector2 sizeDelta, TextStyle textStyle, ComponentTheme theme)
        {
            GameObject txtObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);

            txtObj.transform.localEulerAngles = new Vector3(0, 0, textStyle.rotate);
            var chartText = new ChartText();

#if dUI_TextMeshPro
            RemoveComponent <Text>(txtObj);
            chartText.tmpText                    = GetOrAddComponent <TextMeshProUGUI>(txtObj);
            chartText.tmpText.font               = textStyle.tmpFont == null ? theme.tmpFont : textStyle.tmpFont;
            chartText.tmpText.fontStyle          = textStyle.tmpFontStyle;
            chartText.tmpText.alignment          = textStyle.tmpAlignment;
            chartText.tmpText.richText           = true;
            chartText.tmpText.raycastTarget      = false;
            chartText.tmpText.enableWordWrapping = false;
#else
            chartText.text                    = GetOrAddComponent <Text>(txtObj);
            chartText.text.font               = textStyle.font == null ? theme.font : textStyle.font;
            chartText.text.fontStyle          = textStyle.fontStyle;
            chartText.text.alignment          = textStyle.alignment;
            chartText.text.horizontalOverflow = HorizontalWrapMode.Overflow;
            chartText.text.verticalOverflow   = VerticalWrapMode.Overflow;
            chartText.text.supportRichText    = true;
            chartText.text.raycastTarget      = false;
#endif
            chartText.SetColor(textStyle.GetColor(theme.textColor));
            chartText.SetFontSize(textStyle.fontSize > 0 ? textStyle.fontSize : theme.fontSize);
            chartText.SetText("Text");
            chartText.SetLineSpacing(textStyle.lineSpacing);

            RectTransform rect = GetOrAddComponent <RectTransform>(txtObj);
            rect.localPosition = Vector3.zero;
            rect.sizeDelta     = sizeDelta;
            rect.anchorMin     = anchorMin;
            rect.anchorMax     = anchorMax;
            rect.pivot         = pivot;
            return(chartText);
        }
Ejemplo n.º 6
0
 internal void SetTooltipLabelColor(Color bgColor, Color textColor)
 {
     m_TooltipLabel.GetComponent <Image>().color = bgColor;
     m_TooltipLabelText.SetColor(textColor);
 }