Exemplo n.º 1
0
    private void CrateText(float posX, string txt)
    {
        if (string.IsNullOrEmpty(txt))
        {
            return;
        }
        UIRichTextComInfo com = new UIRichTextComInfo();

        com.type = eUIRichRTextComType.Text;
        com.pos  = new Vector2(posX, 0);
        com.text = txt;
        m_comList.Add(com);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 颜色和超链接
    /// </summary>
    private void CreateCom(float posX, string info, string text)
    {
        if (string.IsNullOrEmpty(text))
        {
            return;
        }
        UIRichTextComInfo com = new UIRichTextComInfo();

        com.type = eUIRichRTextComType.Link;
        com.pos  = new Vector2(posX, 0);
        com.text = text;
        com.info = info;
        m_comList.Add(com);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 创建图片,一般情况,图片会改变当前行的高度,所以需通过imageid返回图片的高度
    /// </summary>
    private void CreateImage(float posX, string imageId)
    {
        UIRichTextComInfo com = new UIRichTextComInfo();

        com.type = eUIRichRTextComType.Image;
        com.pos  = new Vector2(posX, 0);
        com.info = imageId;
        m_comList.Add(com);

        int curHeight = UIRichTextMgrNew.s_imageList[imageId].y;

        if (curHeight > m_curLineHight + m_heighOffset)
        {
            m_curLineHight = curHeight;
        }
    }
Exemplo n.º 4
0
 private void CreateLineCom(int curLineHight, UIRichTextComInfo comInfo)
 {
     if (comInfo.type == eUIRichRTextComType.Text)
     {
         float lastHight = curLineHight - (comInfo.pos.y - m_textHight); // 如果是文本,当前的高度-(图片与文本的差)
         CrateText(new Vector2(comInfo.pos.x, lastHight), comInfo.text);
     }
     if (comInfo.type == eUIRichRTextComType.Link)
     {
         float lastHight = curLineHight - (comInfo.pos.y - m_textHight);
         CreateLink(new Vector2(comInfo.pos.x, lastHight), comInfo.info, comInfo.text);
     }
     if (comInfo.type == eUIRichRTextComType.Image)
     {
         float lastHight = curLineHight;
         CreateImage(new Vector2(comInfo.pos.x, lastHight), comInfo.info);
     }
 }