Exemplo n.º 1
0
    /*Chat*/
    public void SendMessagetoChat(String text, Message.MessageType messageType)
    {
        if (messageList.Count >= maxMessages)
        {
            Destroy(messageList[0].textObject.gameObject);
            messageList.Remove(messageList[0]);
        }
        Message newMessage = new Message();

        newMessage.text = text;

        GameObject newText = Instantiate(textObject, chatPanel.transform);

        newMessage.textObject       = newText.GetComponent <Text>();
        newMessage.textObject.text  = newMessage.text;
        newMessage.textObject.color = MessageTypeColor(messageType);
        messageList.Add(newMessage);
        RequestChat requestChat = new RequestChat();

        // Check first player added to the list because this is the real client.
        player = players[0];
        int readyPlayer = int.Parse(player.tag);

        if (player.tag == "1")
        {
            requestChat.send(1, newMessage.text);
        }
        else if (player.tag == "2")
        {
            requestChat.send(2, newMessage.text);
        }

        cManager.send(requestChat);
        //cManager.send(ChatProtocol.Prepare(1, newMessage.text));
    }
Exemplo n.º 2
0
    public RequestChat RequestChat(short type, string message)
    {
        RequestChat request = new RequestChat();
        request.Send(type, message);

        return request;
    }
Exemplo n.º 3
0
    public RequestChat RequestChat(short type, string message)
    {
        RequestChat request = new RequestChat();

        request.Send(type, message);

        return(request);
    }
Exemplo n.º 4
0
    public void SendMessagetoChat(String text, Message.MessageType messageType)
    {
        if (messageList.Count >= maxMessages)
        {
            Destroy(messageList[0].textObject.gameObject);
            messageList.Remove(messageList[0]);
        }
        Message newMessage = new Message();

        newMessage.text = text;

        GameObject newText = Instantiate(textObject, chatPanel.transform);

        newMessage.textObject       = newText.GetComponent <Text>();
        newMessage.textObject.text  = newMessage.text;
        newMessage.textObject.color = MessageTypeColor(messageType);
        messageList.Add(newMessage);
        RequestChat requestChat = new RequestChat();

        requestChat.send(1, newMessage.text);
        cManager.send(requestChat);
        //cManager.send(ChatProtocol.Prepare(1, newMessage.text));
    }