示例#1
0
        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");
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }