Esempio n. 1
0
    public void Underline(float button_width, int button_height, bool showItemColor = true)
    {
        if (this.m_myRectTransform == null)
        {
            return;
        }
        this.m_myRectTransform.set_sizeDelta(new Vector2(button_width, (float)button_height));
        string text           = string.Empty;
        float  num            = this.m_myRectTransform.get_sizeDelta().x;
        int    fontSize       = button_height - 4;
        float  preferredWidth = ChatManager.Instance.GetPreferredWidth("_", fontSize, false);

        if (preferredWidth <= 0f)
        {
            return;
        }
        while (num > 0f)
        {
            text += "_";
            num  -= preferredWidth;
        }
        string color = "301414";

        if (this.m_detailInfo != null)
        {
            if (this.m_detailInfo.type == DetailType.DT.Interface)
            {
                color = "28c800";
            }
            else if (this.m_detailInfo.type == DetailType.DT.Equipment && showItemColor)
            {
                Items items = DataReader <Items> .Get(this.m_detailInfo.cfgId);

                if (items != null)
                {
                    color = TextColorMgr.RGB.GetRGB(items.color);
                }
            }
        }
        this.m_underline_shadow.set_effectColor(XUtility.ReturnColorFromString(color, 128));
        this.m_underline.set_text(TextColorMgr.GetColor(text, color, string.Empty));
        this.m_underline.set_fontSize(fontSize);
    }