IEnumerator LateDestroy(GameObject gobj) { yield return(new WaitForSeconds(CommonDefineManager.Instance.CommonDefine.ItemMsgTimeDisappear)); if (gobj != null) { m_MessageItemList.Remove(gobj); BattleMessageItem item = gobj.GetComponent <BattleMessageItem>(); item.Disappear(); } }
private void ShowImmediately(string num, string name) { int listLength = m_MessageItemList.Count; if (listLength >= CommonDefineManager.Instance.CommonDefine.ItemMsgLimit) { BattleMessageItem gm = m_MessageItemList[listLength - 1].GetComponent <BattleMessageItem>(); gm.Disappear(); m_MessageItemList.RemoveAt(listLength - 1); } GameObject message = (GameObject)Instantiate(BattleMessageItemPrefab); message.transform.parent = PopupObjManager.Instance.UICamera.transform; message.transform.localScale = Vector3.one; message.transform.localPosition = m_MessageItemAppearPos; m_MessageItemList.Add(message); BattleMessageItem gmItem = message.GetComponent <BattleMessageItem>(); gmItem.Show(num, name); StartCoroutine(LateDestroy(message)); }