示例#1
0
 public void Drag(TouchPadEventArgs tpea)
 {
     if (DragDel != null)
     {
         DragDel(tpea);
     }
 }
示例#2
0
        public void OnPointerDown(PointerEventData data)
        {
            if (isActive)
            {
                if (!touched)
                {
                    if (dlog)
                    {
                        Debug.Log("----------------POINTER Down--------------( " + data.pointerId);
                    }
                    touched        = true;
                    tpea           = new TouchPadEventArgs();
                    screenTouchPos = data.position;
                    oldPosition    = screenTouchPos;
                    pointerID      = data.pointerId;

                    tpea.SetTouch(screenTouchPos, Vector2.zero, TouchPhase.Began);
                    hitList = new List <Collider2D>();
                    hitList.AddRange(tpea.hits);
                    if (hitList.Count > 0)
                    {
                        for (int i = 0; i < hitList.Count; i++)
                        {
                            ExecuteEvents.Execute <ICustomMessageTarget>(hitList[i].transform.gameObject, null, (x, y) => x.PointerDown(tpea));
                            // if (tpea.firstSelected == null)  tpea.firstSelected = hitList[i].transform.gameObject.GetInterface<ICustomMessageTarget>();
                        }
                    }
                }
            }
        }
示例#3
0
 public void PointerDown(TouchPadEventArgs tpea)
 {
     if (GameBoard.gMode == GameMode.Edit)
     {
         OnPointerDownEvent(this);
     }
 }
示例#4
0
 public void PointerUp(TouchPadEventArgs tpea)
 {
     if (PointerUpDel != null)
     {
         PointerUpDel(tpea);
     }
 }
示例#5
0
 public void DragEnter(TouchPadEventArgs tpea)
 {
     if (GameBoard.gMode == GameMode.Edit)
     {
         Debug.Log("drag enter " + ToString());
         DragEnterEvent(this);
     }
 }
示例#6
0
        /// <summary>
        /// Camera follow touch drag direction
        /// </summary>
        /// <param name="tpea"></param>
        private void TrackTouchDrag(TouchPadEventArgs tpea)
        {
            if (track == TrackMode.Touch)
            {
                Vector3 dir = tpea.DragDirection;
                // dir.x = -tpea.DragDirection.x;
                // dir.y = -tpea.DragDirection.y;

                Vector3 target = transform.position + new Vector3(dir.x, dir.y, 0);
                transform.position = Vector3.Lerp(transform.position, target, 0.02f * Time.fixedDeltaTime);
                ClampCameraPosInField();
            }
        }
示例#7
0
        void Awake()
        {
            IsActive   = true;
            hitList    = new List <Collider2D>();
            newHitList = new List <Collider2D>();
            tpea       = new TouchPadEventArgs();

            if (Instance)
            {
                Destroy(gameObject);
            }
            else
            {
                Instance = this;
            }
        }
示例#8
0
 public void Drag(TouchPadEventArgs tpea)
 {
     if (dlog)
     {
         Debug.Log("drag: " + gameObject.name);
     }
     if (Draggable)
     {
         dragPos = new Vector3(tpea.WorldPos.x, tpea.WorldPos.y, Draggable.transform.position.z);
         if (showDrag)
         {
             Draggable.transform.position = new Vector3(tpea.WorldPos.x, tpea.WorldPos.y, Draggable.transform.position.z);
         }
         if (Draggable && Vector3.Distance(startDragPos, dragPos) > MatchBoard.MaxDragDistance)
         {
             ResetDrag(null);
         }
     }
 }
示例#9
0
 public void PointerUp(TouchPadEventArgs tpea)
 {
 }
示例#10
0
 public void DragExit(TouchPadEventArgs tpea)
 {
 }
示例#11
0
 public void DragDrop(TouchPadEventArgs tpea)
 {
 }
示例#12
0
 public void DragBegin(TouchPadEventArgs tpea)
 {
 }
示例#13
0
 public void DragEnter(TouchPadEventArgs tpea)
 {
 }
示例#14
0
 public void PointerDown(TouchPadEventArgs tpea)
 {
     PointerDownEvent?.Invoke(this);
 }