Exemplo n.º 1
0
        private PopupDialog GenerateDialog()
        {
            List <DialogGUIBase> guiItems = new List <DialogGUIBase>();

            if (EditorLogic.fetch == null || EditorLogic.fetch.ship == null)
            {
                guiItems.Add(new DialogGUILabel("No Vessel Detected"));
            }
            else
            {
                guiItems.Add(new DialogGUILabel(_utilities.SystemNotes, _utilities.CreateNoteStyle()));
                guiItems.Add(new DialogGUILabel(_utilities.Warnings, _utilities.CreateNoteStyle()));
                DialogGUIBase[] vertical   = new DialogGUIBase[_utilities.Planets.Count];
                DialogGUIBase[] horizontal = new DialogGUIBase[2];
                horizontal[0] = new DialogGUIToggle(() => _returnTrip, "Return Trip?", delegate { SetReturnTrip(); });
                horizontal[1] = new DialogGUIToggle(() => payloadOnly, "Payload Only", delegate { SetPayoadOnly(); });
                guiItems.Add(new DialogGUIHorizontalLayout(horizontal));
                for (int i = 0; i < _utilities.Planets.Count; i++)
                {
                    PlanetDeltaV p = _utilities.Planets.ElementAt(i);
                    horizontal    = new DialogGUIBase[4];
                    horizontal[0] = new DialogGUILabel(p.GetName(), _utilities.GenerateStyle(-1, false));
                    horizontal[1] = GetDeltaVString(p, "Flyby: ");
                    horizontal[2] = GetDeltaVString(p, "Orbiting: ");
                    if (p.IsHomeWorld && p.SynchronousDv != -1)
                    {
                        horizontal[3] = GetDeltaVString(p, "Synchronous Orbit: ");
                    }
                    else
                    {
                        horizontal[3] = GetDeltaVString(p, "Landing: ");
                    }
                    vertical[i] = new DialogGUIHorizontalLayout(horizontal);
                }
                DialogGUIVerticalLayout layout = new DialogGUIVerticalLayout(vertical);
                guiItems.Add(new DialogGUIScrollList(-Vector2.one, false, true, layout));
            }
            guiItems.Add(new DialogGUILabel("*Assuming craft has enough chutes"));
            guiItems.Add(new DialogGUIButton("Close", () => _utilities.CloseDialog(_uiDialog), false));
            return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
                                                new MultiOptionDialog("WhereCanIGoDialog", "", "Where Can I Go", UISkinManager.defaultSkin,
                                                                      _geometry,
                                                                      guiItems.ToArray()), false, UISkinManager.defaultSkin));
        }
Exemplo n.º 2
0
        private PopupDialog GenerateDialog()
        {
            List <DialogGUIBase> guiItems = new List <DialogGUIBase>();
            bool vesselIsHome             = FlightGlobals.ActiveVessel.mainBody == FlightGlobals.GetHomeBody();

            if (FlightGlobals.ActiveVessel == null)
            {
                guiItems.Add(new DialogGUILabel("No Vessel Detected"));
            }
            else if (vesselIsHome && FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING)
            {
                guiItems.Add(new DialogGUILabel(_utilities.SystemNotes, _utilities.CreateNoteStyle()));
                guiItems.Add(new DialogGUILabel(_utilities.Warnings, _utilities.CreateNoteStyle()));
                guiItems.Add(new DialogGUIToggle(() => _returnTrip, "Return Trip?", delegate { SetReturnTrip(); }));
                for (int i = 0; i < _utilities.Planets.Count; i++)
                {
                    PlanetDeltaV    p          = _utilities.Planets.ElementAt(i);
                    DialogGUIBase[] horizontal = new DialogGUIBase[4];
                    horizontal[0] = new DialogGUILabel(p.GetName(), _utilities.GenerateStyle(-1, false));
                    horizontal[1] = GetDeltaVString(p, "Flyby: ");
                    horizontal[2] = GetDeltaVString(p, "Orbiting: ");
                    if (p.IsHomeWorld && p.SynchronousDv != -1)
                    {
                        horizontal[3] = GetDeltaVString(p, "Synchronous Orbit: ");
                    }
                    else
                    {
                        horizontal[3] = GetDeltaVString(p, "Landing: ");
                    }
                    guiItems.Add(new DialogGUIHorizontalLayout(horizontal));
                }

                guiItems.Add(new DialogGUILabel("*Assuming craft has enough chutes"));
            }
            else
            {
                guiItems.Add(new DialogGUILabel("No Data Available. Achieve stable orbit around " + FlightGlobals.GetHomeBodyName(), _utilities.GenerateStyle(99999, true)));
            }
            guiItems.Add(new DialogGUIButton("Close", () => _utilities.CloseDialog(_uiDialog), false));
            return(PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
                                                new MultiOptionDialog("WhereCanIGoDialog", "", "Where Can I Go", UISkinManager.defaultSkin,
                                                                      _geometry,
                                                                      guiItems.ToArray()), false, UISkinManager.defaultSkin));
        }