diff --git a/MmgEngine/Button.cs b/MmgEngine/Button.cs index 87ee889..2557d45 100644 --- a/MmgEngine/Button.cs +++ b/MmgEngine/Button.cs @@ -55,29 +55,26 @@ public override void Draw(GameTime gameTime) private void Check(object s, ButtonEventArgs e) { - if (!Enabled) + if (!Enabled || !ActionBox.Contains(e.Position)) return; - - if (ActionBox.Contains(e.Position)) + + switch (e.Button) { - switch (e.Button) - { - case "LeftButton": - LeftClicked?.Invoke(this, new EventArgs()); - break; - case "MiddleButton": - MiddleClicked?.Invoke(this, new EventArgs()); - break; - case "RightButton": - RightClicked?.Invoke(this, new EventArgs()); - break; - case "XButton1": - XButton1Clicked?.Invoke(this, new EventArgs()); - break; - case "XButton2": - XButton2Clicked?.Invoke(this, new EventArgs()); - break; - } + case "LeftButton": + LeftClicked?.Invoke(this, EventArgs.Empty); + break; + case "MiddleButton": + MiddleClicked?.Invoke(this, EventArgs.Empty); + break; + case "RightButton": + RightClicked?.Invoke(this, EventArgs.Empty); + break; + case "XButton1": + XButton1Clicked?.Invoke(this, EventArgs.Empty); + break; + case "XButton2": + XButton2Clicked?.Invoke(this, EventArgs.Empty); + break; } }