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;
 }
Example #2
0
 /// <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);
 }
Example #3
0
    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());
    }
Example #4
0
    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);
    }