public static void DrawActiveModule(Graphics graphics, CelestialObjectTypes activeModule, PointF mousePosition, GameSession gameSession, SortedDictionary <int, GranularObjectInformation> granularTurnInformation, int turnStep, ScreenParameters screenParameters) { var playerSpaceship = gameSession.GetPlayerSpaceShip(); var screenCoordinates = UI.ToScreenCoordinates(screenParameters, new PointF(playerSpaceship.PositionX, playerSpaceship.PositionY)); var mouseCoordinatesInternal = OutlandAreaCommon.Tools.ToRelativeCoordinates(mousePosition, screenParameters.Center); var mouseMapCoordinates = OutlandAreaCommon.Tools.ToTacticalMapCoordinates(mouseCoordinatesInternal, screenParameters.CenterScreenOnMap); switch (activeModule) { case CelestialObjectTypes.PointInMap: break; case CelestialObjectTypes.Missile: var radarLinePen = new Pen(Color.FromArgb(60, 60, 60), 1); graphics.DrawLine(radarLinePen, screenCoordinates.X, screenCoordinates.Y, mousePosition.X, mousePosition.Y); var missile = new Missile { PositionY = mouseMapCoordinates.Y, PositionX = mouseMapCoordinates.X }; DrawTacticalMap.DrawPreTarget(missile, graphics, screenParameters); break; case CelestialObjectTypes.SpaceshipPlayer: break; case CelestialObjectTypes.SpaceshipNpcNeutral: break; case CelestialObjectTypes.SpaceshipNpcEnemy: break; case CelestialObjectTypes.SpaceshipNpcFriend: break; case CelestialObjectTypes.Asteroid: break; case CelestialObjectTypes.None: break; default: throw new ArgumentOutOfRangeException(); } }
public void ExecuteModule(IModule module, ICelestialObject celestialObject) { _activeCelestialObject = celestialObject; _activeModule = (CelestialObjectTypes)celestialObject.Classification; }
public static int ToInt(this CelestialObjectTypes command) { return((int)command); }
private void MapClick(object sender, MouseEventArgs e) { var mouseScreenCoordinates = OutlandAreaCommon.Tools.ToRelativeCoordinates(e.Location, _screenParameters.Center); var mouseMapCoordinates = OutlandAreaCommon.Tools.ToTacticalMapCoordinates(mouseScreenCoordinates, _screenParameters.CenterScreenOnMap); var celestialObjectInRange = SessionTools.GetObjectInRange(_gameSession, 15, new PointF(mouseMapCoordinates.X, mouseMapCoordinates.Y)); switch (_activeModule) { case CelestialObjectTypes.PointInMap: break; case CelestialObjectTypes.Missile: if (e.Button == MouseButtons.Right) { _activeModule = CelestialObjectTypes.None; return; } if (e.Button == MouseButtons.Left) { _activeCelestialObject.PositionX = mouseMapCoordinates.X; _activeCelestialObject.PositionY = mouseMapCoordinates.Y; _activeModule = CelestialObjectTypes.None; OnLaunchMissile?.Invoke(_activeCelestialObject); return; } break; case CelestialObjectTypes.SpaceshipPlayer: break; case CelestialObjectTypes.SpaceshipNpcNeutral: break; case CelestialObjectTypes.SpaceshipNpcEnemy: break; case CelestialObjectTypes.SpaceshipNpcFriend: break; case CelestialObjectTypes.Asteroid: break; case CelestialObjectTypes.None: _connectorsShow = new List <ICelestialObject>(); break; } Logger.Info(TraceMessage.Execute(this, $"MapClick")); //if (e.Button == MouseButtons.Right) //{ // AlignToCommand(null, e); // return; //} if (celestialObjectInRange != null) { Global.Game.SelectCelestialObject(celestialObjectInRange); } else { // Movement by mouse click //Global.Game.SelectPointInSpace(mouseMapCoordinates); } //pointInSpace = mouseMapCoordinates; }