Exemple #1
0
    private UITipsGrid GetTipsGrid()
    {
        UITipsGrid grid = null;

        if (null != m_lstCacheTips && m_lstCacheTips.Count > 0)
        {
            grid = m_lstCacheTips[0];
            m_lstCacheTips.Remove(grid);
        }
        else
        {
            GameObject cloneRes = UIManager.GetResGameObj(GridID.Uitipsgrid) as GameObject;
            if (null != cloneRes)
            {
                GameObject obj = NGUITools.AddChild(m_trans_TipsEffectRoot.gameObject, cloneRes);
                grid = obj.GetComponentInChildren <UITipsGrid>();
                if (null == grid)
                {
                    grid = obj.AddComponent <UITipsGrid>();
                }
                grid.SetAnimDlg(OnTipsFinish);
            }
        }
        if (null != grid)
        {
            grid.SetVisible(true);
            m_lstShowTips.Add(grid);
        }
        return(grid);
    }
Exemple #2
0
    /// <summary>
    /// 播放飘字
    /// </summary>
    /// <param name="txt"></param>
    private void PlayTipsDisplayEffect(string txt)
    {
        UITipsGrid tipsGrid = GetTipsGrid();

        if (null != tipsGrid)
        {
            tipsGrid.PlayTips(txt);
            RefreshTipsPos();
        }
    }
Exemple #3
0
    private void ReleaseTips(UITipsGrid tips)
    {
        if (null == tips)
        {
            return;
        }
        tips.Reset();
        tips.SetVisible(false);
        if (m_lstShowTips.Contains(tips))
        {
            m_lstShowTips.Remove(tips);
        }

        if (!m_lstCacheTips.Contains(tips))
        {
            m_lstCacheTips.Add(tips);
        }
    }
Exemple #4
0
    /// <summary>
    /// 刷新Tips位置
    /// </summary>
    private void RefreshTipsPos()
    {
        Vector3 startPos  = Vector3.zero;
        Vector3 targetPos = startPos;

        if (m_lstShowTips.Count > 0)
        {
            UITipsGrid tipsGrid = null;
            while (m_lstShowTips.Count > EffectDisplayManager.MaxTipAliveNum)
            {
                ReleaseTips(m_lstShowTips[0]);
            }
            for (int i = 0, max = m_lstShowTips.Count; i < max; i++)
            {
                targetPos.y = startPos.y + (max - 1 - i) * EffectDisplayManager.TipsUIGapY;
                m_lstShowTips[i].transform.localPosition = targetPos;
            }
        }
    }
Exemple #5
0
 private void OnTipsFinish(UITipsGrid tips)
 {
     ReleaseTips(tips);
 }