Exemplo n.º 1
0
        private ChatItemData GetChatItemDataByBaseNode(BaseNode node)
        {
            ChatItemData itemData = new ChatItemData();

            itemData.m_chatItemID = node.Id;
            for (int i = 0; i < node.Lets.Count; i++)
            {
                if (node.Lets[i].Type == LetTypes.OUTLET)
                {
                    for (int j = 0; j < node.Lets[i].Connections.Count; j++)
                    {
                        Connection con = node.Lets[i].Connections[j];
                        itemData.m_nextChatItemID.Add(con.Inlet.Owner.Id);
                    }
                }
            }
            //itemData.m_nextChatItemID
            if (node is ButtonNode)
            {
                ButtonNode btnNode = node as ButtonNode;
                itemData.m_chatHead     = btnNode.headValue;
                itemData.m_chatContent  = btnNode.contentValue;
                itemData.m_chatPosition = (int)btnNode.m_headPosition;
                itemData.m_chatType     = (int)btnNode.m_nodeType;
                if (btnNode.imgValue_00 != null)
                {
                    itemData.m_chatKeyImages.Add(btnNode.imgValue_00.name + ".png");
                }
                if (btnNode.imgValue_01 != null)
                {
                    itemData.m_chatKeyImages.Add(btnNode.imgValue_01.name + ".png");
                }
                if (btnNode.imgValue_02 != null)
                {
                    itemData.m_chatKeyImages.Add(btnNode.imgValue_02.name + ".png");
                }
                if (btnNode.imgValue_03 != null)
                {
                    itemData.m_chatKeyImages.Add(btnNode.imgValue_03.name + ".png");
                }
            }
            else if (node is ChatOptionContentNode)
            {
                ChatOptionContentNode contentNode = (ChatOptionContentNode)node;
                itemData.m_chatContent = contentNode.contentValue;
            }
            else if (node is ChatOptionNode)
            {
                ChatOptionNode optionNode = (ChatOptionNode)node;
                itemData.m_chatContent = optionNode.tex.name + ".png";
            }
            return(itemData);
        }
Exemplo n.º 2
0
        private ChatData GetChatDataByNodes(List <BaseNode> nodes, string BG, int chatID)
        {
            ChatData chatData = new ChatData();

            chatData.m_chatBG = BG;
            chatData.m_chatID = chatID;
            for (int i = 0; i < nodes.Count; i++)
            {
                ChatItemData itemData = GetChatItemDataByBaseNode(nodes[i]);
                chatData.m_chat.Add(itemData);
            }
            return(chatData);
        }
Exemplo n.º 3
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();
    }