private new void Awake() { _ownerPool = scrollViewContent.gameObject.AddComponent <MessageViewsPool>(); _ownerPool.Create(ownerMessagePrefab, 50); _usualPool = scrollViewContent.gameObject.AddComponent <MessageViewsPool>(); _usualPool.Create(usualMessagePrefab, 50); base.Awake(); }
private void AddMessage <T>(T messageData, MessageViewsPool pool) where T : ChatMessage { var messageView = pool.GetChatView(); messageView.FillWithInfo(messageData); messageView.onRemoveButtonClickEvent.AddListener(() => { DeleteMessageCall.Invoke(messageData.Id); }); messageView.ShowWithAnimation(); MessageViews.Add(messageView); CheckMessagesBlock(MessageViews.IndexOf(messageView)); messageView.transform.SetAsLastSibling(); }
public void LinkToPool(MessageViewsPool pool) { Pool = pool; }