예제 #1
0
        void displayLastFSDOrScoop(HistoryEntry he)
        {
            pictureBox.ClearImageList();

            lastHE = he;

            if (he != null)
            {
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = IsTransparent ? Color.Black : this.BackColor;

                ExtendedControls.PictureBoxHotspot.ImageElement edsm = pictureBox.AddTextFixedSizeC(new Point(5, 5), new Size(80, 20), "EDSM", displayfont, backcolour, textcolour, 0.5F, true, he, "View system on EDSM");
                edsm.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("EDSM", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), edsm.pos, true);

                ExtendedControls.PictureBoxHotspot.ImageElement start = pictureBox.AddTextFixedSizeC(new Point(5, 35), new Size(80, 20), "Start", displayfont, backcolour, textcolour, 0.5F, true, "Start", "Set a journey start point");
                start.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("Start", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), start.pos, true);

                backcolour = IsTransparent ? Color.Transparent : this.BackColor;

                EliteDangerousCalculations.FSDSpec.JumpInfo ji = he.GetJumpInfo();          // may be null

                String line = "  Target Not Set";

                if (TargetClass.GetTargetPosition(out string name, out Point3D tpos))
                {
                    double dist = he.System.Distance(tpos.X, tpos.Y, tpos.Z);

                    string mesg = "Left";

                    if (ji != null)
                    {
                        int jumps = (int)Math.Ceiling(dist / ji.avgsinglejump);
                        if (jumps > 0)
                        {
                            mesg = "@ " + jumps.ToString() + ((jumps == 1) ? " jump" : " jumps");
                        }
                    }

                    line = String.Format("{0} | {1:N2}ly {2}", name, dist, mesg);
                }

                line = String.Format("{0} [{1}] | {2}", he.System.Name, discoveryform.history.GetVisitsCount(he.System.Name), line);

                pictureBox.AddTextAutoSize(new Point(100, 5), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F);

                line = String.Format("{0:n}{1} @ {2} | {3} | ", he.TravelledDistance, ((he.TravelledMissingjump > 0) ? "ly (*)" : "ly"),
                                     he.Travelledjumps,
                                     he.TravelledSeconds);

                ExtendedControls.PictureBoxHotspot.ImageElement botlineleft = pictureBox.AddTextAutoSize(new Point(100, 35), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F);

                ShipInformation si = he.ShipInformation;
                if (si != null)
                {
                    double fuel                = si.FuelLevel;
                    double tanksize            = si.FuelCapacity;
                    double warninglevelpercent = si.FuelWarningPercent;

                    line = String.Format("{0}/{1}t", fuel.ToString("N1"), tanksize.ToString("N1"));

                    if (warninglevelpercent > 0 && fuel < tanksize * warninglevelpercent / 100.0)
                    {
                        textcolour = discoveryform.theme.TextBlockHighlightColor;
                        line      += String.Format(" < {0}%", warninglevelpercent.ToString("N1"));
                    }

                    if (ji != null)
                    {
                        HistoryEntry lastJet = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.JetConeBoost);
                        if (lastJet != null && lastJet.EventTimeLocal > lastHE.EventTimeLocal)
                        {
                            double jumpdistance = ji.avgsinglejump * (lastJet.journalEntry as EliteDangerousCore.JournalEvents.JournalJetConeBoost).BoostValue;
                            line += String.Format(" [{0:N1}ly @ BOOST]", jumpdistance);
                        }
                        else
                        {
                            line += String.Format(" [{0:N1}ly, {1:N1}ly / {2:N0}]", ji.avgsinglejump, ji.maxjumprange, ji.maxjumps);
                        }
                    }

                    pictureBox.AddTextAutoSize(new Point(botlineleft.pos.Right, 35), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F);
                }


                pictureBox.Render();
            }
        }
