/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } var currentMouseState = Mouse.GetState(); if (currentMouseState.LeftButton == ButtonState.Pressed && !_monoKnowledges.LButtonDown(currentMouseState.X, currentMouseState.Y)) { _lButtonPressed = true; } else if (_lButtonPressed) { _lButtonPressed = false; if (!_monoControls.Any(ctrl => ctrl.MouseLClick(currentMouseState)) && !_monoKnowledges.MouseLClick(currentMouseState)) { _game.LClick(new Point(currentMouseState.X, currentMouseState.Y)); } /*if (!_menu.MouseLClick(currentMouseState)) * { * if (!_inventory.MouseLClick(currentMouseState) && !_pauseSwich.MouseLClick(currentMouseState) && !_knowledgeSwich.MouseLClick(currentMouseState)) * _game.LClick(new Point(currentMouseState.X, currentMouseState.Y)); * }*/ } else if (currentMouseState.LeftButton == ButtonState.Released) { _monoKnowledges.LButtonUp(currentMouseState.X, currentMouseState.Y); } if (currentMouseState.RightButton == ButtonState.Pressed) { _rButtonPressed = true; } else if (_rButtonPressed) { _rButtonPressed = false; if (!_monoControls.Any(ctrl => ctrl.MouseRClick(currentMouseState))) { _game.RClick(new Point(currentMouseState.X, currentMouseState.Y)); } /* if (!_menu.MouseRClick(currentMouseState)) * { * if (!_inventory.MouseRClick(currentMouseState) && !_pauseSwich.MouseRClick(currentMouseState) && !_knowledgeSwich.MouseRClick(currentMouseState)) * _game.RClick(new Point(currentMouseState.X, currentMouseState.Y)); * }*/ } if (!_monoKnowledges.MouseMove(currentMouseState.X, currentMouseState.Y) && !_menu.MouseOver(currentMouseState)) { _inventory.MouseOver(currentMouseState); } base.Update(gameTime); }
private void canvas1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _game.LClick(new Point((int)e.GetPosition(this).X, (int)e.GetPosition(this).Y)); }