Exemple #1
0
    void _addMsgDirDown(OptionUIHintItem ui_msg)
    {
        ui_msg.gameObject.SetActive(true);

        Bounds bound = ui_msg.GetBounds();

        if (m_MsgList.Count == 0)
        {
            ui_msg.transform.localPosition = new Vector3(0, bound.size.y, 0);
        }
        else
        {
            OptionUIHintItem prev_ui = m_MsgList[0];
            //			Bounds prv_bound = prev_ui.GetBounds();
            ui_msg.transform.localPosition = new Vector3(0, prev_ui.transform.localPosition.y + bound.size.y + yPadding, 0);
        }

        m_MotionOffset = -bound.size.y - yPadding;
        m_MsgList.Insert(0, ui_msg);
        m_DefaultHeight.Insert(0, ui_msg.transform.localPosition.y);

        m_CurDura = 0;
        if (onAddShowingMsg != null)
        {
            onAddShowingMsg();
        }
    }
Exemple #2
0
    public void AddOneHint(string _content)
    {
        OptionUIHintItem go = GoCreat();

        go.SetHintInfo(_content);
        m_WaitList.Add(go);
    }
Exemple #3
0
    OptionUIHintItem GoCreat()
    {
        OptionUIHintItem item = Instantiate(mPrefab) as OptionUIHintItem;

        item.transform.parent        = mParent;
        item.transform.localPosition = Vector3.zero;
        item.transform.localRotation = Quaternion.identity;
        item.transform.localScale    = Vector3.one;
        item.gameObject.SetActive(false);
        return(item);
    }
Exemple #4
0
    void Update()
    {
        if (duration + 0.1f > m_CurDura)
        {
            m_CurDura += Time.deltaTime;
            float adder = EvaluateOffset(Mathf.Clamp(m_CurDura / duration, 0, 1));

            for (int i = 0; i < m_MsgList.Count; i++)
            {
                Vector3 pos = m_MsgList[i].transform.localPosition;
                m_MsgList[i].transform.localPosition = new Vector3(pos.x, Mathf.Round(m_DefaultHeight[i] + adder), pos.z);
            }

            m_PlayEnd = true;
        }
        else
        {
            for (int i = m_MsgList.Count - 1; i >= 0; i--)
            {
                m_DefaultHeight[i] = m_MsgList[i].transform.localPosition.y;
            }

            if (m_PlayEnd && m_WaitList.Count == 0)
            {
                m_PlayEnd = false;
            }

            while (m_WaitList.Count != 0)
            {
                OptionUIHintItem ui_msg = m_WaitList[0];
                m_WaitList.RemoveAt(0);
                _addMsgDirDown(ui_msg);
                break;
            }

            if (m_MsgList.Count > 5)
            {
                Destroy(m_MsgList[m_MsgList.Count - 1].gameObject);
                m_MsgList.RemoveAt(m_MsgList.Count - 1);
                m_DefaultHeight.RemoveAt(m_MsgList.Count - 1);
            }
        }
    }