private void TouchInput() { this.m_touchCount = 0; for (int i = 0; i < this.m_touchIds.Count; i++) { int num = this.FindTouch(i); if (num != -1) { Touch touch = Input.touches[num]; this.m_touchIds[i] = touch.fingerId; bool flag = touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled; FocusData focusData = this.GetFocusData(touch.fingerId); if (i == 0) { focusData.primary = true; } this.PointerInput(i, true, touch.phase == TouchPhase.Began, flag, !flag, touch.position, touch.fingerId, focusData, this.m_pointers[i]); this.m_touchCount++; } else { this.m_touchIds[i] = -1; this.PointerInput(i, false, false, false, false, Vector3.zero, -1, null, this.m_pointers[i]); } } }
private List <FocusItem> AddDataToCollection( FocusData data, List <FocusItem> allData) { if (allData.Any(x => x.ItemId == data.ItemId)) { allData.First(x => x.ItemId == data.ItemId).AddAndCombineItem(data); } else { var focusItem = new FocusItem(data.ItemId); focusItem.AddAndCombineItem(data); allData.Add(focusItem); } return(allData); }
private void MouseInput() { FocusData focusData = this.m_focusData[0]; focusData.primary = true; this.PointerInput(0, true, Input.GetMouseButtonDown(0), Input.GetMouseButtonUp(0), Input.GetMouseButton(0), Input.mousePosition, 0, focusData, this.m_pointers[0]); this.m_pointers[0].secondaryDown = Input.GetMouseButtonDown(1); this.m_pointers[0].secondaryUp = Input.GetMouseButtonUp(1); this.m_pointers[0].secondaryDragging = Input.GetMouseButton(1); if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0)) { this.m_touchCount = 1; } else { this.m_touchCount = 0; } }
private void PointerInput(int pointerIndex, bool touching, bool pointerDown, bool pointerUp, bool dragging, Vector3 position, int fingerId, FocusData focus, Pointer pointer) { Widget widget = this.RayCast(position); pointer.touching = touching; pointer.down = pointerDown; pointer.up = pointerUp; pointer.dragging = dragging; pointer.position = position; pointer.fingerId = fingerId; pointer.onWidget = (widget != null); pointer.widget = widget; pointer.doubleClick = false; if (widget && pointerDown) { pointer.touchUsed = true; } else if (pointerUp || !touching) { pointer.touchUsed = false; } if (widget != null && focus != null && !focus.primary && !widget.AllowMultitouch()) { widget = null; } if (pointerDown) { if (widget) { focus.target = widget; focus.target.SendInput(new InputEvent(InputEvent.EventType.Press, position)); } else { focus.target = null; } } if (pointerUp) { if (widget && widget == focus.target) { widget.SendInput(new InputEvent(InputEvent.EventType.Release, position)); } focus.target = null; } if (touching) { if (widget != null && focus.mouseOver != widget && (focus.target == null || focus.target == widget)) { if (focus.mouseOver != null) { focus.mouseOver.SendInput(new InputEvent(InputEvent.EventType.MouseLeave, position)); } focus.mouseOver = widget; widget.SendInput(new InputEvent(InputEvent.EventType.MouseEnter, position)); if (widget == focus.target && !pointerDown) { widget.SendInput(new InputEvent(InputEvent.EventType.MouseReturn, position)); } } if (focus.mouseOver != null && widget != focus.mouseOver) { focus.mouseOver.SendInput(new InputEvent(InputEvent.EventType.MouseLeave, position)); focus.mouseOver = null; } } if (pointerUp) { if (focus.mouseOver != null) { focus.mouseOver.SendInput(new InputEvent(InputEvent.EventType.MouseLeave, Input.mousePosition)); } focus.mouseOver = null; focus.target = null; focus.fingerId = -1; focus.primary = false; } if (focus != null && focus.target != null) { focus.target.SendInput(new InputEvent(InputEvent.EventType.Drag, position)); } }