Exemple #1
0
    void Update()
    {
        #region 判斷是否要開啟 Debug 的訊息
        if (Input.GetKeyDown(KeyCode.D))
        {
            IsDebugMode = !IsDebugMode;
        }
        #endregion
        #region 任務時間計算
        if (!counter.IsRecordBefore)
        {
            counter.TimeCounter += Time.deltaTime;
        }
        #endregion
        #region 眼動儀抓點
        if (!EyeTracking.GetGazePoint().IsValid)
        {
            return;
        }
        FinalPoint = ScreenToWorld(EyeTracking.GetGazePoint().Screen);
        if (IsUseFilter)
        {
            FinalPoint = DoubleExpFilter(FinalPoint);
        }

        recordData.Add(FinalPoint);
        #endregion
        #region 移動滑鼠 & 點擊判斷
        CursorAPI.SetCursorPosAPI(FinalPoint);

        // 判斷距離有沒有在設定的範圍內,有的話就加時間
        float dist = Vector3.Distance(HistoryPointTime0, FinalPoint);
        if (dist <= DiffDistance)
        {
            DiffCounter += Time.deltaTime;
        }
        else
        {
            DiffCounter = 0;
        }

        // 如果超過 DiffTime 代表傳送點擊事件
        if (DiffCounter >= DiffTime)
        {
            CursorAPI.CursorClickAPI();
            DiffCounter = 0;
        }


        // 最後要更新過去的點
        HistoryPointTime0 = FinalPoint;
        #endregion
    }
Exemple #2
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WindowMessageType.WM_SETCURSOR.ToInt32())
            {
                try
                {
                    CursorAPI.SetCursor(CursorAPI.LoadCursor(IntPtr.Zero, CursorType.IDC_HAND));
                }
                catch (DllNotFoundException)
                {
                    // Mono
                    Cursor = Cursors.Hand;
                }

                // The message has been handled
                m.Result = IntPtr.Zero;

                return;
            }

            base.WndProc(ref m);
        }
Exemple #3
0
 public void OnPointerExit(PointerEventData eventData)
 {
     CursorAPI.SetCursor("");
     cursorShown = false;
 }
Exemple #4
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     CursorAPI.SetCursor(cursor);
     cursorShown = true;
 }