Exemple #1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (_eventType != EventType.CLICK)
     {
         return;
     }
     if (!IsTouchEnabled())
     {
         return;
     }
     if (!CheckCanClickByInterval())
     {
         return;
     }
     _timeWaitNextClick = _clickInterval;
     PlayClickSound();
     PlayTouchAnim(() => {
         TouchClick(eventData);
         OnAnimDone.Invoke();
     });
     OnTouchUp.Invoke();
 }
Exemple #2
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (_eventType != EventType.TOUCH)
        {
            return;
        }
        if (!IsTouchEnabled())
        {
            return;
        }
        if (!CheckCanClickByInterval())
        {
            return;
        }
        _timeWaitNextClick = _clickInterval;
        if (null != _stateSelectedSprite)
        {
            if (null != _stateDefaultImage)
            {
                _stateDefaultSprite       = _stateDefaultImage.sprite;
                _stateDefaultImage.sprite = _stateSelectedSprite;
            }
            else if (null != _stateDefaultSpriteRenderer)
            {
                _stateDefaultSprite = _stateDefaultSpriteRenderer.sprite;
                _stateDefaultSpriteRenderer.sprite = _stateSelectedSprite;
            }
        }
        TouchDown(eventData);

        OnTouchDown.Invoke();
        PlayClickSound();
        PlayClickVO();
        PlayTouchAnim(() => {
            OnAnimDone.Invoke();
        });
    }