void main_window(int WindowID)
 {
     GUILayout.BeginVertical();
     vessels_scroll = GUILayout.BeginScrollView(vessels_scroll, Styles.white);
     foreach (var vsl in FlightGlobals.VesselsLoaded)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label(vsl.vesselName, Styles.white, GUILayout.ExpandWidth(true));
         if (GUILayout.Button("Convert", Styles.danger_button, GUILayout.ExpandWidth(false)))
         {
             if (to_convert == null)
             {
                 to_convert      = vsl;
                 warning.Message = string.Format(
                     "This will convert '{0}' resource into '{1}' by mass in every part that contains it.\n" +
                     "<color=red><b>This cannot be undone!</b></color>\n" +
                     "It is best that you <b>save the game</b> before doing this.\n" +
                     "Are you sure you wish to continue?",
                     old_res.name, Globals.Instance.ConstructionResource.name);
                 warning.Show(true);
             }
         }
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
     if (GUILayout.Button("Close", Styles.close_button, GUILayout.ExpandWidth(true)))
     {
         show_window = false;
     }
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
 protected virtual void main_window(int WindowID)
 {
     GUILayout.BeginVertical();
     draw_panes();
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
Example #3
0
    public static GUIWindowBase Create(GameObject origin, Transform parent)
    {
        GUIWindowBase window = Instantiate(origin).GetComponent <GUIWindowBase> ();

        window.transform.SetParent(parent, false);
        GUIManager.AddWindow(window);
        return(window);
    }
 protected virtual void main_window(int WindowID)
 {
     GUILayout.BeginVertical();
     draw_panes();
     if (GUILayout.Button("Close", Styles.close_button, GUILayout.ExpandWidth(true)))
     {
         show_window = false;
     }
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
Example #5
0
    public void Initialize()
    {
        menu = GUIWindowBase.Create(menuPrefab, transform.parent) as EmplacementMenuGUI;

        menu.parentButton       = this;
        menu.emplacement        = emplacement;
        menu.transform.position = transform.position;
        menu.Init();

        menu.Close();
    }
        private void Menu_OnClosed(GUIWindowBase e)
        {
            Input.IsCursorLocked           = true;
            Input.IsCursorVisible          = false;
            Camera.Active.AllowUserControl = true;
            Camera.Active.HoldM2ToLook     = false;
            Camera.Active.SmoothCamera     = false;

            if (world.Player != null)
            {
                world.Player.AllowUserInput = true;
            }
        }
 public void TanksControlGUI(int windowId)
 {
     GUILayout.BeginVertical();
     tanks_scroll = GUILayout.BeginScrollView(tanks_scroll,
                                              GUILayout.Width(scroll_width),
                                              GUILayout.Height(scroll_height));
     GUILayout.BeginVertical();
     tanks.ForEach(t => t.ControlGUI());
     GUILayout.EndVertical();
     GUILayout.EndScrollView();
     close_button();
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
 public void TanksManagerGUI(int windowId)
 {
     GUILayout.BeginVertical();
     add_tank_gui();
     tanks_scroll = GUILayout.BeginScrollView(tanks_scroll,
                                              GUILayout.Width(scroll_width),
                                              GUILayout.Height(scroll_height));
     GUILayout.BeginVertical();
     tanks.ForEach(t => t.ManageGUI());
     GUILayout.EndVertical();
     GUILayout.EndScrollView();
     volume_configs_gui();
     close_button();
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
Example #9
0
 void drawGlobalsUI(int windowID)
 {
     GUILayout.BeginVertical();
     if (GUILayout.Button(show? "Hide" : "Show", Styles.active_button, GUILayout.ExpandWidth(true)))
     {
         show = !show;
     }
     if (show)
     {
         Globals.Instance.UI.Draw();
         if (GUILayout.Button("Save", Styles.danger_button, GUILayout.ExpandWidth(true)))
         {
             Globals.Instance.CreateDefaultOverride();
         }
     }
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
 void draw_orbit_editor(int windowID)
 {
     ORB.DrawOrbitEditor();
     GUIWindowBase.TooltipsAndDragWindow();
 }
Example #11
0
 void main_window(int WindowID)
 {
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     if (CelestialBodies.Count > 0)
     {
         GUILayout.BeginVertical();
         cb_scroll = GUILayout.BeginScrollView(cb_scroll, GUILayout.Height(height), GUILayout.Width(cb_width + 10));
         foreach (var cb in CelestialBodies)
         {
             if (GUILayout.Button(new GUIContent(cb, "Show workshops on " + cb),
                                  CelestialBodyTab == cb? Styles.enabled : Styles.active,
                                  GUILayout.Width(cb_width)))
             {
                 CelestialBodyTab = cb;
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndVertical();
         GUILayout.BeginVertical(Styles.white);
         workshops_scroll = GUILayout.BeginScrollView(workshops_scroll, GUILayout.Height(height), GUILayout.Width(workshops_width));
         foreach (var item in DisplayOrder.Values)
         {
             var info = Workshops[item];
             if (info.CB != CelestialBodyTab)
             {
                 continue;
             }
             GUILayout.BeginHorizontal();
             info.Draw();
             if (info.IsActive)
             {
                 GUILayout.Label(new GUIContent("◉", "This is the active vessel"),
                                 Styles.inactive, GUILayout.ExpandWidth(false));
             }
             else if (GUILayout.Button(new GUIContent("◉", "Switch to this workshop"),
                                       Styles.enabled_button, GUILayout.ExpandWidth(false)))
             {
                 switchto = info;
             }
             GUILayout.EndHorizontal();
         }
         GUILayout.EndScrollView();
         GUILayout.EndVertical();
     }
     else
     {
         GUILayout.Label("No Operational Workshops", Styles.white, GUILayout.ExpandWidth(true));
     }
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     Utils.ButtonSwitch("Show Deploy Hints", ref ShowDeployHint,
                        "Draw visual cues to help position a DIY Kit",
                        GUILayout.ExpandWidth(false));
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Close", Styles.close_button, GUILayout.ExpandWidth(false)))
     {
         show_window = false;
     }
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
     GUIWindowBase.TooltipsAndDragWindow();
 }
Example #12
0
        void waypoint_editor(int windowID)
        {
            var close = false;

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Name:", GUILayout.Width(70));
            edited_waypoint_name = GUILayout.TextField(edited_waypoint_name, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Latitude:", GUILayout.Width(70));
            LatField.Draw("°", 1, "F1");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Longitude:", GUILayout.Width(70));
            LonField.Draw("°", 1, "F1");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Altitude:", GUILayout.Width(70));
            AltField.Draw("°", 100, "F0");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Delete", Styles.danger_button))
            {
                CFG.Path.Remove(edited_waypoint);
                close = true;
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Cancel", Styles.active_button))
            {
                close = true;
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(new GUIContent("◉", "Target this waypoint"), Styles.enabled_button))
            {
                VSL.SetTarget(null, edited_waypoint);
            }
            if (GUILayout.Button(new GUIContent("⊥", "Set altitude to ground level"), Styles.active_button))
            {
                edited_waypoint.Pos.SetAlt2Surface(VSL.Body);
                AltField.Value = (float)edited_waypoint.Pos.Alt;
            }
            if (Utils.ButtonSwitch("||", edited_waypoint.Pause, "Pause on arrival", GUILayout.Width(25)))
            {
                edited_waypoint.Pause = !edited_waypoint.Pause;
            }
            if (LND != null &&
                Utils.ButtonSwitch("Land", edited_waypoint.Land, "Land on arrival"))
            {
                edited_waypoint.Land = !edited_waypoint.Land;
            }
            if (GUILayout.Button("Apply", Styles.confirm_button))
            {
                LatField.UpdateValue(); LonField.UpdateValue(); AltField.UpdateValue();
                edited_waypoint.Name    = edited_waypoint_name;
                edited_waypoint.Pos.Lat = Utils.ClampAngle(LatField.Value);
                edited_waypoint.Pos.Lon = Utils.ClampAngle(LonField.Value);
                edited_waypoint.Pos.Alt = Math.Max(AltField.Value,
                                                   edited_waypoint.Pos.SurfaceAlt(vessel.mainBody));
                edited_waypoint.Update(VSL);
                close = true;
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUIWindowBase.TooltipsAndDragWindow();
            if (close)
            {
                edited_waypoint = null;
            }
        }
 private void Menu_OnClosed(GUIWindowBase e)
 {
     // Re-enable user input when the menu closes
     ToggleFPSUserInput(true);
 }
        void hangar_content_editor(int windowID)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            //Vessel selector
            if (GUILayout.Button("Select Vessel", Styles.normal_button, GUILayout.ExpandWidth(true)))
            {
                construct_loader.SelectVessel();
            }
            if (GUILayout.Button("Select Subassembly", Styles.normal_button, GUILayout.ExpandWidth(true)))
            {
                construct_loader.SelectSubassembly();
            }
            if (GUILayout.Button("Select Part", Styles.normal_button, GUILayout.ExpandWidth(true)))
            {
                construct_loader.SelectPart(part.flagURL);
            }
            GUILayout.EndHorizontal();
            //hangar info
            if (ConnectedStorage.Count > 1)
            {
                HangarGUI.UsedVolumeLabel(TotalUsedVolume, TotalUsedVolumeFrac, "Total Used Volume");
            }
            HangarGUI.UsedVolumeLabel(UsedVolume, UsedVolumeFrac);
            //hangar contents
            if (highlighted_content != null)
            {
                DrawSpawnRotationControls(highlighted_content);
            }
            var vessels = Storage.GetVessels();

            vessels.Sort((a, b) => string.Compare(a.name, b.name, System.StringComparison.CurrentCulture));
            constructs_scroll = GUILayout.BeginScrollView(constructs_scroll, GUILayout.Height(200), GUILayout.Width(window_width));
            GUILayout.BeginVertical();
            foreach (PackedVessel pv in vessels)
            {
                GUILayout.BeginHorizontal();
                if (HangarGUI.PackedVesselLabel(pv, pv == highlighted_content ? Styles.white : Styles.label))
                {
                    if (highlighted_content != pv)
                    {
                        SetHighlightedContent(pv, ContentState.Fits);
                    }
                    else
                    {
                        SetHighlightedContent(null);
                    }
                }
                if (GUILayout.Button("+1", Styles.open_button, GUILayout.Width(25)))
                {
                    if (pv is PackedConstruct pc)
                    {
                        try_store_packed_vessel(pc.Clone(), false);
                    }
                }
                if (GUILayout.Button("X", Styles.danger_button, GUILayout.Width(25)))
                {
                    Storage.RemoveVessel(pv);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
            //unfit constructs
            var constructs = Storage.UnfitConstucts;

            if (constructs.Count > 0)
            {
                GUILayout.Label("Unfit vessels:", Styles.active, GUILayout.ExpandWidth(true));
                unfit_scroll = GUILayout.BeginScrollView(unfit_scroll, GUILayout.Height(100), GUILayout.Width(window_width));
                GUILayout.BeginVertical();
                foreach (PackedConstruct pc in Storage.UnfitConstucts)
                {
                    GUILayout.BeginHorizontal();
                    if (HangarGUI.PackedVesselLabel(pc, pc == highlighted_content ? Styles.white : Styles.label))
                    {
                        if (highlighted_content != pc)
                        {
                            SetHighlightedContent(pc, ContentState.DoesntFit);
                        }
                        else
                        {
                            SetHighlightedContent(null);
                        }
                    }
                    if (GUILayout.Button("^", Styles.open_button, GUILayout.Width(25)))
                    {
                        if (try_store_packed_vessel(pc.Clone(), false))
                        {
                            Storage.RemoveUnfit(pc);
                        }
                    }
                    if (GUILayout.Button("X", Styles.danger_button, GUILayout.Width(25)))
                    {
                        Storage.RemoveUnfit(pc);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
                GUILayout.EndScrollView();
            }
            //common buttons
            if (GUILayout.Button("Clear", Styles.danger_button, GUILayout.ExpandWidth(true)))
            {
                Storage.ClearVessels();
            }
            if (GUILayout.Button("Close", Styles.normal_button, GUILayout.ExpandWidth(true)))
            {
                Utils.LockControls(eLock, false);
                SetHighlightedContent(null);
                editing_content = false;
            }
            GUILayout.EndVertical();
            GUIWindowBase.TooltipsAndDragWindow();
        }
Example #15
0
 public static void RemoveWindow(GUIWindowBase window)
 {
     manager.allWindows.Remove(window);
 }
Example #16
0
 public static void AddWindow(GUIWindowBase window)
 {
     manager.allWindows.Add(window);
 }