private void OnClick() { if (!enabled) { return; } CreateRippleSprite(); GenerateRippleTexture(); CreateMask(); if (_customRipplePosition) { _rippleSprite.rectTransform.anchoredPosition = _ripplePosition; } else { _rippleSprite.rectTransform.anchoredPosition = UiCanvasHelper.Instance.ScreenPosToGui(InputUtils.GetInputPosition()); } _rippleSprite.rectTransform.localScale = Vector3.one; //GraphicExtend.SetAlpha(_rippleSprite, _alphaFactorMin); _fadeTweener?.Kill(); _fadeTweener = _rippleSprite.TweenAlpha(_alphaFactorMax, _effectDuration, _holdOnPress ? TweenerPlayStyle.Once : TweenerPlayStyle.PingPong); _scaleTweener?.Kill(); _scaleTweener = _rippleSprite.rectTransform.TweenScale2D(new Vector2(GetScaleFactor(), GetScaleFactor()), _effectDuration, TweenerPlayStyle.Once); if (!_holdOnPress) { _fadeTweener.OnComplete(ClearCache); } }
public void OnPointerUp(PointerEventData eventData) { if (!enabled || !_holdOnPress) { return; } _fadeTweener?.Kill(); _fadeTweener = _rippleSprite.TweenAlpha(_alphaFactorMin, _effectDuration, TweenerPlayStyle.Once); _fadeTweener.OnComplete(ClearCache); }
private void OnClick(BaseEventData pData) { CreateRippleSprite(); GenerateRippleTexture(); CreateMask(); var newPos = _mainCamera.ScreenToWorldPoint(InputUtils.GetInputPosition()); _rippleSprite.rectTransform.position = new Vector2(newPos.x, newPos.y); _rippleSprite.rectTransform.localScale = Vector3.one; _rippleSprite.SetAlpha(0); _fadeTweener?.Kill(); _fadeTweener = _rippleSprite.TweenAlpha(_alphaFactor, _effectDuration, TweenerPlayStyle.PingPong); _scaleTweener?.Kill(); _scaleTweener = _rippleSprite.transform.TweenScale2D(new Vector2(_scaleFactor, _scaleFactor), _effectDuration, TweenerPlayStyle.Once); _scaleTweener.OnComplete(ClearCache); pData.Use(); }