public void SetFloatMsg(FloatMsg msg) { if (msg == null) { return; } m_Text.text = msg.message; }
public void PlayFloatMessage(string msg, Vector3 from, Vector3 to) { if (UIMgr.isApplicationQuit) { return; } FloatMsg fm = new FloatMsg(); fm.message = msg; ShowMsg(fm); }
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.GetComponentInChildren <FloatMessageItem>(); item.SetFloatMsg(msgVo); obj.transform.SetParent(m_Root, true); obj.transform.localPosition = m_StartPos; var image = obj.GetComponent <Image>(); var text = obj.GetComponentInChildren <Text>(); text.color = m_InitColor; image.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; }); image.DOColor(new Color(m_InitColor.r, m_InitColor.g, m_InitColor.b, 0f), m_AnimTime) ; // .SetDelay(m_AnimTime); obj.transform.DOLocalMove(m_EndPos, m_AnimTime).SetEase(Ease.Linear); m_LastSendTime = Time.realtimeSinceStartup; } }