예제 #2
0
        void displayLastFSDOrScoop(HistoryEntry he)
        {
            pictureBox.ClearImageList();

            lastHE = he;

            if (he != null)
            {
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = IsTransparent ? Color.Black : this.BackColor;

                ExtendedControls.PictureBoxHotspot.ImageElement edsm = pictureBox.AddTextFixedSizeC(new Point(5, 5), new Size(80, 20), "EDSM", displayfont, backcolour, textcolour, 0.5F, true, he, "View system on EDSM");
                edsm.SetAlternateImage(ExtendedControls.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("EDSM", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), edsm.pos, true);

                ExtendedControls.PictureBoxHotspot.ImageElement start = pictureBox.AddTextFixedSizeC(new Point(5, 35), new Size(80, 20), "Start", displayfont, backcolour, textcolour, 0.5F, true, "Start", "Set a journey start point");
                start.SetAlternateImage(ExtendedControls.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("Start", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), start.pos, true);

                backcolour = IsTransparent ? Color.Transparent : this.BackColor;

                string  name;
                Point3D tpos;
                bool    targetpresent = TargetClass.GetTargetPosition(out name, out tpos);

                String topline = "  Route Not Set";

                if (targetpresent)
                {
                    double dist = he.System.Distance(tpos.X, tpos.Y, tpos.Z);

                    string mesg = "Left";
                    if (jumpRange > 0)
                    {
                        int jumps = (int)Math.Ceiling(dist / jumpRange);
                        if (jumps > 0)
                        {
                            mesg = "@ " + jumps.ToString() + ((jumps == 1) ? " jump" : " jumps");
                        }
                    }
                    topline = String.Format("{0} | {1:N2}ly {2}", name, dist, mesg);
                }

                topline = String.Format("{0} [{2}] | {1}", he.System.Name, topline, discoveryform.history.GetVisitsCount(he.System.Name));

                pictureBox.AddTextAutoSize(new Point(100, 5), new Size(1000, 40), topline, displayfont, textcolour, backcolour, 1.0F);

                string botline = "";

                botline += String.Format("{0:n}{1} @ {2} | {3} | ", he.TravelledDistance, ((he.TravelledMissingjump > 0) ? "ly (*)" : "ly"),
                                         he.Travelledjumps,
                                         he.TravelledSeconds);

                ExtendedControls.PictureBoxHotspot.ImageElement botlineleft = pictureBox.AddTextAutoSize(new Point(100, 35), new Size(1000, 40), botline, displayfont, textcolour, backcolour, 1.0F);


                double       fuel = 0.0;
                HistoryEntry fuelhe;


                switch (he.journalEntry.EventTypeID)
                {
                case JournalTypeEnum.FuelScoop:
                    fuel = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalFuelScoop).Total;
                    break;

                case JournalTypeEnum.FSDJump:
                    fuel = (he.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).FuelLevel;
                    break;

                case JournalTypeEnum.RefuelAll:
                    fuelhe = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.FSDJump ||
                                                                       x.journalEntry.EventTypeID == JournalTypeEnum.FuelScoop);
                    if (fuelhe.journalEntry.EventTypeID == EliteDangerousCore.JournalTypeEnum.FSDJump)
                    {
                        fuel = (fuelhe.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).FuelLevel;
                    }
                    else
                    {
                        fuel = (fuelhe.journalEntry as EliteDangerousCore.JournalEvents.JournalFuelScoop).Total;
                    }
                    fuel += (he.journalEntry as EliteDangerousCore.JournalEvents.JournalRefuelAll).Amount;
                    break;

                case JournalTypeEnum.RefuelPartial:
                    fuelhe = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.FSDJump ||
                                                                       x.journalEntry.EventTypeID == JournalTypeEnum.FuelScoop);
                    if (fuelhe.journalEntry.EventTypeID == EliteDangerousCore.JournalTypeEnum.FSDJump)
                    {
                        fuel = (fuelhe.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).FuelLevel;
                    }
                    else
                    {
                        fuel = (fuelhe.journalEntry as EliteDangerousCore.JournalEvents.JournalFuelScoop).Total;
                    }
                    fuel += (he.journalEntry as EliteDangerousCore.JournalEvents.JournalRefuelPartial).Amount;
                    break;

                //fuel += (he.journalEntry as EliteDangerous.JournalEvents.JournalRefuelAll).Amount;
                //case EliteDangerous.JournalTypeEnum.RefuelPartial:
                ////fuel += (he.journalEntry as EliteDangerous.JournalEvents.JournalRefuelPartial).Amount;
                default:
                    break;
                }
                fuel = Math.Floor(fuel * 100.0) / 100.0;
                if (tankSize == -1 || tankWarning == -1)
                {
                    botline = "Please set ships details";
                }
                else
                {
                    if (fuel > tankSize)
                    {
                        fuel = tankSize;
                    }
                    botline = String.Format("{0}t / {1}t", fuel.ToString("N1"), tankSize.ToString("N1"));

                    if ((fuel / tankSize) < (tankWarning / 100.0))
                    {
                        textcolour = discoveryform.theme.TextBlockHighlightColor;
                        botline   += String.Format(" < {0}%", tankWarning.ToString("N1"));
                    }
                }

                if (currentCargo >= 0 && linearConstant > 0 && unladenMass > 0 && optimalMass > 0 &&
                    powerConstant > 0 && maxFuelPerJump > 0)
                {
                    double maxJumps        = 0;
                    double maxJumpDistance = EliteDangerousCore.EliteDangerousCalculations.CalculateMaxJumpDistance(fuel,
                                                                                                                    currentCargo, linearConstant, unladenMass,
                                                                                                                    optimalMass, powerConstant,
                                                                                                                    maxFuelPerJump, out maxJumps);
                    double JumpRange = Math.Pow(maxFuelPerJump / (linearConstant * 0.001), 1 / powerConstant) * optimalMass / (currentCargo + unladenMass + fuel);

                    HistoryEntry lastJet = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.JetConeBoost);
                    if (lastJet != null && lastJet.EventTimeLocal > lastHE.EventTimeLocal)
                    {
                        JumpRange *= (lastJet.journalEntry as EliteDangerousCore.JournalEvents.JournalJetConeBoost).BoostValue;
                        botline   += String.Format(" [{0:N2}ly @ BOOST]", Math.Floor(JumpRange * 100) / 100);
                    }
                    else
                    {
                        botline += String.Format(" [{0:N2}ly @ {1:N2}ly / {2:N0}]",
                                                 Math.Floor(JumpRange * 100) / 100,
                                                 Math.Floor(maxJumpDistance * 100) / 100,
                                                 Math.Floor(maxJumps * 100) / 100);
                    }
                }
                pictureBox.AddTextAutoSize(new Point(botlineleft.pos.Right, 35), new Size(1000, 40), botline, displayfont, textcolour, backcolour, 1.0F);
                pictureBox.Render();
            }
        }
