Пример #1
0
    public void AddMsg(PeTipMsg peTipMsg)
    {
        UITipMsg uiTipMsg = Instantiate(msgPrefab) as UITipMsg;

        uiTipMsg.transform.parent        = transform;
        uiTipMsg.transform.localScale    = Vector3.one;
        uiTipMsg.transform.localPosition = Vector3.zero;


        uiTipMsg.content.text  = peTipMsg.GetContent();
        uiTipMsg.content.color = peTipMsg.GetColor();
        uiTipMsg.musicID       = peTipMsg.GetMusicID();
        switch (peTipMsg.GetEStyle())
        {
        case PeTipMsg.EStyle.Text:
            uiTipMsg.tex.mainTexture = null;
            uiTipMsg.icon.spriteName = "";
            break;

        case PeTipMsg.EStyle.Icon:
            uiTipMsg.icon.spriteName = peTipMsg.GetIconName();
            uiTipMsg.tex.mainTexture = null;
            break;

        case PeTipMsg.EStyle.Texture:
            uiTipMsg.icon.spriteName = "";
            uiTipMsg.tex.mainTexture = peTipMsg.GetIconTex();
            break;
        }
        uiTipMsg.SetStyle(peTipMsg.GetEStyle());
        uiTipMsg.gameObject.SetActive(false);

        m_WaitList.Add(uiTipMsg);

        if (GameUI.Instance.mTipRecordsMgr != null)
        {
            GameUI.Instance.mTipRecordsMgr.AddMsg(peTipMsg);
        }
    }
Пример #2
0
    public void AddMsg(PeTipMsg peTipMsg)
    {
        GameObject go       = CreateGo();
        UITipMsg   uiTipMsg = go.GetComponent <UITipMsg>();

        uiTipMsg.content.text  = peTipMsg.GetContent();
        uiTipMsg.content.color = peTipMsg.GetColor();
        uiTipMsg.musicID       = peTipMsg.GetMusicID();
        switch (peTipMsg.GetEStyle())
        {
        case PeTipMsg.EStyle.Text:
            uiTipMsg.tex.mainTexture = null;
            uiTipMsg.icon.spriteName = "";
            break;

        case PeTipMsg.EStyle.Icon:
            uiTipMsg.icon.spriteName = peTipMsg.GetIconName();
            uiTipMsg.tex.mainTexture = null;
            break;

        case PeTipMsg.EStyle.Texture:
            uiTipMsg.icon.spriteName = "";
            uiTipMsg.tex.mainTexture = peTipMsg.GetIconTex();
            break;
        }
        uiTipMsg.SetStyle(peTipMsg.GetEStyle());
        uiTipMsg.gameObject.SetActive(true);

        m_WaitList.Add(go);
        CheckTipsCount();
        Reposition();
        if (m_WaitList.Count > 7 && mScrollBar != null)
        {
            mScrollBar.scrollValue = 1f;
        }
    }