Exemplo n.º 1
0
        public static void DrawActiveCelestialObjects(IScreenInfo screenInfo, TacticalEnvironment environment)
        {
            var activeObject = environment.GetActiveObject();

            if (activeObject is null)
            {
                return;
            }

            var pen = new Pen(Color.Gray);

            var spaceshipScreenLocation = UITools.ToScreenCoordinates(screenInfo, activeObject.GetLocation());

            screenInfo.GraphicSurface.DrawEllipse(pen, spaceshipScreenLocation.X - 20, spaceshipScreenLocation.Y - 20, 40, 40);

            var mouseScreenLocation = UITools.ToScreenCoordinates(screenInfo, environment.GetMouseCoordinates());

            var distance  = GeometryTools.Distance(spaceshipScreenLocation, mouseScreenLocation);
            var direction = GeometryTools.Azimuth(spaceshipScreenLocation, mouseScreenLocation);

            var destinationPoint = GeometryTools.MoveObject(mouseScreenLocation, distance - 20, direction);

            if (distance > 20)
            {
                screenInfo.GraphicSurface.DrawLine(pen, mouseScreenLocation.X, mouseScreenLocation.Y, destinationPoint.X, destinationPoint.Y);
            }
        }
Exemplo n.º 2
0
        private void RefreshControl()
        {
            txtTurn.Text = _environment.Session.Turn + "";
            txtMode.Text = _environment.Mode.ToString();

            var activeObject = _environment.GetActiveObject();

            txtActiveCelestialObjectID.Text = activeObject is null ? "N/A" : activeObject.Id.ToString();

            if (_environment.Session.IsPause)
            {
                if (cmdPauseResume.Text != MessageResume)
                {
                    cmdPauseResume.Text = MessageResume;
                }
            }
            else
            {
                if (cmdPauseResume.Text != MessagePause)
                {
                    cmdPauseResume.Text = MessagePause;
                }
            }

            if (_environment.Mode == TacticalMode.SelectingSpaceObjectWithActive)
            {
                var a = "";
            }
        }
Exemplo n.º 3
0
        private static void DrawSelectingTargetWithActive(IScreenInfo screenInfo, TacticalEnvironment environment)
        {
            var pen = new Pen(Color.DarkOliveGreen);

            var spaceshipScreenLocation = UITools.ToScreenCoordinates(screenInfo, environment.Session.GetPlayerSpaceShip().GetLocation());

            if (environment.GetActiveObject() is null)
            {
                return;
            }

            var mouseScreenLocation = UITools.ToScreenCoordinates(screenInfo, environment.GetActiveObject().GetLocation());

            var distance  = GeometryTools.Distance(spaceshipScreenLocation, mouseScreenLocation);
            var direction = GeometryTools.Azimuth(mouseScreenLocation, spaceshipScreenLocation);

            var destinationPoint = GeometryTools.MoveObject(spaceshipScreenLocation, distance - 15, direction);

            screenInfo.GraphicSurface.DrawLine(pen, spaceshipScreenLocation.X, spaceshipScreenLocation.Y, destinationPoint.X, destinationPoint.Y);

            screenInfo.GraphicSurface.DrawEllipse(pen, mouseScreenLocation.X - 15, mouseScreenLocation.Y - 15, 30, 30);
        }
Exemplo n.º 4
0
        private void RefreshControl()
        {
            var activeObject = _environment.GetActiveObject();

            if (activeObject is null)
            {
                txtCelestialObjectName.Text = @"There is no active object".ToUpper();
                containerData.Visible       = false;
                return;
            }

            if (activeObject is Spaceship)
            {
                FillControls(activeObject.ToSpaceship(), _environment.Session.GetPlayerSpaceShip());
            }

            containerData.Visible = true;
        }