public override void MouseDown(MouseState mouseState) { buttonClickedNum = GetButtonNum(mouseState.X, mouseState.Y); //Controls are switched on mouse down, not on click WindowCon.ChangeViewScreenWindow(buttonClickedNum); }
public override void MouseClick(MouseState mouseState) { Rectangle clickRect; switch (currentDisplay) { case GameOptions.DisplayMode.blankView: break; case GameOptions.DisplayMode.galaxyView: //Did they click a star system clickRect = galaxyIcons.getIconRectangle(0, 0); foreach (StarSystem s in currentGalaxy.systems) { //Check to see if in current viewing window. if (galaxyViewWindow.Contains(s.XCoord, s.YCoord)) { //switch mousecoords to window coords Vector2 mouseClickPos = new Vector2(galaxyViewWindow.X + mouseState.X, galaxyViewWindow.Y + mouseState.Y); clickRect.Location = new Point(s.XCoord, s.YCoord); if (clickRect.Contains(mouseClickPos)) { if (selectedSystem != null) { selectedSystem.Selected = false; } s.Selected = true; selectedSystem = s; //Display SelectedStar selectedPlanet = null; WindowCon.ChangeDetailListMode(GameOptions.DetailMode.starInfo); WindowCon.ChangeDetailStar(selectedSystem); } } } break; case GameOptions.DisplayMode.systemView: //Did they click a planet? clickRect = galaxyIcons.getIconRectangle(0, 0); int i = 0; bool planetClicked = false; foreach (Vector2 v in planetCoords) { clickRect.Location = v.ToPoint(); if (clickRect.Contains(mouseState.Position)) { selectedPlanet = selectedSystem.planets[i]; WindowCon.ChangeDetailListMode(GameOptions.DetailMode.planetInfo); WindowCon.ChangeDetailSystem(selectedPlanet); planetClicked = true; } i++; } if (!planetClicked) { selectedPlanet = null; WindowCon.ChangeDetailListMode(GameOptions.DetailMode.starInfo); } break; case GameOptions.DisplayMode.baseView: break; case GameOptions.DisplayMode.scienceView: break; case GameOptions.DisplayMode.personnelView: break; } }