基本上,当我尝试创建 OpenFileDialog 时,通过单击“游戏”中的特定区域,我的 mouseState 即使我已经释放它,也会保持“按下”状态。
OpenFileDialog dialog;
protected override void Update(GameTime gameTime)
{
if (selectSong.isClicked)
{
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
//code;
}
else
{
selectSong.isClicked = false;
// Disabling mouse event - because isClicked is always true after using showDialog()
}
}
UpdateMouse();
}
protected void UpdateMouse()
{
MouseState current_mouse = Mouse.GetState();
Console.Clear();
int mouseX = current_mouse.X;
int mouseY = current_mouse.Y;
selectSong.checkCollision(mouseX, mouseY, current_mouse.LeftButton);
exit.checkCollision(mouseX, mouseY, current_mouse.LeftButton);
Console.WriteLine("mouse X:" + mouseX + " mouse Y:" + mouseY);
Console.WriteLine("Left button down:" + current_mouse.LeftButton.ToString());
// Left button down - after creating Dialog.ShowDialog() is always pressed, even after releasing mouse, and hitting cancel in Dialog
}
这是描述问题的屏幕截图http://db.tt/NVnEUgLI