private void OnServerChatMessage(NetworkMessage netMsg) { var msg = netMsg.ReadMessage <MessageTypes.ChatMessage>(); //Debug.Log("New chat message on server: " + msg.message); MessageTypes.ChatMessage chat = new MessageTypes.ChatMessage(); chat.message = _playerConnections[netMsg.conn.connectionId].Name + ": " + msg.message; NetworkServer.SendToAll((short)MessageTypes.MessageType.CHAT_MESSAGE, chat); }
public void DoSendMessage() { //Debug.Log("DoSendMessage"); var chatInputField = GameObject.Find("ChatInputField"); var t = (InputField)chatInputField.GetComponent(typeof(InputField)); t.Select(); t.ActivateInputField(); if (!string.IsNullOrEmpty(t.text)) { MessageTypes.ChatMessage msg = new MessageTypes.ChatMessage(); msg.message = t.text; NetworkManager.singleton.client.Send((short)MessageTypes.MessageType.CHAT_MESSAGE, msg); t.text = String.Empty; } }
public void DoSendMessage() { //Debug.Log("DoSendMessage"); var chatInputField = GameObject.Find("ChatInputField"); var t = (InputField)chatInputField.GetComponent(typeof(InputField)); t.Select(); t.ActivateInputField(); if (!string.IsNullOrEmpty(t.text)) { MessageTypes.ChatMessage msg = new MessageTypes.ChatMessage(); msg.message = t.text; NetworkManager.singleton.client.Send((short)MessageTypes.MessageType.CHAT_MESSAGE, msg); t.text = String.Empty; } }
private void OnServerChatMessage(NetworkMessage netMsg) { var msg = netMsg.ReadMessage<MessageTypes.ChatMessage>(); //Debug.Log("New chat message on server: " + msg.message); MessageTypes.ChatMessage chat = new MessageTypes.ChatMessage(); chat.message = _playerConnections[netMsg.conn.connectionId].Name + ": " + msg.message; NetworkServer.SendToAll((short)MessageTypes.MessageType.CHAT_MESSAGE, chat); }