private void tempOnClick(UnityEngine.EventSystems.PointerEventData eventData) { if (eventData.button == UnityEngine.EventSystems.PointerEventData.InputButton.Right) { onRightClick?.Invoke(gameObject); } else if (eventData.button == UnityEngine.EventSystems.PointerEventData.InputButton.Left) { if (_doubleClickCoroutine == null) { OnClick?.Invoke(); OnClickWithObj?.Invoke(gameObject); } else { //存在双击 if (_isFirstClick) { _onDoubleClick?.Invoke(gameObject); _isFirstClick = false; _tempTime = 0; } else { _isFirstClick = true; _tempTime = 0; } } } }
private IEnumerator DoubleClickCheck() { while (true) { if (_isFirstClick) { _tempTime += GameApp.Instance.deltaTime; if (_tempTime >= DoubleClickInterval) { OnClick?.Invoke(); OnClickWithObj?.Invoke(gameObject); _isFirstClick = false; _tempTime = 0; } } yield return(null); } }