public void Update(GameTime gameTime) { MouseState mouseState = Mouse.GetState(); Time = Time.Subtract(gameTime.ElapsedGameTime); ClickTime = ClickTime.Subtract(gameTime.ElapsedGameTime); if (drawLoadTextBox) { string result = loadTextBox.CheckMultilineCollisions(mouseState); if (!result.Equals("")) { game.SetFilename(result); game.SwitchMode(); } } if (mouseState.LeftButton == ButtonState.Pressed) { int x = mouseState.X; int y = mouseState.Y; mouseRect = new Rectangle(x, y, 1, 1); MouseCollisionChecker mouseCollisionChecker = new MouseCollisionChecker(blockDict, pipeDict, enemyDict, itemDict, playerDict); if ((int)Time.TotalMilliseconds <= 0) { Time = new TimeSpan(0, 0, 0, 0, 150); mouseCollisionChecker.CheckMouseDisplayCollisions(options[optionsIndex], mouseRect, previousMouseRect, displayBlocks, displayPipes, displayEnemies, displayItems, displayPlayers, blocks, pipes, enemies, items, players); } mouseCollisionChecker.CheckMouseDefaultCollisions(mouseRect, previousMouseRect, blocks, pipes, enemies, items, players); if (mouseRect.Intersects(saveAction.GetRectangle())) { drawSaveTextBox = true; } if (mouseRect.Intersects(loadAction.GetRectangle())) { drawLoadTextBox = true; } previousMouseRect = mouseRect; } else if ((int)ClickTime.TotalMilliseconds <= 0) { ClickTime = new TimeSpan(0, 0, 0, 0, 200); previousMouseRect = mouseRect; } if (savingLevel) { SaveLevel(saveTextBox.GetText()); } }
public void Execute(Game1 game) { game.SwitchMode(); }