override public void WindowGUI(int windowID)
        {
            GUIStyle s = new GUIStyle(GUI.skin.label);

            s.normal.textColor = Color.yellow;
            GUILayout.BeginVertical(sBorder);
            base.preWindowGUI(windowID);
            base.WindowGUI(windowID);
            GUILayout.Label("Repeat", s, GUILayout.ExpandWidth(false));
            if (this.isStarted() && !this.isExecuted())
            {
                s = new GUIStyle(GUI.skin.label);
                s.normal.textColor = Color.red;
                GUILayout.Label(times.val + " times. Executed", GUILayout.ExpandWidth(false));
                GUILayout.Label(this.executedTimes + "", s, GUILayout.ExpandWidth(false));
                GUILayout.Label("/" + times.val, GUILayout.ExpandWidth(false));
            }
            else
            {
                GuiUtils.SimpleTextBox("", times, "times", 30);
            }
            base.postWindowGUI(windowID);

            GUILayout.BeginHorizontal();
            GUILayout.Space(50);
            GUILayout.BeginVertical();
            actions.actionsWindowGui(windowID);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
        override public void WindowGUI(int windowID)
        {
            GUIStyle s = new GUIStyle(GUI.skin.label);

            s.normal.textColor = Color.yellow;
            GUILayout.BeginVertical(sBorderY);
            base.preWindowGUI(windowID);
            base.WindowGUI(windowID);
            GUILayout.Label("If", s, GUILayout.ExpandWidth(false));
            condition.WindowGUI(windowID);
            s.normal.textColor = Color.yellow;
            GUILayout.Label("Then", s, GUILayout.ExpandWidth(false));
            base.postWindowGUI(windowID);

            GUILayout.BeginHorizontal();
            GUILayout.Space(50);
            GUILayout.BeginVertical(sBorderG);
            actionsThen.actionsWindowGui(windowID);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Space(50);
            GUILayout.BeginVertical();
            GUILayout.Label("Else", s, GUILayout.ExpandWidth(false));
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Space(50);
            GUILayout.BeginVertical(sBorderR);
            actionsElse.actionsWindowGui(windowID);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
Пример #3
0
        protected override void WindowGUI(int windowID)
        {
            GUILayout.BeginVertical();
            if (this.warmingUp)
            {
                GUILayout.Label(Localizer.Format("#MechJeb_ScriptMod_label1", this.spendTime));                //"Warming up. Please wait... <<1>> s
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUIStyle style2 = new GUIStyle(GUI.skin.button);
                if (!started && this.actionsList.getActionsCount() > 0)
                {
                    style2.normal.textColor = Color.green;
                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button1"), style2))                    //"▶ START"
                    {
                        this.start();
                    }
                    style2.normal.textColor = Color.white;
                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button2"), style2))                    //"☇ Reset"
                    {
                        this.actionsList.recursiveResetStatus();
                    }
                    this.addActionDisabled = GUILayout.Toggle(this.addActionDisabled, Localizer.Format("#MechJeb_ScriptMod_checkbox1"));                    //"Hide Add Actions"
                }
                else if (started)
                {
                    style2.normal.textColor = Color.red;
                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button3"), style2))                    //"■ STOP"
                    {
                        this.stop();
                    }
                }
                if (this.actionsList.getActionsCount() > 0)
                {
                    if (minifiedGUI)
                    {
                        if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button4")))                        //"▼ Full GUI"
                        {
                            this.minifiedGUI = false;
                        }
                    }
                    else
                    {
                        if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button5")))                        //"△ Compact GUI"
                        {
                            this.minifiedGUI = true;
                        }
                    }
                }

                GUILayout.EndHorizontal();
                if (!this.minifiedGUI && !this.started)
                {
                    GUILayout.BeginHorizontal();
                    style2.normal.textColor = Color.white;
                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button6"), style2))                    //"Clear All"
                    {
                        this.actionsList.clearAll();
                    }
                    selectedMemorySlotType = GuiUtils.ComboBox.Box(selectedMemorySlotType, memorySlotsList.ToArray(), memorySlotsList);
                    if (selectedMemorySlotType != old_selectedMemorySlotType)
                    {
                        old_selectedMemorySlotType = selectedMemorySlotType;
                        this.updateScriptsNames();
                    }
                    selectedSlot = GuiUtils.ComboBox.Box(selectedSlot, scriptsList.ToArray(), scriptsList);
                    if (deployScriptNameField)
                    {
                        if (this.selectedMemorySlotType == 1)
                        {
                            scriptNames[selectedSlot] = GUILayout.TextField(scriptNames[selectedSlot], GUILayout.Width(120), GUILayout.ExpandWidth(false));
                        }
                        else
                        {
                            globalScriptNames[selectedSlot] = GUILayout.TextField(globalScriptNames[selectedSlot], GUILayout.Width(120), GUILayout.ExpandWidth(false));
                        }
                        if (scriptNames[selectedSlot].Length > 20)                        //Limit the script name to 20 chars
                        {
                            if (this.selectedMemorySlotType == 1)
                            {
                                scriptNames[selectedSlot] = scriptNames[selectedSlot].Substring(0, 20);
                            }
                            else
                            {
                                globalScriptNames[selectedSlot] = globalScriptNames[selectedSlot].Substring(0, 20);
                            }
                        }
                        if (GUILayout.Button("<<", GUILayout.ExpandWidth(false)))
                        {
                            this.deployScriptNameField = false;
                            this.updateScriptsNames();
                            this.SaveScriptModuleConfig();
                        }
                    }
                    else
                    {
                        if (GUILayout.Button(">>", GUILayout.ExpandWidth(false)))
                        {
                            this.deployScriptNameField = true;
                        }
                    }
                    if (GUILayout.Button("✖", new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
                    {
                        if (!this.waitingDeletionConfirmation)
                        {
                            this.waitingDeletionConfirmation = true;
                            this.setFlashMessage("Warning: To confirm deletion of slot " + (selectedSlot + 1) + " - " + scriptNames[selectedSlot] + ", press again the delete button", 0);
                        }
                        else
                        {
                            this.DeleteConfig(this.selectedSlot, true, false);
                            if (this.selectedMemorySlotType == 1)
                            {
                                scriptNames[selectedSlot] = "";
                            }
                            else
                            {
                                globalScriptNames[selectedSlot] = "";
                            }
                            this.updateScriptsNames();
                            this.SaveScriptModuleConfig();
                        }
                    }

                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button7"), style2))                    //"Save"
                    {
                        this.SaveConfig(this.selectedSlot, true, false);
                    }
                    if (GUILayout.Button(Localizer.Format("#MechJeb_ScriptMod_button8"), style2))                    //"Load"
                    {
                        this.LoadConfig(this.selectedSlot, true, false);
                    }
                    GUILayout.EndHorizontal();
                    if (this.flashMessage.Length > 0)
                    {
                        GUILayout.BeginHorizontal();
                        GUIStyle sflash = new GUIStyle(GUI.skin.label);
                        if (this.flashMessageType == 1)
                        {
                            sflash.normal.textColor = Color.red;
                        }
                        else
                        {
                            sflash.normal.textColor = Color.yellow;
                        }
                        GUILayout.Label(this.flashMessage, sflash);
                        GUILayout.EndHorizontal();
                    }
                }
                actionsList.actionsWindowGui(windowID);                 //Render Actions list
            }
            GUILayout.EndVertical();
            base.WindowGUI(windowID);
        }
Пример #4
0
        override public void WindowGUI(int windowID)
        {
            GUIStyle s = new GUIStyle(GUI.skin.label);

            s.normal.textColor = Color.yellow;
            GUILayout.BeginVertical(sBorderY);
            base.preWindowGUI(windowID);
            base.WindowGUI(windowID);
            GUILayout.Label("Parallel Execution", s, GUILayout.ExpandWidth(false));
            if (this.panel1Hidden)
            {
                if (GUILayout.Button("<<Show Panel 1", GUILayout.ExpandWidth(false)))
                {
                    this.panel1Hidden = false;
                }
            }
            else if (!this.panel2Hidden)
            {
                if (GUILayout.Button(">>Hide Panel 1", GUILayout.ExpandWidth(false)))
                {
                    this.panel1Hidden = true;
                }
            }
            else
            {
                if (GUILayout.Button(">>Hide Panel 1 and <<Show Panel 2", GUILayout.ExpandWidth(false)))
                {
                    this.panel1Hidden = true;
                    this.panel2Hidden = false;
                }
            }
            if (this.panel2Hidden)
            {
                if (GUILayout.Button("<<Show Panel 2", GUILayout.ExpandWidth(false)))
                {
                    this.panel2Hidden = false;
                }
            }
            else if (!this.panel1Hidden)
            {
                if (GUILayout.Button(">>Hide Panel 2", GUILayout.ExpandWidth(false)))
                {
                    this.panel2Hidden = true;
                }
            }
            else
            {
                if (GUILayout.Button(">>Hide Panel 2 and <<Show Panel 1", GUILayout.ExpandWidth(false)))
                {
                    this.panel2Hidden = true;
                    this.panel1Hidden = false;
                }
            }
            base.postWindowGUI(windowID);
            GUILayout.BeginHorizontal();
            if (!this.panel1Hidden)
            {
                GUILayout.BeginVertical(sBorderB);
                actions1.actionsWindowGui(windowID);
                GUILayout.EndVertical();
            }
            if (!this.panel2Hidden)
            {
                GUILayout.BeginVertical(sBorderB);
                actions2.actionsWindowGui(windowID);
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }