Beispiel #1
0
 public void OnPointerClick(PointerEventData eventData)
 {
     FirstClick?.Invoke(this, null);
     if (eventData.clickCount == 2 ||
         (Input.touchCount > 0 && Input.GetTouch(0).tapCount == 2))
     {
         DoubleClick?.Invoke(this, null);
     }
 }
Beispiel #2
0
 public virtual void InvokeOnCliсk(int clickCount)
 {
     if (Interactable)
     {
         Click?.Invoke();
     }
     if (clickCount == 1)
     {
         FirstClick?.Invoke();
     }
     StopAndStartWaintAndInvoke(clickCount);
 }
Beispiel #3
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (currentButton == 0)
            {
                FirstClick?.Invoke(this, e);
            }
            else if (currentButton == 1)
            {
                SecondClick?.Invoke(this, e);
            }
        }
    void Start()
    {
        _inventory  = GameObject.FindGameObjectWithTag("Inventory").GetComponent <InventoryLogic>();
        _firstCoin  = _inventory.ReturnToolDb().ToolDatabase[1];
        _writer     = GetComponentInParent <DescriptionWriter>();
        _tutorial   = GetComponent <TutorialVoice>();
        _leadMover  = GameObject.FindGameObjectWithTag("CameraLead").GetComponent <CameraLeadController>();
        _firstClick = GameObject.FindGameObjectWithTag("Guard").GetComponent <FirstClick>();
        _cameraFx   = GameObject.FindGameObjectWithTag("CameraGroup").GetComponent <CameraController>();

        _tutFunc = new CommonTutorialFunctions();
        _key     = _tutFunc.GetLootables("key");
    }
Beispiel #5
0
        private void Square_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (u.firstClick)
                {
                    var x = this;

                    if (x.Piece == null)
                    {
                        return;
                    }

                    if (u.WhosPlaying == x.Piece.Color || u.DisableTurn)
                    {
                        x.BackColor  = Color.LightGreen;
                        u.lastSquare = x;
                        u.light.FindAllMoves(x);
                        u.light.HighLightMoveStyle();
                        FirstClick?.Invoke(this, e);
                        u.firstClick = !u.firstClick;
                    }
                }
                else
                {
                    var x = this;

                    // If click again on same piece do nothing
                    if (u.lastSquare == x)
                    {
                        return;
                    }

                    u.lastSquare.BackColor = u.lastSquare.DefaultColor;

                    if (!x.IsEmpty)
                    {
                        if (x.Piece != null)
                        {
                            if (x.Piece.Color == u.lastSquare.Piece.Color)
                            {
                                u.light.Clear();
                                x.BackColor = Color.LightGreen;

                                u.lastSquare = x;
                                u.light.FindAllMoves(x);
                                u.light.HighLightMoveStyle();
                                FirstClick?.Invoke(this, e);
                                return;
                            }
                        }
                    }

                    SecondClick?.Invoke(this, e);
                    u.firstClick = !u.firstClick;
                    u.light.Clear();
                }
            }

            if (e.Button == MouseButtons.Right)
            {
                MessageBox.Show($"{Piece?.Name}\r\n{File}-{Rank}\r\n{Name}");
            }
        }