private void Update() { if (Input.GetKeyDown("escape") && !socketIsClosing) { StartCoroutine(CloseSocketBeforeEnd()); socketIsClosing = true; return; } if (!devMode) { return; } if (serverType == ServerType.AttnGan && Input.GetKeyDown("a")) { AttnGanRequestData attnGanRequestData = new AttnGanRequestData(); attnGanRequestData.caption = "apple test"; // v.1 - send as dictionary /* * Dictionary<string, object> arg = new Dictionary<string, object>(); * arg.Add("caption", "apple"); * t2iSocket.Emit("update_request", arg); */ // v.2 - send as object //string json = JsonConvert.SerializeObject(attnGanRequestData); //string json = JsonUtility.ToJson(attnGanRequestData); genSocket.Emit("update_request", attnGanRequestData); Debug.Log("AttnGanSocket emit update_request"); } }
public void EmitAttnGanRequest(string inputText) { AttnGanRequestData attnGanRequestData = new AttnGanRequestData(); string stringToSend = inputText.ToLower(); stringToSend += " "; attnGanRequestData.caption = inputText.ToLower(); genSocket.Emit("update_request", attnGanRequestData); //Debug.LogFormat("socket emit request: {0}", stringToSend); }
public void OnAttnGanInputUpdate(string inputText) { if ((Time.time - lastTypingTimecode) <= typingTimerLength) { return; } AttnGanRequestData attnGanRequestData = new AttnGanRequestData(); string stringToSend = inputText.ToLower(); stringToSend += " "; attnGanRequestData.caption = inputText.ToLower(); genSocket.Emit("update_request", attnGanRequestData); lastTypingTimecode = Time.time; //Debug.LogFormat("socket emit request: {0}", stringToSend); }