Exemplo n.º 1
0
        /// <summary>
        /// 使用当前的触摸状态去更新这个拖拽物体的位置
        /// </summary>
        internal void Update()
        {
            if (caluCamera == null || isStop)
            {
                return;
            }
            //得到现在鼠标的2维坐标系位置
            //Vector3 curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, dragControlPoint.z);
            Vector3 curScreenSpace = new Vector3(GCInput.mousePosition.x, GCInput.mousePosition.y, dragControlPoint.z);

            //将当前鼠标的2维位置转换成3维位置,再加上鼠标的移动量
            Vector3 curPosition = caluCamera.ScreenToWorldPoint(curScreenSpace) + offset;

            //curPosition就是物体应该的移动向量赋给transform的position属性
            dragObj.position = curPosition;
            if (mouseBtn == -1)
            {
                mouseBtn = 0;
            }
            if (GCInput.GetMouseButtonUp(mouseBtn))
            {
                try
                {
                    EventStopDrag?.Invoke(this);
                }
                catch (Exception e)
                {
                    Debug.Log("DragRecord.Update():执行用户事件EventStopDrag异常" + e.Message);
                }
                isStop = true;
            }
        }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (_rotaModel != null)
     {
         RotaModel();
     }
     if (GCInput.GetMouseButtonUp(0))
     {
         _rotaModel = null;
     }
 }
Exemplo n.º 3
0
        private void Update()
        {
            if (m_LogLevel <= Common.LogLevel.DEBUG)
            {
                Common.AppLog.AddFormat(Common.LogLevel.DEBUG, "SimpleDrag.Update", "");
            }
            if (GCInput.GetMouseButtonDown(0))
            {
                if (m_LogLevel <= Common.LogLevel.DEBUG)
                {
                    Common.AppLog.AddFormat(Common.LogLevel.DEBUG, "SimpleDrag.Update", "leftDown=true");
                }
                Drag2DObj();
            }

            if (GCInput.GetMouseButtonUp(0))
            {
                OnMouseBtnUp();
            }
        }