/// <summary>
 /// Constructor for <see cref="ChatItemData"/> instance.
 /// </summary>
 /// <param name="messageData">Instance of <see cref="MessageData"/> of the message.</param>
 /// <param name="remover">Instance of <see cref="MessageRemover"/> for the <see cref="ChatMessage"/> initialization.</param>
 /// <param name="avatarLoader">Instance of <see cref="AvatarLoader"/> for the <see cref="ChatMessage"/> initialization.</param>
 /// <param name="playerId">Indicates the current player id.</param>
 public ChatItemData(MessageData messageData, MessageRemover remover, AvatarLoader avatarLoader, string playerId)
 {
     this.messageData  = messageData;
     this.remover      = remover;
     this.avatarLoader = avatarLoader;
     this.playerId     = playerId;
 }
示例#2
0
    /// <summary>
    /// Called on instantiation of the message item.
    /// </summary>
    /// <param name="data">Data for the message initialization.</param>
    public void Setup(ChatItemData data)
    {
        Data         = data.messageData;
        avatarLoader = data.avatarLoader;
        remover      = data.remover;

        messageText.text = Data.text;
        dateText.text    = Data.date;

        /// Subscribe only if this is a player message.
        if (Data.sender == data.playerId)
        {
            Subscribe();
        }

        ShowAnimation();

        OnSetup();
    }