示例#1
0
    void OnClickBtn(NoticeBtn btn)
    {
        if (btn == null)
        {
            return;
        }
        m_preNoticeBtn = m_currNoticeBtn;
        if (m_preNoticeBtn != null)
        {
            m_preNoticeBtn.ToggleSelect(false);
        }

        m_currNoticeBtn = btn;
        m_currNoticeBtn.ToggleSelect(true);

        if (m_currNoticeBtn.Notice.index != m_index)
        {
            // m_UIXmlRichText.Clear();
            string strNotice = m_currNoticeBtn.Notice.content;
            if (m_noticeLable != null)
            {
                m_noticeLable.text = strNotice;
            }
            //m_UIXmlRichText.AddXml(RichXmlHelper.RichXmlAdapt(strNotice));
            m_label_NoticeName.text = m_currNoticeBtn.Notice.title;
        }
        m_scrollview_view.ResetPosition();
    }
示例#2
0
    void ShowContent()
    {
        m_index = 0;
        m_trans_ListRoot.parent.GetComponent <UIScrollView>().ResetPosition();
        m_trans_ListRoot.DestroyChildren();

        NoticeBtn first = null;

        for (int i = 0; i < m_lstNotice.Count; i++)
        {
            GameObject go  = NGUITools.AddChild(m_trans_ListRoot.gameObject, m_trans_ListContent.gameObject);
            NoticeBtn  btn = go.AddComponent <NoticeBtn>();
            go.SetActive(true);
            btn.Init(m_lstNotice[i], OnClickBtn);
            go.transform.localPosition = new UnityEngine.Vector3(0, -i * 85, 0);

            if (i == 0)
            {
                first = btn;
            }
        }
        if (first != null)
        {
            OnClickBtn(first);
        }
    }