示例#1
0
    private void Update()
    {
        if (sr == null)
        {
            return;
        }

        if (Time.realtimeSinceStartup >= time && once)
        {
            if (type == MouseType.LeftDown)
            {
                MyInput.SetMouseButtonDown(0);
                cursor.SetActive(true);
            }


            if (type == MouseType.LeftUp)
            {
                MyInput.SetMouseButtonUp(0);
            }


            if (type == MouseType.Move)
            {
                MyInput.ClearMouseButton();
            }

            /*
             * float realh = gameView.position.height - 17;
             * float realw = gameView.position.width;
             *
             * // 期望的宽
             * float expectw = realh * resw / resh;
             *
             * Debug.Log("lucky expect " + expectw + " " + realh);
             * Debug.Log("lucky pre " + xpre + " " + ypre);
             * Debug.Log("lucky real res " + realw + " " + realh);
             */

            MyInput.mousePosition = new Vector3(resw * xpre, resh * ypre, 0);
            if (cursor.activeSelf)
            {
                cursor.GetComponent <RectTransform>().anchoredPosition3D = new Vector3(resw * xpre, resh * ypre, 0);
            }


            Debug.Log("lucky play mouse " + type + " " + MyInput.mousePosition);

            if ((line = sr.ReadLine()) != null)
            {
                string[] ss = line.Split(' ');
                time = Convert.ToSingle(ss[0]);
                type = (MouseType)Convert.ToInt32(ss[1]);
                xpre = Convert.ToSingle(ss[2]);
                ypre = Convert.ToSingle(ss[3]);
            }
            else
            {
                once = false;
                Debug.Log("lucky high 播放完毕");
            }
        }
    }