static void vessels_list(HangarStorage storage, ref Vector2 scroll, ref PackedVessel selected, bool is_lhs = true) { if (storage == null) { return; } scroll = GUILayout.BeginScrollView(scroll, GUILayout.Height(scroll_height), GUILayout.Width(scroll_width)); GUILayout.BeginVertical(); List <PackedVessel> vessels = storage.GetVessels(); vessels.Sort((a, b) => a.name.CompareTo(b.name)); foreach (var v in vessels) { GUILayout.BeginHorizontal(); if (is_lhs) { HangarGUI.PackedVesselLabel(v); } if (GUILayout.Button(is_lhs? ">>" : "<<", Styles.normal_button, GUILayout.ExpandWidth(true))) { selected = v; } if (!is_lhs) { HangarGUI.PackedVesselLabel(v); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); }
void TransferWindow(int windowId) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); //lhs parts_list(ref lhs_parts_scroll, ref lhs); if (lhs != null) { HangarGUI.UsedVolumeLabel(lhs.UsedVolume, lhs.UsedVolumeFrac); vessels_list(lhs, ref lhs_vessels_scroll, ref lhs_selected); } GUILayout.EndVertical(); //rhs GUILayout.BeginVertical(); parts_list(ref rhs_parts_scroll, ref rhs, false); if (rhs != null) { HangarGUI.UsedVolumeLabel(rhs.UsedVolume, rhs.UsedVolumeFrac); vessels_list(rhs, ref rhs_vessels_scroll, ref rhs_selected, false); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", Styles.close_button, GUILayout.ExpandWidth(true))) { Show(false); } GUILayout.EndVertical(); TooltipsAndDragWindow(); }
void HangarInfo() { GUILayout.BeginVertical(Styles.white); GUILayout.Label("Volume: " + Utils.formatVolume(selected_hangar.Volume), GUILayout.ExpandWidth(true)); GUILayout.Label("Dock Size: " + Utils.formatDimensions(selected_hangar.DockSize), GUILayout.ExpandWidth(true)); GUILayout.Label("Vessels Docked: " + selected_hangar.VesselsDocked, GUILayout.ExpandWidth(true)); HangarGUI.UsedVolumeLabel(selected_hangar.UsedVolume, selected_hangar.UsedVolumeFrac); GUILayout.EndVertical(); }
void StorageInfo() { if (selected_hangar.ConnectedStorage.Count < 2) { return; } GUILayout.BeginVertical(Styles.white); GUILayout.Label("Total Vessels Docked: " + selected_hangar.TotalVesselsDocked, GUILayout.ExpandWidth(true)); GUILayout.Label("Total Storage Volume: " + Utils.formatVolume(selected_hangar.TotalVolume), GUILayout.ExpandWidth(true)); if (GUILayout.Toggle(highlight_storage == HighlightState.Enable, "Highlight Storage Parts")) { highlight_storage = HighlightState.Enable; } else if (highlight_storage == HighlightState.Enable) { highlight_storage = HighlightState.Disable; } HangarGUI.UsedVolumeLabel(selected_hangar.TotalUsedVolume, selected_hangar.TotalUsedVolumeFrac, "Total Used Volume"); GUILayout.EndVertical(); }
void highlight_parts() { if (selected_hangar != null) { //first highlight storage if (selected_hangar.ConnectedStorage.Count > 1) { if (doShow && highlight_storage == HighlightState.Enable) { foreach (var s in selected_hangar.ConnectedStorage) { s.part.SetHighlightColor(HangarGUI.UsedVolumeColor(s)); s.part.SetHighlight(true, false); } } else if (highlight_storage == HighlightState.Disable) { foreach (var s in selected_hangar.ConnectedStorage) { s.part.SetHighlightDefault(); } highlight_storage = HighlightState.None; } } //then highlight hangar if (doShow && highlight_hangar == HighlightState.Enable) { selected_hangar.part.SetHighlightColor(XKCDColors.LightSeaGreen); selected_hangar.part.SetHighlight(true, false); } else if (highlight_hangar == HighlightState.Disable) { selected_hangar.part.SetHighlightDefault(); highlight_hangar = HighlightState.None; } } }
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(); }