private void OnReceiveChat(ChatMessage chatMessage) { ChatMessages.Add(chatMessage); if (ChatMessages.Count > chatEntrySize) { ChatMessages.RemoveAt(0); } CacheList.Generate(ChatMessages, (index, message, ui) => { UIChatMessage uiChatMessage = ui.GetComponent <UIChatMessage>(); uiChatMessage.uiChatHandler = this; uiChatMessage.Data = message; uiChatMessage.Show(); }); StartCoroutine(VerticalScroll(0f)); }
private void Start() { CacheList.Generate(ChatMessages, (index, message, ui) => { UIChatMessage uiChatMessage = ui.GetComponent <UIChatMessage>(); uiChatMessage.uiChatHandler = this; uiChatMessage.Data = message; uiChatMessage.Show(); }); StartCoroutine(VerticalScroll(0f)); HideEnterChatField(); if (uiEnterChatField != null) { uiEnterChatField.onValueChanged.RemoveListener(OnInputFieldValueChange); uiEnterChatField.onValueChanged.AddListener(OnInputFieldValueChange); } }