예제 #3
0
        void DrawHistoryEntry(HistoryEntry he, int rowpos, int rowheight, Point3D tpos, Color textcolour, Color backcolour)
        {
            List <string> coldata       = new List <string>();              // First we accumulate the strings
            List <int>    tooltipattach = new List <int>();

            if (Config(Configuration.showTime))
            {
                coldata.Add((EDDiscoveryForm.EDDConfig.DisplayUTC ? he.EventTimeUTC : he.EventTimeLocal).ToString("HH:mm.ss"));
            }

            if (Config(Configuration.showIcon))
            {
                coldata.Add("`!!ICON!!");                // dummy place holder..
            }
            if (Config(Configuration.showDescription))
            {
                tooltipattach.Add(coldata.Count);
                coldata.Add(he.EventSummary.Replace("\r\n", " "));
            }

            if (Config(Configuration.showInformation))
            {
                tooltipattach.Add(coldata.Count);
                coldata.Add(he.EventDescription.Replace("\r\n", " "));
            }

            if (layoutorder == 0 && Config(Configuration.showNotes))
            {
                coldata.Add((he.snc != null) ? he.snc.Note.Replace("\r\n", " ") : "");
            }

            bool showdistance = !Config(Configuration.showDistancesOnFSDJumpsOnly) || he.IsFSDJump;

            if (layoutorder == 2 && Config(Configuration.showDistancePerStar))
            {
                coldata.Add(showdistance ? DistToStar(he, tpos) : "");
            }

            if (Config(Configuration.showXYZ))
            {
                coldata.Add((he.System.HasCoordinate && showdistance) ? he.System.x.ToString("0.00") : "");
                coldata.Add((he.System.HasCoordinate && showdistance) ? he.System.y.ToString("0.00") : "");
                coldata.Add((he.System.HasCoordinate && showdistance) ? he.System.z.ToString("0.00") : "");
            }

            if (layoutorder > 0 && Config(Configuration.showNotes))
            {
                coldata.Add((he.snc != null) ? he.snc.Note.Replace("\r\n", " ") : "");
            }

            if (layoutorder < 2 && Config(Configuration.showDistancePerStar))
            {
                coldata.Add(showdistance ? DistToStar(he, tpos) : "");
            }

            int colnum = 0;

            if (Config(Configuration.showEDSMButton))
            {
                Color backtext = (backcolour.IsFullyTransparent()) ? Color.Black : backcolour;
                ExtendedControls.PictureBoxHotspot.ImageElement edsm = pictureBox.AddTextFixedSizeC(new Point(scanpostextoffset.X + columnpos[colnum++], rowpos), new Size(45, 14),
                                                                                                    "EDSM", displayfont, backtext, textcolour, 0.5F, true, he, "View system on EDSM");
                edsm.Translate(0, (rowheight - edsm.img.Height) / 2);          // align to centre of rowh..
                edsm.SetAlternateImage(ExtendedControls.ControlHelpers.DrawTextIntoFixedSizeBitmapC("EDSM", edsm.img.Size, displayfont, backtext, textcolour.Multiply(1.2F), 0.5F, true), edsm.pos, true);
            }

            string tooltip = he.EventSummary + Environment.NewLine + he.EventDescription + Environment.NewLine + he.EventDetailedInfo;

            for (int i = 0; i < coldata.Count; i++)             // then we draw them, allowing them to overfill columns if required
            {
                int nextfull = i + 1;
                for (; nextfull < coldata.Count && Config(Configuration.showExpandOverColumns) && coldata[nextfull].Length == 0; nextfull++)
                {
                }

                if (coldata[i].Equals("`!!ICON!!"))              // marker for ICON..
                {
                    Bitmap img = he.GetIcon;
                    ExtendedControls.PictureBoxHotspot.ImageElement e = pictureBox.AddImage(new Rectangle(scanpostextoffset.X + columnpos[colnum + i], rowpos, img.Width, img.Height), img, null, null, false);
                    e.Translate(0, (rowheight - e.img.Height) / 2);          // align to centre of rowh..
                }
                else
                {
                    AddColText(colnum + i, colnum + nextfull, rowpos, rowheight, coldata[i], textcolour, backcolour, tooltipattach.Contains(i) ? tooltip : null);
                }
            }
        }
