private MainMenuChatItem Use() { if (mPool.Count > 0) { MainMenuChatItem item = mPool[mPool.Count - 1]; mPool.RemoveAt(mPool.Count - 1); item.mDMono.gameObject.SetActive(true); mActive.Enqueue(item); item.mDMono.transform.parent = previewTable.transform; item.mDMono.transform.localPosition = Vector3.zero; item.mDMono.transform.localScale = Vector3.one; item.mDMono.transform.localEulerAngles = Vector3.zero; item.mDMono.transform.SetAsFirstSibling(); return(item); } else { MainMenuChatItem item = Object.Instantiate(mActive[mActive.Count - 1].mDMono.transform).GetMonoILRComponent <MainMenuChatItem>(); mActive.Enqueue(item); item.mDMono.transform.parent = previewTable.transform; item.mDMono.transform.localPosition = Vector3.zero; item.mDMono.transform.localScale = Vector3.one; item.mDMono.transform.localEulerAngles = Vector3.zero; item.mDMono.transform.SetAsFirstSibling(); item.SetSysItemData(null); return(item); } }
private void AddMessage(EB.Sparx.ChatMessage msg) { MainMenuChatItem item = Use(); ChatUIMessage uimsg = new ChatUIMessage(msg); var channel = ChatRule.STR2CHANNEL[msg.channelType]; uimsg.Channel = channel; uimsg.ChannelSpriteName = ChatRule.CHANNEL2ICON.ContainsKey(channel) ? ChatRule.CHANNEL2ICON[channel] : ""; item.SetSysItemData(uimsg); }