Esempio n. 1
0
    IEnumerator GetNewMessage()
    {
        //서버로부터 메세지 받아오기
        while (true)
        {
            HTTPNetworkManager.Instance.LoadChat((response) =>
            {
                if (response.Message == "")
                {
                    return;
                }

                HTTPResponseChat chat = response.GetDataFromMessage <HTTPResponseChat>();
                foreach (HTTPResponseChat.Chat message in chat.objects)
                {
                    if (lastSeq != 0)
                    {
                        ChatCell chatCell        = Instantiate(chatCellPrefab, content).GetComponent <ChatCell>();
                        chatCell.CachedText.text = string.Format("[{0}] {1}", message.name, message.message);
                        chatCell.transform.SetAsLastSibling();
                    }
                    lastSeq = int.Parse(message._id);
                }
                scrollRect.verticalNormalizedPosition = 0;
            }, () =>
            {
            }, lastSeq);
            yield return(new WaitForSeconds(1));
        }
    }
Esempio n. 2
0
 override public void UpdatePanel()
 {
     base.UpdatePanel();
     // Clear Content
     RemoveAllChildren(chatContent);
     // Create Chat Cells
     foreach (string msg in ChatParam.listMSG)
     {
         GameObject cell     = Instantiate(chatCellPrefab, chatContent.transform);
         ChatCell   chatCell = new ChatCell();
         chatCell.msg = msg;
         cell.GetComponent <PanelChatCell>().SetParam(chatCell, this);
     }
 }
Esempio n. 3
0
 // Public
 public void SetParam(ChatCell chatCell, BasePanel rootPanel)
 {
     base.SetParam(chatCell, rootPanel);
     textMsg.text = chatCell.msg;
 }