Example #1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //info0Text = Input.GetAxis("Mouse X") + " " + Input.GetAxis("Mouse Y");
            recognition.ChangeMode();
        }
        if (Input.GetKey(KeyCode.Escape))
        {
            // no nothing
        }
        GameObject.Find("Info0").GetComponent <Text>().text = info0Text;
        GameObject.Find("Info1").GetComponent <Text>().text = DateTime.Now.ToString("HH:mm:ss") + " <color=#d078d0>" + algorithm + "</color> <color=#00ee99>Now:" + sampleCnt + "</color>";
        lock (eventsMutex)
        {
            for (int i = 0; i < events.Count; i++)
            {
                string line = events[i];
                if (i < events.Count - 1 && line.Substring(0, 5) == "drag " && events[i + 1].Substring(0, 5) == "drag ")
                {
                    continue;
                }
                string[] arr = line.Split(' ');
                switch (arr[0])
                {
                case "devicesize":
                    deviceWidth  = int.Parse(arr[1]);
                    deviceHeight = int.Parse(arr[2]);
                    break;

                case "click":
                    Click(int.Parse(arr[1]), int.Parse(arr[2]));
                    break;

                case "dragbegin":
                    DragBegin(int.Parse(arr[1]), int.Parse(arr[2]));
                    break;

                case "drag":
                    Drag(int.Parse(arr[1]), int.Parse(arr[2]));
                    break;

                case "dragend":
                    DragEnd(int.Parse(arr[1]), int.Parse(arr[2]));
                    break;

                case "leftslip":
                    LeftSlip();
                    break;

                case "rightslip":
                    RightSlip();
                    break;

                case "downslip":
                    DownSlip();
                    break;

                case "actiondown":
                    break;
                }
            }
            events.Clear();
        }
    }