Beispiel #1
0
        /// <Summary>
        /// Set the content of the Summary control. Depending on the type of the Item
        /// selected this may either be a planet (in which case the planet Summary
        /// control is displayed) or a fleet (which will cause the fleet Summary control
        /// to be displayed).
        /// </Summary>
        /// <param name="Item">The <see cref="Item"/> to display (a <see cref="Fleet"/> or <see cref="Star"/>).</param>
        private void SetItem(Mappable item)
        {
            if (item == null)
            {
                this.summaryFrame.Text = "Nothing Selected";
                FleetSummary.Hide();
                PlanetSummary.Hide();
                Invalidate();
                return;
            }

            if (item is FleetIntel || item is Fleet)
            {
                FleetIntel report = null;
                empireState.FleetReports.TryGetValue(item.Key, out report);
                if (report != null)
                {
                    DisplayFleet(report);
                }
                else
                {
                    SetItem(null);
                }
            }
            else
            {
                DisplayPlanet(empireState.StarReports[item.Name]);
            }
        }
Beispiel #2
0
        private void SendFleet(FleetIntel target, Fleet fleet, IWaypointTask task)
        {
            Waypoint w = new Waypoint();

            w.Position    = target.Position;
            w.Destination = target.Name;
            w.Task        = task;

            WaypointCommand command = new WaypointCommand(CommandMode.Add, w, fleet.Key);

            command.ApplyToState(clientState.EmpireState);
            clientState.Commands.Push(command);
        }
Beispiel #3
0
        /// <Summary>
        /// Display a fleet Summary
        /// </Summary>
        /// <param name="Item">The <see cref="Item"/> to display (a <see cref="Fleet"/> or <see cref="Star"/>).</param>
        private void DisplayFleet(FleetIntel report)
        {
            if (summaryItem is StarIntel || summaryItem == null)
            {
                FleetSummary.Show();
                PlanetSummary.Hide();
                Invalidate();
            }

            summaryItem            = report;
            this.summaryFrame.Text = "Summary of " + report.Name;
            FleetSummary.Location  = new Point(5, 15);
            FleetSummary.Value     = report;
        }
Beispiel #4
0
        /// ----------------------------------------------------------------------------
        /// <Summary>
        /// Display the fleet Summary
        /// </Summary>
        /// <param name="fleet">The <see cref="Fleet"/> to display.</param>
        /// ----------------------------------------------------------------------------
        private void DisplaySummary(FleetIntel report)
        {
            ushort ownerId = report.Owner;

            fleetShipCount.Text = report.Count.ToString(System.Globalization.CultureInfo.InvariantCulture);
            fleetMass.Text      = report.Mass.ToString(System.Globalization.CultureInfo.InvariantCulture);
            fleetSpeed.Text     = report.Speed.ToString(System.Globalization.CultureInfo.InvariantCulture);
            fleetImage.Image    = report.Icon.Image;

            if (ownerId != empireState.Id)
            {
                raceIcon.Image  = empireState.EmpireReports[ownerId].Icon.Image;
                fleetOwner.Text = empireState.EmpireReports[ownerId].RaceName;
            }
            else
            {
                raceIcon.Image  = empireState.Race.Icon.Image;
                fleetOwner.Text = empireState.Race.Name;
            }
        }
Beispiel #5
0
        /// <Summary>
        /// Draw a fleet. We only draw fleets that are not in orbit. Indications of
        /// orbiting fleets are handled in the drawing of the Star.
        /// </Summary>
        /// <param name="fleet">The fleet to draw.</param>
        private void DrawFleet(Graphics g, FleetIntel report)
        {
            if (report.InOrbit == false)
            {
                NovaPoint position = LogicalToDevice(report.Position);

                g.TranslateTransform(position.X, position.Y);
                g.RotateTransform((float)report.Bearing);

                if (report.Owner == clientState.EmpireState.Id)
                {
                    g.FillPolygon(Brushes.Blue, triangle);
                }
                else
                {
                    g.FillPolygon(Brushes.Red, triangle);
                }

                g.ResetTransform();
            }

            if (report.Owner == clientState.EmpireState.Id)
            {
                Fleet fleet = clientState.EmpireState.OwnedFleets[report.Key];

                Waypoint  first = fleet.Waypoints[0];
                NovaPoint from  = LogicalToDevice(first.Position);

                foreach (Waypoint waypoint in fleet.Waypoints)
                {
                    NovaPoint position = waypoint.Position;

                    g.DrawLine(Pens.Blue, (Point)from, (Point)LogicalToDevice(position));
                    from = LogicalToDevice(position);
                }
            }
        }