public void Drag(TouchPadEventArgs tpea) { if (DragDel != null) { DragDel(tpea); } }
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>(); } } } } }
public void PointerDown(TouchPadEventArgs tpea) { if (GameBoard.gMode == GameMode.Edit) { OnPointerDownEvent(this); } }
public void PointerUp(TouchPadEventArgs tpea) { if (PointerUpDel != null) { PointerUpDel(tpea); } }
public void DragEnter(TouchPadEventArgs tpea) { if (GameBoard.gMode == GameMode.Edit) { Debug.Log("drag enter " + ToString()); DragEnterEvent(this); } }
/// <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(); } }
void Awake() { IsActive = true; hitList = new List <Collider2D>(); newHitList = new List <Collider2D>(); tpea = new TouchPadEventArgs(); if (Instance) { Destroy(gameObject); } else { Instance = this; } }
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); } } }
public void PointerUp(TouchPadEventArgs tpea) { }
public void DragExit(TouchPadEventArgs tpea) { }
public void DragDrop(TouchPadEventArgs tpea) { }
public void DragBegin(TouchPadEventArgs tpea) { }
public void DragEnter(TouchPadEventArgs tpea) { }
public void PointerDown(TouchPadEventArgs tpea) { PointerDownEvent?.Invoke(this); }