public void OnBeginDrag(PointerEventData data) { if (isActive) { if (data.pointerId == pointerID) { if (dlog) { Debug.Log("----------------BEGIN DRAG--------------( " + data.pointerId); } screenTouchPos = data.position; tpea.SetTouch(screenTouchPos, screenTouchPos - oldPosition, TouchPhase.Moved); oldPosition = screenTouchPos; //0 ---------------------------------- send drag begin message -------------------------------------------------- for (int i = 0; i < hitList.Count; i++) { if (hitList[i]) { ExecuteEvents.Execute <ICustomMessageTarget>(hitList[i].transform.gameObject, null, (x, y) => x.DragBegin(tpea)); } } } } }
public void OnBeginDrag(PointerEventData data) { if (isActive) { if (data.pointerId == pointerID) { screenTouchPos = data.position; tpea.SetTouch(screenTouchPos, screenTouchPos - oldPosition, TouchPhase.Moved); oldPosition = screenTouchPos; newHitList = new List <Collider2D>(tpea.hits); // garbage //0 ---------------------------------- send drag begin message -------------------------------------------------- for (int i = 0; i < hitList.Count; i++) { if (hitList[i]) { ExecuteEvents.Execute <ICustomMessageTarget>(hitList[i].transform.gameObject, null, (x, y) => x.DragBegin(tpea)); } } } hitList = newHitList; // Debug.Log("stp drag begin"); } }
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>(); } } } } }