예제 #4
0
        void DisplayState(HistoryEntry he, HistoryEntry lastfsd)
        {
            pictureBox.ClearImageList();

            lastHE  = he;
            lastFSD = lastfsd;

            if (he != null)
            {
                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = IsTransparent ? Color.Black : this.BackColor;

                int coltext = 5;

                if (showEDSMStartButtonsToolStripMenuItem.Checked)
                {
                    ExtendedControls.PictureBoxHotspot.ImageElement edsm = pictureBox.AddTextFixedSizeC(new Point(5, 5), new Size(80, 20), "EDSM", displayfont, backcolour, textcolour, 0.5F, true, he, "View system on EDSM");
                    edsm.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("EDSM", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), edsm.pos, true);

                    ExtendedControls.PictureBoxHotspot.ImageElement start = pictureBox.AddTextFixedSizeC(new Point(5, 35), new Size(80, 20), "Start", displayfont, backcolour, textcolour, 0.5F, true, "Start", "Set a journey start point");
                    start.SetAlternateImage(BaseUtils.BitMapHelpers.DrawTextIntoFixedSizeBitmapC("Start", edsm.img.Size, displayfont, backcolour, textcolour.Multiply(1.2F), 0.5F, true), start.pos, true);

                    coltext = 100;
                }

                backcolour = IsTransparent ? Color.Transparent : this.BackColor;

                EliteDangerousCalculations.FSDSpec.JumpInfo ji = he.GetJumpInfo();          // may be null

                string line = String.Format("{0} [{1}]", he.System.Name, discoveryform.history.GetVisitsCount(he.System.Name));

                if (showTargetToolStripMenuItem.Checked)
                {
                    if (TargetClass.GetTargetPosition(out string name, out Point3D tpos))
                    {
                        double dist = he.System.Distance(tpos.X, tpos.Y, tpos.Z);

                        string mesg = "Left";

                        if (ji != null)
                        {
                            int jumps = (int)Math.Ceiling(dist / ji.avgsinglejump);
                            if (jumps > 0)
                            {
                                mesg = jumps.ToString() + " " + ((jumps == 1) ? "jump".Tx(this) : "jumps".Tx(this));
                            }
                        }

                        line += String.Format("-> {0} {1:N1}ly {2}", name, dist, mesg);
                    }
                    else
                    {
                        line += " -> Target not set".Tx(this, "NoT");
                    }
                }

                bool firstdiscovery = (lastfsd != null && (lastfsd.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).EDSMFirstDiscover);

                int line1hpos = coltext;
                if (firstdiscovery)
                {
                    pictureBox.AddImage(new Rectangle(line1hpos, 5, 24, 24), Icons.Controls.firstdiscover, null, "Shows if EDSM indicates your it's first discoverer".Tx(this, "FDEDSM"), false);
                    line1hpos += 24;
                }

                pictureBox.AddTextAutoSize(new Point(line1hpos, 5), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F);

                line = "";

                if (showTravelledDistanceToolStripMenuItem.Checked)
                {
                    line = String.Format("{0:N1}{1},{2} " + "jumps".Tx(this) + ", {3}", he.TravelledDistance, ((he.TravelledMissingjump > 0) ? "ly*" : "ly"),
                                         he.Travelledjumps,
                                         he.TravelledSeconds);
                }

                ShipInformation si = he.ShipInformation;

                if (si != null)
                {
                    string addtext = "";

                    if (showFuelLevelToolStripMenuItem.Checked)
                    {
                        double fuel                = si.FuelLevel;
                        double tanksize            = si.FuelCapacity;
                        double warninglevelpercent = si.FuelWarningPercent;

                        addtext = String.Format("{0}/{1}t", fuel.ToString("N1"), tanksize.ToString("N1"));

                        if (warninglevelpercent > 0 && fuel < tanksize * warninglevelpercent / 100.0)
                        {
                            textcolour = discoveryform.theme.TextBlockHighlightColor;
                            addtext   += String.Format(" < {0}%", warninglevelpercent.ToString("N1"));
                        }
                    }

                    if (ji != null)
                    {
                        HistoryEntry lastJet = discoveryform.history.GetLastHistoryEntry(x => x.journalEntry.EventTypeID == JournalTypeEnum.JetConeBoost);

                        double boostval = 1;

                        if (lastJet != null && lastfsd != null && lastJet.EventTimeLocal > lastfsd.EventTimeLocal)
                        {
                            boostval = (lastJet.journalEntry as EliteDangerousCore.JournalEvents.JournalJetConeBoost).BoostValue;
                        }

                        string range = "";
                        if (showCurrentFSDRangeToolStripMenuItem.Checked)
                        {
                            range += String.Format("cur {0:N1}ly{1}", ji.cursinglejump * boostval, boostval > 1 ? " Boost" : "");
                        }
                        if (showAvgFSDRangeToolStripMenuItem.Checked)
                        {
                            range = range.AppendPrePad(String.Format("avg {0:N1}ly{1}", ji.avgsinglejump * boostval, boostval > 1 ? " Boost" : ""), ", ");
                        }
                        if (showMaxFSDRangeToolStripMenuItem.Checked)
                        {
                            range = range.AppendPrePad(String.Format("max {0:N1}ly{1}", ji.curfumessinglejump * boostval, boostval > 1 ? " Boost" : ""), ", ");
                        }
                        if (showFSDRangeToolStripMenuItem.Checked)
                        {
                            range = range.AppendPrePad(String.Format("{0:N1}ly/{1:N0}", ji.maxjumprange, ji.maxjumps), ", ");
                        }

                        if (range.HasChars())
                        {
                            addtext = addtext.AppendPrePad(range, " | ");
                        }
                    }

                    if (addtext.HasChars())
                    {
                        line = line.AppendPrePad(addtext, " | ");
                    }
                }

                if (line.HasChars())
                {
                    pictureBox.AddTextAutoSize(new Point(coltext, 35), new Size(1000, 40), line, displayfont, textcolour, backcolour, 1.0F);
                }

                pictureBox.Render();
            }
        }