Ejemplo n.º 1
0
 public void OnPointerUp(PointerEventData eventData)
 {
     _isPressed = false;
     if (_isDragging)
     {
         return;
     }
     onPointerUpEvent?.Invoke();
 }
Ejemplo n.º 2
0
    public static void TriggerEvent(TypeOfEvent theType, EventInfo triggerInfo)
    {
        MyUnityEvent thisEvent = null;

        if (eventManager.eventDictionary.TryGetValue(theType, out thisEvent))
        {
            thisEvent.Invoke(triggerInfo);
        }
    }
Ejemplo n.º 3
0
        public void OnPointerUp(PointerEventData eventData)
        {
            if (!IsTouching)
            {
                return;
            }

            IsTouching = false;
            OnTouchEnd.Invoke(TouchGetter.GetTouchPositon());
        }
Ejemplo n.º 4
0
        public virtual void Hide()
        {
            StartCoroutine(KKUtilities.FloatLerp(showAnimationTime * 0.5f, (t) =>
            {
                panel.Alpha = Mathf.Lerp(panel.DefaultAlpha, 0.0f, Easing.OutQuad(t));
            }));

            StartCoroutine(hideAnimation.GetAnimation(this, hideAnimationTime).OnCompleted(() =>
            {
                panel.gameObject.SetActive(false);
                Container.SetActive(false);
                OnHideAnimationEnd.Invoke();
            }));
        }
Ejemplo n.º 5
0
        void OnTouching(Vector2 touchPosition)
        {
            //移動量の計算
            touchPosition    = TouchGetter.GetTouchPositon();
            DeltaPosition    = (touchPosition - oldTouchPosition) * screenSizeRate;
            oldTouchPosition = touchPosition;

            //スワイプ中にCanTouchがfalseになった
            if (isStartTouch && !CanTouch)
            {
                isStartTouch = false;
                if (onTouchEnd != null)
                {
                    onTouchEnd.Invoke(oldTouchPosition);
                }
            }

            //操作受け中ではなかった
            if (!isStartTouch || !CanTouch)
            {
                return;
            }

            if (swipePower < swipePowerBoder)
            {
                touchTime  += Time.deltaTime;
                swipeValue += DeltaPosition;
                swipePower  = swipeValue.magnitude;
            }
            else
            {
                if (onSwipe != null)
                {
                    onSwipe.Invoke(DeltaPosition);
                }
            }
        }
Ejemplo n.º 6
0
        public virtual void Show()
        {
            panel.gameObject.SetActive(true);
            Container.SetActive(true);
            Alpha = 1;
            StartCoroutine(KKUtilities.FloatLerp(showAnimationTime * 0.5f, (t) =>
            {
                panel.Alpha = Mathf.Lerp(0.0f, panel.DefaultAlpha, Easing.InQuad(t));
            }));

            StartCoroutine(showAnimation.GetAnimation(this, showAnimationTime).OnCompleted(() =>
            {
                OnShowAnimationEnd.Invoke();
            }));
        }
Ejemplo n.º 7
0
        void OnTouchStart(Vector2 touchPosition)
        {
            isStartTouch = CanTouch;
            if (!isStartTouch)
            {
                return;
            }

            DeltaPosition    = Vector2.zero;
            swipePower       = 0.0f;
            swipeValue       = Vector2.zero;
            touchTime        = 0.0f;
            oldTouchPosition = TouchGetter.GetTouchPositon();

            if (onTouchStart != null)
            {
                onTouchStart.Invoke(touchPosition);
            }
        }
Ejemplo n.º 8
0
        void OnTouchEnd(Vector2 touchPosition)
        {
            if (!isStartTouch || !CanTouch)
            {
                return;
            }
            if (swipePower < swipePowerBoder)
            {
                if (onTap != null)
                {
                    onTap.Invoke(touchPosition);
                }
            }

            if (onTouchEnd != null)
            {
                onTouchEnd.Invoke(touchPosition);
            }

            DeltaPosition = Vector2.zero;
        }
Ejemplo n.º 9
0
 public void OnPointerDown(PointerEventData eventData)
 {
     IsTouching = true;
     OnTouchStart.Invoke(TouchGetter.GetTouchPositon());
 }