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); } }
public virtual void InvokeOnCliсk(int clickCount) { if (Interactable) { Click?.Invoke(); } if (clickCount == 1) { FirstClick?.Invoke(); } StopAndStartWaintAndInvoke(clickCount); }
protected override void OnClick(EventArgs e) { base.OnClick(e); if (currentButton == 0) { FirstClick?.Invoke(this, e); } else if (currentButton == 1) { SecondClick?.Invoke(this, e); } }
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}"); } }