Do not cache instances of this type outside their event handler. If necessary, you can clone an instance using the MouseEventArgs(MouseEventArgs) constructor.
private void WindowOnMouseEvent(object sender, MouseEventArgs e) { if (_kuat.WindowOnMouseEvent(sender, e)) { return; } if (!(e is MouseButtonEventArgs be)) { return; } if (be.Mouse.IsButtonDown(MouseButton.Left)) { Window.CursorVisible = false; var mouse = Mouse.GetState(); _lastMousePos = new Point(mouse.X, mouse.Y); } else { Window.CursorVisible = true; } }
private static void ReleaseHandler(MouseEventArgs Args) { }
private static void PressHandler(MouseEventArgs Args) { }
private static void MoveHandler(MouseEventArgs Args) { }
private static void DownHandler(MouseEventArgs Args) { }
private static void ClickHandler(MouseEventArgs Args) { }
static void releaseHandler( MouseEventArgs Args ) { }
static void pressHandler( MouseEventArgs Args ) { }
static void moveHandler( MouseEventArgs Args ) { }
static void downHandler( MouseEventArgs Args ) { }
static void clickHandler( MouseEventArgs Args ) { }
private void ExplodeObject(object sender, MouseEventArgs evArgs) { if (!Parent.MouseClicked) return; Object pick = Picking.RayCastPick(Parent, flyingObjects.ToArray()); if (pick == null) return; ((FlyingObject)pick).Kill(); Game.ExplodeAt(pick.Location, .5f); //update score in Score TableP Game.Score[((FlyingObject)pick).ModelReference]++; GeneralAudio.PlaySound((1 + GeneralMath.RandomInt() % 8).ToString()); //Console.WriteLine(flyingObjects.Count); flyingObjects.Remove((FlyingObject)pick); //Console.WriteLine(flyingObjects.Count); CurrentScore += ((FlyingObject)pick).ModelReference.score; scoreLabel.Text = CurrentScore.ToString() + "/" + TargetScore.ToString(); if (CurrentScore >= TargetScore) Complete(); }