public override void SetChatEntryView(ChatEntryData data, ChatScroll chatScroll, int index, float contentViewWidth) { base.SetChatEntryView(data, chatScroll, index, contentViewWidth); playerAlertData = (PlayerAlertData)data; gibButton.interactable = !playerAlertData.gibbed; takenCareOfButton.interactable = !playerAlertData.takenCareOf; }
/// <summary> /// This adds a new chat entry and displays it at the bottom of the scroll feed /// </summary> public void AddNewChatEntry(ChatEntryData chatEntry) { if (displayPool.Count != 0 && displayPool[0].Index != chatLog.Count - 1) { chatLog.Add(chatEntry); return; } chatLog.Add(chatEntry); TryShowView(chatEntry, true, chatLog.Count - 1); }
public virtual void SetChatEntryView(ChatEntryData data, ChatScroll chatScroll, int index, float contentViewWidth) { var thisDelta = thisRectTransform.sizeDelta; thisDelta.x = contentViewWidth; thisRectTransform.sizeDelta = thisDelta; var textDelta = textRectTransform.sizeDelta; textDelta.x = contentViewWidth / textRectTransform.localScale.x; textRectTransform.sizeDelta = textDelta; Index = index; this.chatScroll = chatScroll; visibleText.text = data.Message; entryData = data; gameObject.SetActive(true); StartCoroutine(UpdateMinHeight()); }
protected void TryShowView(ChatEntryData data, bool forBottom, int proposedIndex, ScrollButtonDirection scrollDir = ScrollButtonDirection.None) { var entry = GetViewFromPool(); if (forBottom) { entry.transform.SetAsLastSibling(); displayPool.Insert(0, entry); } else { entry.transform.SetAsFirstSibling(); displayPool.Add(entry); } if (!gameObject.activeInHierarchy) { return; } entry.SetChatEntryView(data, this, proposedIndex, contentWidth); DetermineTrim(scrollDir); }