/// <summary> /// Draws the available readouts panel. /// </summary> private void DrawAvailableReadouts() { GUI.skin = HighLogic.Skin; this.scrollPositionAvailable = GUILayout.BeginScrollView(this.scrollPositionAvailable, false, true, GUILayout.Height(200.0f)); GUI.skin = null; GUILayout.Label("AVAILABLE", this.panelTitleStyle); foreach (var readout in ReadoutLibrary.GetCategory(ReadoutCategory.Selected)) { if (!this.ParentSection.ReadoutModules.Contains(readout) || readout.Cloneable) { GUILayout.BeginHorizontal(GUILayout.Height(30.0f)); GUILayout.Label(readout.Name, this.readoutNameStyle); readout.ShowHelp = GUILayout.Toggle(readout.ShowHelp, "?", this.readoutButtonStyle, GUILayout.Width(30.0f)); if (GUILayout.Button("INSTALL", this.readoutButtonStyle, GUILayout.Width(75.0f))) { this.ParentSection.ReadoutModules.Add(readout); } GUILayout.EndHorizontal(); this.ShowHelpMessage(readout); } } GUILayout.EndScrollView(); }
/// <summary> /// Sets up and populates the library with the stock sections on creation. /// </summary> static SectionLibrary() { StockSections = new List <SectionModule>(); CustomSections = new List <SectionModule>(); StockSections.Add(new SectionModule { Name = "ORBITAL", Abbreviation = "ORBT", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Orbital")).Where(r => r.IsDefault).ToList() }); StockSections.Add(new SectionModule { Name = "SURFACE", Abbreviation = "SURF", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Surface")).Where(r => r.IsDefault).ToList() }); StockSections.Add(new SectionModule { Name = "VESSEL", Abbreviation = "VESL", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Vessel")).Where(r => r.IsDefault).ToList() }); StockSections.Add(new SectionModule { Name = "RENDEZVOUS", Abbreviation = "RDZV", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Rendezvous")).Where(r => r.IsDefault).ToList() }); TrackingStationSection = new SectionModuleTS { Name = "TRACKING", Abbreviation = "TRCK", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Rendezvous")).Where(r => r.IsDefault).ToList(), IsVisible = true, showFloatButton = false }; CustomSections.Add(new SectionModule { Name = "THERMAL", Abbreviation = "HEAT", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Thermal")).Where(r => r.IsDefault).ToList(), IsCustom = true }); CustomSections.Add(new SectionModule { Name = "BODY", Abbreviation = "BODY", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Body")).Where(r => r.IsDefault).ToList(), IsCustom = true }); SectionModule hud1 = new SectionModule { Name = "HUD 1", Abbreviation = "HUD 1", IsCustom = true, IsVisible = true, ReadoutModules = new List <ReadoutModule> { ReadoutLibrary.GetReadout("ApoapsisHeight"), ReadoutLibrary.GetReadout("TimeToApoapsis"), ReadoutLibrary.GetReadout("PeriapsisHeight"), ReadoutLibrary.GetReadout("TimeToPeriapsis") }, }; hud1.FloatingPositionX = Screen.width * 0.25f - (hud1.ReadoutModules.First().ContentWidth * 0.5f); hud1.FloatingPositionY = 0.0f; hud1.IsHud = true; CustomSections.Add(hud1); SectionModule hud2 = new SectionModule { Name = "HUD 2", Abbreviation = "HUD 2", IsCustom = true, IsVisible = true, ReadoutModules = new List <ReadoutModule> { ReadoutLibrary.GetReadout("AltitudeTerrain"), ReadoutLibrary.GetReadout("VerticalSpeed"), ReadoutLibrary.GetReadout("HorizontalSpeed"), ReadoutLibrary.GetReadout("Biome"), ReadoutLibrary.GetReadout("MachNumber") }, }; hud2.FloatingPositionX = Screen.width * 0.75f - (hud2.ReadoutModules.First().ContentWidth * 0.5f); hud2.FloatingPositionY = 0.0f; hud2.IsHud = true; CustomSections.Add(hud2); }
/// <summary> /// Sets up and populates the library with the stock sections on creation. /// </summary> static SectionLibrary() { StockSections = new List <SectionModule>(); CustomSections = new List <SectionModule>(); SectionModule obt = new SectionModule { Name = "ORBITAL", Abbreviation = "ORBT", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Orbital")).Where(r => r.IsDefault).ToList() }; obt.ApplyPreset(Presets.PresetLibrary.GetPreset(obt.Abbreviation)); StockSections.Add(obt); SectionModule srf = new SectionModule { Name = "SURFACE", Abbreviation = "SURF", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Surface")).Where(r => r.IsDefault).ToList() }; srf.ApplyPreset(Presets.PresetLibrary.GetPreset(srf.Abbreviation)); StockSections.Add(srf); SectionModule vsl = new SectionModule { Name = "VESSEL", Abbreviation = "VESL", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Vessel")).Where(r => r.IsDefault).ToList() }; vsl.ApplyPreset(Presets.PresetLibrary.GetPreset(vsl.Abbreviation)); StockSections.Add(vsl); SectionModule rdz = new SectionModule { Name = "RENDEZVOUS", Abbreviation = "RDZV", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Rendezvous")).Where(r => r.IsDefault).ToList() }; rdz.ApplyPreset(Presets.PresetLibrary.GetPreset(rdz.Abbreviation)); StockSections.Add(rdz); SectionModuleTS ts = new SectionModuleTS { Name = "TRACKING", Abbreviation = "TRCK", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Rendezvous")).Where(r => r.IsDefault).ToList(), IsVisible = true, showFloatButton = false }; ts.ApplyPreset(Presets.PresetLibrary.GetPreset(ts.Abbreviation)); TrackingStationSection = ts; var thr = new SectionModule { Name = "THERMAL", Abbreviation = "HEAT", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Thermal")).Where(r => r.IsDefault).ToList(), }; thr.ApplyPreset(Presets.PresetLibrary.GetPreset(thr.Abbreviation)); StockSections.Add(thr); var body = new SectionModule { Name = "BODY", Abbreviation = "BODY", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Body")).Where(r => r.IsDefault).ToList(), }; body.ApplyPreset(Presets.PresetLibrary.GetPreset(body.Abbreviation)); StockSections.Add(body); var burn = new SectionModule { Name = "MANEUVER", Abbreviation = "BURN", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Orbital")).Where(r => r.Name.StartsWith("Node")).ToList() }; burn.ApplyPreset(Presets.PresetLibrary.GetPreset(burn.Abbreviation)); StockSections.Add(burn); var land = new SectionModule { Name = "LANDING", Abbreviation = "LAND", ReadoutModules = ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Surface")).Where(r => r.Name.StartsWith("Impact")).ToList() }; land.ReadoutModules.AddRange(ReadoutLibrary.GetCategory(ReadoutCategory.GetCategory("Vessel")).Where(r => r.Name.StartsWith("Suicide")).ToList()); land.ApplyPreset(Presets.PresetLibrary.GetPreset(land.Abbreviation)); StockSections.Add(land); SectionModule hud1 = new SectionModule { Name = "HUD 1", Abbreviation = "HUD 1", IsVisible = true, showButton = false, ReadoutModules = new List <ReadoutModule> { ReadoutLibrary.GetReadout("ApoapsisHeight"), ReadoutLibrary.GetReadout("TimeToApoapsis"), ReadoutLibrary.GetReadout("PeriapsisHeight"), ReadoutLibrary.GetReadout("TimeToPeriapsis") }, }; hud1.FloatingPositionX = Screen.width * 0.33f - (hud1.ReadoutModules.First().ContentWidth * 0.5f); hud1.FloatingPositionY = 0.0f; hud1.IsHud = true; hud1.ApplyPreset(Presets.PresetLibrary.GetPreset(hud1.Abbreviation)); StockSections.Add(hud1); SectionModule hud2 = new SectionModule { Name = "HUD 2", Abbreviation = "HUD 2", IsVisible = true, showButton = false, ReadoutModules = new List <ReadoutModule> { ReadoutLibrary.GetReadout("AltitudeTerrain"), ReadoutLibrary.GetReadout("VerticalSpeed"), ReadoutLibrary.GetReadout("HorizontalSpeed"), ReadoutLibrary.GetReadout("Biome"), ReadoutLibrary.GetReadout("MachNumber") }, }; hud2.FloatingPositionX = Screen.width * 0.7f - (hud2.ReadoutModules.First().ContentWidth * 0.5f); hud2.FloatingPositionY = 0.0f; hud2.IsHud = true; hud2.ApplyPreset(Presets.PresetLibrary.GetPreset(hud2.Abbreviation)); StockSections.Add(hud2); }