void Update() { if (Input.GetKeyDown(KeyCode.Return)) { if (textInput.text != string.Empty) { string text = textInput.text; string name = playerNameInput.text; NewMsgJSON NewMsgJSON = new NewMsgJSON(name, text); ChattingUpdate(name, text); socket.Emit("newMsg", new JSONObject(JsonUtility.ToJson(NewMsgJSON))); textInput.text = string.Empty; } } }
void OnNewMsg(SocketIOEvent socketIOEvent) { NewMsgJSON msgJSON = NewMsgJSON.CreateFromJSON(socketIOEvent.data.ToString()); ChattingUpdate(msgJSON.name, msgJSON.text); }