public void ToggleWindow() { // in flight if (Lib.IsFlight()) { // disable for dead eva kerbals Vessel v = FlightGlobals.ActiveVessel; if (v == null || EVA.IsDead(v)) { return; } // check trait if (!reconfigure_cs.Check(v)) { Message.Post(Localizer.Format("#KERBALISM_Configure_noconfigure"), reconfigure_cs.Warning()); return; } // warn the user about potential resource loss if (Resource_loss()) { Message.Post(Severity.warning, Localizer.Format("#KERBALISM_Configure_dumpexcess")); } } // open the window UI.Open(Window_body); }
public static void KeyboardInput() { // mute/unmute messages with keyboard if (Input.GetKeyDown(KeyCode.Pause)) { if (!Message.IsMuted()) { Message.Post("Messages muted", "Be careful out there"); Message.Mute(); } else { Message.Unmute(); Message.Post("Messages unmuted"); } } // toggle body info window with keyboard if (MapView.MapIsEnabled && Input.GetKeyDown(KeyCode.B)) { UI.Open(BodyInfo.Body_info); } // call action scripts // - avoid creating vessel data for invalid vessels Vessel v = FlightGlobals.ActiveVessel; if (v == null) { return; } VesselData vd = v.KerbalismData(); if (!vd.IsSimulated) { return; } // call scripts with 1-5 key if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { vd.computer.Execute(v, ScriptType.action1); } if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2)) { vd.computer.Execute(v, ScriptType.action2); } if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3)) { vd.computer.Execute(v, ScriptType.action3); } if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4)) { vd.computer.Execute(v, ScriptType.action4); } if (Input.GetKeyDown(KeyCode.Alpha5) || Input.GetKeyDown(KeyCode.Keypad5)) { vd.computer.Execute(v, ScriptType.action5); } }
public void ToggleWindow() { // in flight if (Lib.IsFlight()) { // disable for dead eva kerbals Vessel v = FlightGlobals.ActiveVessel; if (v == null || EVA.IsDead(v)) { return; } // check trait if (!reconfigure_cs.Check(v)) { Message.Post("Can't reconfigure the component", reconfigure_cs.Warning()); return; } // warn the user about potential resource loss if (Resource_Loss()) { Message.Post(Severity.warning, "Reconfiguring will dump resources in excess of capacity."); } } // open the window UI.Open(Window_Body); }
void Render_Menu(Vessel v) { const string tooltip = "\n<i>(middle-click to popout in a window)</i>"; VesselData vd = DB.Vessel(v); GUILayout.BeginHorizontal(Styles.entry_container); GUILayout.Label(new GUIContent(page == MonitorPage.telemetry ? " <color=#00ffff>INFO</color> " : " INFO ", Icons.small_info, "Telemetry readings" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.telemetry; } else if (Lib.IsClicked(2)) { UI.Open((p) => p.Telemetry_Life(v)); } if (Features.Science) { GUILayout.Label(new GUIContent(page == MonitorPage.data ? " <color=#00ffff>DATA</color> " : " DATA ", Icons.small_folder, "Stored files and samples" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.data; } else if (Lib.IsClicked(2)) { UI.Open((p) => p.FileMan(v)); } } if (Features.Automation) { GUILayout.Label(new GUIContent(page == MonitorPage.scripts ? " <color=#00ffff>AUTO</color> " : " AUTO ", Icons.small_console, "Control and automate components" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.scripts; } else if (Lib.IsClicked(2)) { UI.Open((p) => p.DevMan(v)); } } GUILayout.Label(new GUIContent(page == MonitorPage.config ? " <color=#00ffff>CFG</color> " : " CFG ", Icons.small_config, "Configure the vessel" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.config; } else if (Lib.IsClicked(2)) { UI.Open((p) => p.Config(v)); } GUILayout.Label(new GUIContent(" GROUP ", Icons.small_search, "Organize in groups"), config_style); vd.group = Lib.TextFieldPlaceholder("Kerbalism_group", vd.group, "NONE", group_style).ToUpper(); string t = ""; t = Lib.TextFieldPlaceholder("Kerbalism_group", t, "NONE", group_style).ToUpper(); GUILayout.EndHorizontal(); GUILayout.Space(10.0f); }
void Indicator_signal(Panel p, Vessel v, Vessel_info vi) { ConnectionInfo conn = vi.connection; // signal strength string signal_str = conn.strength > Double.Epsilon ? Lib.HumanReadablePerc(Math.Ceiling(conn.strength * 10000) / 10000, "F2") : Lib.Color("#ffaa00", Lib.Italic(Localizer.Format("#KERBALISM_Generic_NO"))); // target name string target_str = conn.linked ? conn.target_name : Localizer.Format("#KERBALISM_Generic_NONE"); // transmitting info string comms_str = conn.linked ? Localizer.Format("#KERBALISM_UI_telemetry") : Localizer.Format("#KERBALISM_Generic_NOTHING"); if (vi.transmitting.Length > 0) { ExperimentInfo exp = Science.Experiment(vi.transmitting); comms_str = exp.name; } // create tooltip string tooltip = Lib.BuildString ( "<align=left />", String.Format("{0,-14}\t<b>{1}</b>\n", Localizer.Format("#KERBALISM_UI_DSNconnected"), conn.linked ? Lib.Color("green", Localizer.Format("#KERBALISM_Generic_YES")) : Lib.Color("#ffaa00", Lib.Italic(Localizer.Format("#KERBALISM_Generic_NO")))), String.Format("{0,-14}\t<b>{1}</b>\n", Localizer.Format("#KERBALISM_UI_sciencerate"), Lib.HumanReadableDataRate(conn.rate)), String.Format("{0,-14}\t<b>{1}</b>\n", Localizer.Format("#KERBALISM_UI_strength"), signal_str), String.Format("{0,-14}\t<b>{1}</b>\n", Localizer.Format("#KERBALISM_UI_target"), target_str), String.Format("{0,-14}\t<b>{1}</b>", Localizer.Format("#KERBALISM_UI_transmitting"), comms_str) ); // create icon status Texture2D image = Icons.signal_red; switch (conn.status) { case LinkStatus.direct_link: image = conn.strength > 0.05 ? Icons.signal_white : Icons.iconSwitch(Icons.signal_yellow, image); // or 5% signal strength break; case LinkStatus.indirect_link: image = conn.strength > 0.05 ? Icons.signal_white : Icons.iconSwitch(Icons.signal_yellow, image); // or 5% signal strength tooltip += Lib.Color("yellow", "\n" + Localizer.Format("#KERBALISM_UI_Signalrelayed")); break; case LinkStatus.plasma: tooltip += Lib.Color("red", Lib.Italic("\n" + Localizer.Format("#KERBALISM_UI_Plasmablackout"))); break; case LinkStatus.storm: tooltip += Lib.Color("red", Lib.Italic("\n" + Localizer.Format("#KERBALISM_UI_Stormblackout"))); break; } p.AddIcon(image, tooltip, () => UI.Open((p2) => p2.ConnMan(v))); }
public static void KeyboardInput() { // mute/unmute messages with keyboard if (Input.GetKeyDown(KeyCode.Pause)) { if (!Message.IsMuted()) { Message.Post("Messages muted", "Be careful out there"); Message.Mute(); } else { Message.Unmute(); Message.Post("Messages unmuted"); } } // toggle body info window with keyboard if (MapView.MapIsEnabled && Input.GetKeyDown(KeyCode.B)) { UI.Open(BodyInfo.Body_info); } // call action scripts // - avoid creating vessel data for invalid vessels Vessel v = FlightGlobals.ActiveVessel; if (v != null && DB.vessels.ContainsKey(Lib.RootID(v))) { // get computer Computer computer = DB.Vessel(v).computer; // call scripts with 1-5 key if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1)) { computer.Execute(v, ScriptType.action1); } if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2)) { computer.Execute(v, ScriptType.action2); } if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3)) { computer.Execute(v, ScriptType.action3); } if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4)) { computer.Execute(v, ScriptType.action4); } if (Input.GetKeyDown(KeyCode.Alpha5) || Input.GetKeyDown(KeyCode.Keypad5)) { computer.Execute(v, ScriptType.action5); } } }
void Render_menu(Vessel v) { const string tooltip = "\n<i>(middle-click to popout in a window, middle-click again to close popout)</i>"; VesselData vd = DB.Vessel(v); GUILayout.BeginHorizontal(Styles.entry_container); GUILayout.Label(new GUIContent(page == MonitorPage.telemetry ? " <color=#00ffff>INFO</color> " : " INFO ", Icons.small_info, "Telemetry readings" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.telemetry; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.telemetry) { UI.window.Close(); } else { UI.Open((p) => p.TelemetryPanel(v)); } } if (Features.Science) { GUILayout.Label(new GUIContent(page == MonitorPage.data ? " <color=#00ffff>DATA</color> " : " DATA ", Icons.small_folder, "Stored files and samples" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.data; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.data) { UI.window.Close(); } else { UI.Open((p) => p.Fileman(v)); } } } if (Features.Automation) { GUILayout.Label(new GUIContent(page == MonitorPage.scripts ? " <color=#00ffff>AUTO</color> " : " AUTO ", Icons.small_console, "Control and automate components" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.scripts; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.scripts) { UI.window.Close(); } else { UI.Open((p) => p.Devman(v)); } } } if (PreferencesMessages.Instance.stockMessages != true) { GUILayout.Label(new GUIContent(page == MonitorPage.log ? " <color=#00ffff>LOG</color> " : " LOG ", Icons.small_notes, "See previous notifications" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.log; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.log) { UI.window.Close(); } else { UI.Open((p) => p.Logman(v)); } } } GUILayout.Label(new GUIContent(page == MonitorPage.config ? " <color=#00ffff>CFG</color> " : " CFG ", Icons.small_config, "Configure the vessel" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.config; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.config) { UI.window.Close(); } else { UI.Open((p) => p.Config(v)); } } GUILayout.Label(new GUIContent(" GROUP ", Icons.small_search, "Organize in groups"), config_style); vd.group = Lib.TextFieldPlaceholder("Kerbalism_group", vd.group, "NONE", group_style).ToUpper(); GUILayout.EndHorizontal(); GUILayout.Space(Styles.ScaleFloat(10.0f)); }
void Indicator_signal(Panel p, Vessel v, VesselData vd) { ConnectionInfo conn = vd.Connection; // signal strength var strength = Math.Ceiling(conn.strength * 10000) / 10000; string signal_str = strength > 0.001 ? Lib.HumanReadablePerc(strength, "F2") : Lib.Color(Lib.Italic(Local.Generic_NO), Lib.Kolor.Orange); // target name string target_str = conn.linked ? conn.target_name : Local.Generic_NONE; // transmitting info string comms_str; if (!conn.linked) { comms_str = Local.Generic_NOTHING; } else if (vd.filesTransmitted.Count == 0) { comms_str = Local.UI_telemetry; } else { comms_str = Lib.BuildString(vd.filesTransmitted.Count.ToString(), vd.filesTransmitted.Count > 1 ? " files" : " file"); } // create tooltip string tooltip = Lib.BuildString ( "<align=left />", String.Format("{0,-14}\t<b>{1}</b>\n", Local.UI_DSNconnected, conn.linked ? Lib.Color(Local.Generic_YES, Lib.Kolor.Green) : Lib.Color(Lib.Italic(Local.Generic_NO), Lib.Kolor.Orange)), String.Format("{0,-14}\t<b>{1}</b>\n", Local.UI_sciencerate, Lib.HumanReadableDataRate(conn.rate)), String.Format("{0,-14}\t<b>{1}</b>\n", Local.UI_strength, signal_str), String.Format("{0,-14}\t<b>{1}</b>\n", Local.UI_target, target_str), String.Format("{0,-14}\t<b>{1}</b>", Local.UI_transmitting, comms_str) ); // create icon status Texture2D image = Textures.signal_red; switch (conn.status) { case LinkStatus.direct_link: image = conn.strength > 0.05 ? Textures.signal_white : Textures.iconSwitch(Textures.signal_yellow, image); // or 5% signal strength break; case LinkStatus.indirect_link: image = conn.strength > 0.05 ? Textures.signal_white : Textures.iconSwitch(Textures.signal_yellow, image); // or 5% signal strength tooltip += Lib.Color("\n" + Local.UI_Signalrelayed, Lib.Kolor.Yellow); break; case LinkStatus.plasma: tooltip += Lib.Color(Lib.Italic("\n" + Local.UI_Plasmablackout), Lib.Kolor.Red); break; case LinkStatus.storm: tooltip += Lib.Color(Lib.Italic("\n" + Local.UI_Stormblackout), Lib.Kolor.Red); break; } p.AddRightIcon(image, tooltip, () => UI.Open((p2) => p2.ConnMan(v))); }
void Render_menu(Vessel v) { VesselData vd = v.KerbalismData(); GUILayout.BeginHorizontal(Styles.entry_container); GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.telemetry, " " + Local.Monitor_INFO, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_info, Local.Monitor_INFO_desc + Local.Monitor_tooltip), config_style); //INFO"Telemetry readings" if (Lib.IsClicked()) { page = MonitorPage.telemetry; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.telemetry) { UI.window.Close(); } else { UI.Open((p) => p.TelemetryPanel(v)); } } if (Features.Science) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.data, " " + Local.Monitor_DATA, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_folder, Local.Monitor_DATA_desc + Local.Monitor_tooltip), config_style); //DATA"Stored files and samples" if (Lib.IsClicked()) { page = MonitorPage.data; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.data) { UI.window.Close(); } else { UI.Open((p) => p.Fileman(v)); } } } if (Features.Automation) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.scripts, " " + Local.Monitor_AUTO, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_console, Local.Monitor_AUTO_desc + Local.Monitor_tooltip), config_style); //AUTO"Control and automate components" if (Lib.IsClicked()) { page = MonitorPage.scripts; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.scripts) { UI.window.Close(); } else { UI.Open((p) => p.Devman(v)); } } } if (Features.Reliability) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.failures, " " + Local.Monitor_FAILURES, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_wrench, Local.Monitor_FAILURES_desc + Local.Monitor_tooltip), config_style); //FAILURES"See failures and maintenance state" if (Lib.IsClicked()) { page = MonitorPage.failures; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.failures) { UI.window.Close(); } else { UI.Open((p) => p.Failman(v)); } } } if (PreferencesMessages.Instance.stockMessages != true) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.log, " " + Local.Monitor_LOG, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_notes, Local.Monitor_LOG_desc + Local.Monitor_tooltip), config_style); //LOG"See previous notifications" if (Lib.IsClicked()) { page = MonitorPage.log; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.log) { UI.window.Close(); } else { UI.Open((p) => p.Logman(v)); } } } GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.config, " " + Local.Monitor_CFG, Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_config, Local.Monitor_CFG_desc + Local.Monitor_tooltip), config_style); //CFG"Configure the vessel" if (Lib.IsClicked()) { page = MonitorPage.config; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.config) { UI.window.Close(); } else { UI.Open((p) => p.Config(v)); } } GUILayout.EndHorizontal(); GUILayout.Space(Styles.ScaleFloat(10.0f)); }
public void ReviewData() { UI.Open((p) => p.Fileman(vessel)); }
public void ToggleUI() { UI.Open((Panel p) => p.Fileman(vessel)); }
void Render_menu(Vessel v) { const string tooltip = "\n<i>(middle-click to popout in a window, middle-click again to close popout)</i>"; VesselData vd = v.KerbalismData(); GUILayout.BeginHorizontal(Styles.entry_container); GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.telemetry, " INFO", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_info, "Telemetry readings" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.telemetry; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.telemetry) { UI.window.Close(); } else { UI.Open((p) => p.TelemetryPanel(v)); } } if (Features.Science) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.data, " DATA", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_folder, "Stored files and samples" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.data; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.data) { UI.window.Close(); } else { UI.Open((p) => p.Fileman(v)); } } } if (Features.Automation) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.scripts, " AUTO", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_console, "Control and automate components" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.scripts; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.scripts) { UI.window.Close(); } else { UI.Open((p) => p.Devman(v)); } } } if (Features.Reliability) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.failures, " FAILURES", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_wrench, "See failures and maintenance state" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.failures; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.failures) { UI.window.Close(); } else { UI.Open((p) => p.Failman(v)); } } } if (PreferencesMessages.Instance.stockMessages != true) { GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.log, " LOG", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_notes, "See previous notifications" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.log; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.log) { UI.window.Close(); } else { UI.Open((p) => p.Logman(v)); } } } GUILayout.Label(new GUIContent(Lib.Color(page == MonitorPage.config, " CFG", Lib.Kolor.Green, Lib.Kolor.None, true), Textures.small_config, "Configure the vessel" + tooltip), config_style); if (Lib.IsClicked()) { page = MonitorPage.config; } else if (Lib.IsClicked(2)) { if (UI.window.PanelType == Panel.PanelType.config) { UI.window.Close(); } else { UI.Open((p) => p.Config(v)); } } GUILayout.EndHorizontal(); GUILayout.Space(Styles.ScaleFloat(10.0f)); }