Exemple #1
0
        public override void OnPointerUp(PointerEventData eventData)
        {
            if (isOver == false)
            {
                //Debug.Log("EL MOUSE NO ESTA SOBRE LA CARD");
                return;
            }
            if (scrollAdTime >= scrollTriggerTime)
            {
                //Debug.Log("SE SUPERO EL TIEMPO DE APRETADO " + scrollAdTime);
                isOver       = false;
                scrollAdTime = 0;
                return;
            }
            Vector2 newMousePos = Input.mousePosition;

            if (Vector2.Distance(newMousePos, mousePos) > 50f)
            {
                //Debug.Log("SE SUPERO LA DISTANCIA");
                scrollAdTime = 0;
                isOver       = false;
                return;
            }

            //Debug.Log("TIEMPO DE APRETADO " + scrollAdTime);
            scrollAdTime = 0;
            isOver       = false;
            OnCardClick?.Invoke(pCardData, cardSlotUI);
        }
Exemple #2
0
 private void OnMouseDown()
 {
     if (_cardBack.activeSelf)
     {
         _cardBack.SetActive(false);
         OnCardClick?.Invoke(this);
     }
 }
Exemple #3
0
    void Awake()
    {
        _purpleGlow.enabled = false;
        _greenGlow.enabled  = false;

        shirtImage     = cardShirt.GetComponent <Image>();
        _rectTransform = GetComponent <RectTransform> ();

        _eventTrigger = GetComponent <EventTrigger>();
        EventTrigger.Entry entry = new EventTrigger.Entry();
        entry.eventID = EventTriggerType.PointerClick;
        entry.callback.AddListener((data) =>
        {
            Debug.Log("tap on card id: " + _cardVo.id);
            if (OnCardClick != null)
            {
                OnCardClick.Invoke(_cardVo);
            }
        });

        _eventTrigger.triggers.Add(entry);
    }