Ejemplo n.º 1
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         _isPressed = true;
     }
     if (_isPressed && Input.GetMouseButtonUp(0))
     {
         Clicked.Invoke(Camera.main.ScreenToWorldPoint(Input.mousePosition));
         _isPressed = false;
     }
 }
Ejemplo n.º 2
0
        public void OnPointerUp(PointerEventData eventData)
        {
            if (isClicked)
            {
                return;
            }

            ChangeCellState(false);

            isClicked = true;

            eventData.selectedObject = gameObject;
            ClickedEvent.Invoke();
        }
Ejemplo n.º 3
0
        void OnMouseUp()
        {
            if (!Active)
            {
                return;
            }

            if (!string.IsNullOrEmpty(TooltipText))
            {
                ToolTip.Instance.HideTooltip();
            }

            if (BuildingPrefab != null)
            {
                ClickedEvent?.Invoke(BuildingPrefab);
            }
        }
        public void OnPointerClick(PointerEventData data)
        {
            if (data.button != PointerEventData.InputButton.Left)
            {
                return;
            }

            Vector3 worldPoint;

            if (!Camera.main.ScreenPointToWorldPointInRectangle(transform.position, transform.rotation, data.position, out worldPoint))
            {
                return;
            }

            Debug.Log("Click!");
            m_OnClick.Invoke(worldPoint);
        }
Ejemplo n.º 5
0
    void Update()
    {
        if (!Camera.main)
        {
            return;
        }

        _distance += Input.mouseScrollDelta.y * _scrollScale;
        _distance  = Mathf.Clamp(_distance, Camera.main.nearClipPlane, Camera.main.farClipPlane);

        var ray = Camera.main.ScreenPointToRay(Input.mousePosition, Camera.MonoOrStereoscopicEye.Mono);
        var p   = ray.GetPoint(_distance);

        transform.position = p;

        if (Input.GetMouseButtonDown(0) && _onClick != null)
        {
            _onClick.Invoke(p);
        }
    }
Ejemplo n.º 6
0
 private protected override void OnTouchesEndedUI(List <CCTouch> touches, CCEvent touchEvent)
 {
     touchEvent.StopPropogation();
     if (touches.Count > 0)
     {
         // turn back to original color when released
         StartSprite.Color  = CCColor3B.White;
         MiddleSprite.Color = CCColor3B.White;
         EndSprite.Color    = CCColor3B.White;
         label.Color        = CCColor3B.White;
         label2.Color       = CCColor3B.White;
         var touch = touches[0];
         if (TouchIsOnIt(touch))
         {
             // move the popUp out of view and remove it
             RemovePerAction();
             Pressable = false;
             ClickedEvent?.Invoke(this, EventArgs.Empty);
         }
     }
 }
Ejemplo n.º 7
0
        public override void Update(GameTime gameTime)
        {
            MouseState mouseState = Mouse.GetState();

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                if (buttonArea.Contains(mouseState.Position))
                {
                    current = pressedTextureRegion;
                }
            }
            else
            {
                if (prevState.LeftButton == ButtonState.Pressed && buttonArea.Contains(mouseState.Position))
                {
                    ClickedEvent?.Invoke();
                }
                current = normalTextureRegion;
            }

            prevState = mouseState;
        }
Ejemplo n.º 8
0
 protected void EmitClickEvent()
 {
     ClickedEvent?.Invoke(this);
 }
Ejemplo n.º 9
0
        public override bool PerformClick()
        {
            ClickedEvent?.Invoke();

            return(base.PerformClick());
        }
Ejemplo n.º 10
0
 public void OnTap()
 {
     ClickedEvent?.Invoke(this);
 }
Ejemplo n.º 11
0
 public void OnTap()
 {
     ClickedEvent?.Invoke(this, ConstructDataList);
 }
Ejemplo n.º 12
0
        private void CampClicked(object sender, MouseButtonEventArgs e)
        {
            ClickedEvent cl = Clicked;

            cl?.Invoke(UserID, CampID);
        }
Ejemplo n.º 13
0
 public void Button_OnClick() => Clicked.Invoke(this, Panel);
 private void Wire_Clicked(Wire wire) => Clicked.Invoke(wire);
Ejemplo n.º 15
0
 public void handleClick()
 {
     clickedEvent.Invoke(this);
 }
Ejemplo n.º 16
0
 public void OnClicked()
 {
     ClickedEvent?.Invoke(this, new PageTabEventArgs {
         PageNumber = m_PageNumber
     });
 }