private void ShowMsg(FloatMsg msgVo, bool check = true) { if (check) { if (!CheckIsShowAble()) { m_MsgList.Push(msgVo); return; } } GameObject obj = m_GameObjectPool.Allocate(); if (obj) { FloatMessageItem item = obj.GetComponent <FloatMessageItem>(); item.SetFloatMsg(msgVo); obj.transform.SetParent(m_Root, true); obj.transform.localPosition = m_StartPos; Tweener tweener = obj.transform.DOLocalMove(m_EndPos, m_AnimTime); tweener.SetEase(Ease.Linear); tweener.OnComplete <Tweener>(() => { m_GameObjectPool.Recycle(obj); }); m_LastSendTime = Time.realtimeSinceStartup; } }
private void ShowMsg(FloatMsg msgVo, bool check = true) { if (!m_IsInit) { InitFloatMessage(); } if (check) { if (!CheckIsShowAble()) { m_MsgList.Push(msgVo); return; } } GameObject obj = m_GameObjectPool.Allocate(); if (obj) { obj.SetActive(true); ++m_AnimItemCount; FloatMessageItem item = obj.GetComponent <FloatMessageItem>(); item.SetFloatMsg(msgVo); obj.transform.SetParent(m_Root, true); obj.transform.localPosition = m_StartPos; var text = obj.GetComponent <Text>(); text.color = m_InitColor; text.DOColor(new Color(m_InitColor.r, m_InitColor.g, m_InitColor.b, 0f), m_AnimTime) .SetDelay(m_AnimTime) .OnComplete(() => { m_GameObjectPool.Recycle(obj); --m_AnimItemCount; }); obj.transform.DOLocalMove(m_EndPos, m_AnimTime).SetEase(Ease.Linear); m_LastSendTime = Time.realtimeSinceStartup; } }