Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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(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();
   GUILayout.EndHorizontal();
   GUILayout.Space(10.0f);
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
0
 public void ToggleUI()
 {
     UI.open((Panel p) => p.fileman(vessel));
 }
Esempio n. 6
0
 public void ReviewData()
 {
     UI.open((p) => p.fileman(vessel));
 }