bool OnInput(InputOnce input) { if (input.type == InputType.Tap) { //CommonLogger.Log ("Tap"); foreach (TapTaper t in m_RegTaps) { t.TapInput(input); } } if (input.type == InputType.Slice) { if ((input.second_point - input.tap_point).magnitude >= 20) { CommonLogger.Log("Slice"); if (input.slice_cb != null) { input.slice_cb(); } return(true); } } return(false); }
public override void CheckInput(System.Collections.Generic.List <InputOnce> inputs) { if (Input.GetMouseButtonDown(0)) { InputOnce ino = new InputOnce(); ino.type = InputType.Tap; ino.tap_point = Input.mousePosition; inputs.Add(ino); m_isButtonDown = true; m_TapPos = Input.mousePosition; } if (Input.GetMouseButtonUp(0)) { m_isButtonDown = false; } if (m_isButtonDown) { InputOnce ino = new InputOnce(); ino.type = InputType.Slice; ino.tap_point = m_TapPos; ino.second_point = Input.mousePosition; ino.slice_cb = SliceEnd; inputs.Add(ino); } }
public bool TapInput(InputOnce input) { if (m_TapCount >= TapOkCount) { return(false); } if (input.type == InputType.Tap) { if (CommonUtil.UIManager.Instance.MainCameraHolder.TapOnCollider(gameObject.GetComponent <Collider> (), input.tap_point)) { DoTap(); return(true); } } return(false); }
public override void CheckInput(System.Collections.Generic.List <InputOnce> inputs) { foreach (Touch t in Input.touches) { if (t.phase == TouchPhase.Began) { TouchingInput ti = new TouchingInput(); ti.tap_pos = ti.cur_pos = t.position; ti.id = t.fingerId; m_Touches [t.fingerId] = ti; InputOnce ino = new InputOnce(); ino.type = InputType.Tap; ino.tap_point = ti.tap_pos; inputs.Add(ino); } else if (t.phase == TouchPhase.Moved) { if (!m_Touches.ContainsKey(t.fingerId)) { CommonUtil.CommonLogger.LogError("Can't find Touch id in data : " + t.fingerId.ToString()); } else { m_Touches [t.fingerId].cur_pos = t.position; InputOnce ino = new InputOnce(); ino.type = InputType.Slice; ino.tap_point = m_Touches [t.fingerId].tap_pos; ino.second_point = m_Touches [t.fingerId].cur_pos; ino.slice_cb = m_Touches [t.fingerId].OnSliceEnd; inputs.Add(ino); } } else if (t.phase == TouchPhase.Canceled || t.phase == TouchPhase.Ended) { m_Touches.Remove(t.fingerId); } } }