示例#1
0
        private void WindowSc(int id)
        {
            //Init styles
            if (!Textures.StylesSet)
            {
                Textures.SetupStyles();
            }

            Utilities._TooltipStyle.normal.background = Textures.TooltipBox;
            Utilities._TooltipStyle.normal.textColor  = new Color32(207, 207, 207, 255);
            Utilities._TooltipStyle.hover.textColor   = Color.blue;

            GUIContent closeContent = new GUIContent(Textures.BtnRedCross, Localizer.Format("#autoLOC_AmpYear_1000007"));     //#autoLOC_AmpYear_1000007 = Close Window
            Rect       closeRect    = new Rect(SCwindowPos.width - 21, 4, 16, 16);

            if (GUI.Button(closeRect, closeContent, Textures.PartListbtnStyle))
            {
                AYSCMenuAppLToolBar.GuiVisible = false;
                LoadSettingsSC = true;
                return;
            }

            GUILayout.BeginVertical();
            _bodscrollViewVector = GUILayout.BeginScrollView(_bodscrollViewVector, GUILayout.Height(WINDOW_BASE_HEIGHT - 30), GUILayout.Width(SCWINDOW_WIDTH - 10));


            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000170"), Localizer.Format("#autoLOC_AmpYear_1000171")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000170 = AmpYear Monitoring uses EC		// #autoLOC_AmpYear_1000171 = If ON AmpYear uses EC for it's monitoring functions. If Off it does not.
            _inputAYMonitoringUseEC = GUILayout.Toggle(_inputAYMonitoringUseEC, "", GUILayout.MinWidth(30.0F));                                                                    //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000172"), Localizer.Format("#autoLOC_AmpYear_1000173")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000172 = Reserve Battery Recharge Percentage		// #autoLOC_AmpYear_1000173 = The percentage of Main Power available before AmpYear begins recharging Reserve Batteries
            _inputSrrt = Regex.Replace(GUILayout.TextField(_inputSrrt, 3, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                              //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000174"), Localizer.Format("#autoLOC_AmpYear_1000175")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000174 = Power Low Warning Percentage		// #autoLOC_AmpYear_1000175 = A Warning window will open when the percentage of Main Power Available reaches this percentage value
            _inputSplw = Regex.Replace(GUILayout.TextField(_inputSplw, 3, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                              //you can play with the width of the text box
            GUILayout.EndHorizontal();

            if (KKPresent)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000176"), Localizer.Format("#autoLOC_AmpYear_1000177")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000176 = Climate Control Elec. Drain		// #autoLOC_AmpYear_1000177 = The amount of EC the Climate Control system will use per second
                _inputSccbdf = Regex.Replace(GUILayout.TextField(_inputSccbdf, 2, GUILayout.MinWidth(10.0F)), "[^.0-9]", "");                                                          //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000178"), Localizer.Format("#autoLOC_AmpYear_1000179")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000178 = Climate Control Target Temp.		// #autoLOC_AmpYear_1000179 = The temperature in Celcius the Climate Control System will try to maintain in teh cabin
                _inputSctt = Regex.Replace(GUILayout.TextField(_inputSctt, 2, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                              //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000180"), Localizer.Format("#autoLOC_AmpYear_1000181")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000180 = Massage Electrical Drain		// #autoLOC_AmpYear_1000181 = The amount of EC the Massage Chair system will use per second
                _inputSmbdf = Regex.Replace(GUILayout.TextField(_inputSmbdf, 2, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000182"), Localizer.Format("#autoLOC_AmpYear_1000183")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000182 = Kraziness Base Growth Amount		// #autoLOC_AmpYear_1000183 = The percentage amount that Kraziness will grow per second
                _inputScbdf = Regex.Replace(GUILayout.TextField(_inputScbdf, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000184"), Localizer.Format("#autoLOC_AmpYear_1000185")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000184 = Temp Uncomfortable Kraziness		// #autoLOC_AmpYear_1000185 = The degrees Celcius where the actual cabin temperature is < less than or > greater than the target temperature. If this occurs Kraziness will go up faster
                _inputSccuf = Regex.Replace(GUILayout.TextField(_inputSccuf, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000186"), Localizer.Format("#autoLOC_AmpYear_1000187")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000186 = Climate Kraziness Reduction		// #autoLOC_AmpYear_1000187 = The percentage amount that Climate Control system will reduce Kraziness per second
                _inputSccrf = Regex.Replace(GUILayout.TextField(_inputSccrf, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000188"), Localizer.Format("#autoLOC_AmpYear_1000189")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000188 = Music Kraziness Reduction		// #autoLOC_AmpYear_1000189 = The percentage amount that the music system will reduce Kraziness per second
                _inputScrrf = Regex.Replace(GUILayout.TextField(_inputScrrf, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000190"), Localizer.Format("#autoLOC_AmpYear_1000191")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000190 = Massage Kraziness Reduction		// #autoLOC_AmpYear_1000191 = The percentage amount that the Massage chairs will reduce Kraziness per second
                _inputScmrf = Regex.Replace(GUILayout.TextField(_inputScmrf, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                            //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000192"), Localizer.Format("#autoLOC_AmpYear_1000193")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000192 = Kraziness Minor Problem Limit		// #autoLOC_AmpYear_1000193 = The percentage amount of Kraziness where minor bad things will start happening
                _inputScMinL = Regex.Replace(GUILayout.TextField(_inputScMinL, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                          //you can play with the width of the text box
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000194"), Localizer.Format("#autoLOC_AmpYear_1000195")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000194 = Kraziness Major Problem Limit		// #autoLOC_AmpYear_1000195 = The percentage amount of Kraziness where major bad things will start happening
                _inputScMajL = Regex.Replace(GUILayout.TextField(_inputScMajL, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                                          //you can play with the width of the text box
                GUILayout.EndHorizontal();
            }

            if (!ToolbarManager.ToolbarAvailable)
            {
                GUI.enabled = false;
                tmpToolTip  = Localizer.Format("#autoLOC_AmpYear_1000196");             // #autoLOC_AmpYear_1000196 = Not available unless ToolBar mod is installed
            }
            else
            {
                tmpToolTip =
                    Localizer.Format("#autoLOC_AmpYear_1000197");               // #autoLOC_AmpYear_1000197 = If ON Icon will appear in the stock Applauncher, if OFF Icon will appear in ToolBar mod
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000198"), tmpToolTip), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000198 = Use Application Launcher Button
            _inputAppL = GUILayout.Toggle(_inputAppL, "", GUILayout.MinWidth(30.0F));                                                            //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000199"), Localizer.Format("#autoLOC_AmpYear_1000200")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000199 = Debug Mode		// #autoLOC_AmpYear_1000200 = Creates logs of logging messages to help when there are problems, but will slow KSP down
            _inputSdebug = GUILayout.Toggle(_inputSdebug, "", GUILayout.MinWidth(30.0F));                                                                                          //you can play with the width of the text box
            _inputVdebug = _inputSdebug;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000201"), Localizer.Format("#autoLOC_AmpYear_1000202")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000201 = ToolTips On		// #autoLOC_AmpYear_1000202 = If On then you will see ToolTips like this one, If off - well you won't
            _inputToolTipsOn = GUILayout.Toggle(_inputToolTipsOn, "", GUILayout.MinWidth(30.0F));                                                                                  //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000203"), Localizer.Format("#autoLOC_AmpYear_1000204")), Textures.StatusStyle);            // #autoLOC_AmpYear_1000203 = EC Producer Module Highlight Color:		// #autoLOC_AmpYear_1000204 = The color that EC production modules will be highlighted with.\nMove the sliders to set the Color.
            GUILayout.BeginHorizontal();
            prodPartRedValue   = _inputProdPartHighlightColor.r * 255f;
            prodPartGreenValue = _inputProdPartHighlightColor.g * 255f;
            prodPartBlueValue  = _inputProdPartHighlightColor.b * 255f;
            prodPartRedValue   = GUILayout.HorizontalSlider(prodPartRedValue, 0f, 255f);
            prodPartGreenValue = GUILayout.HorizontalSlider(prodPartGreenValue, 0f, 255f);
            prodPartBlueValue  = GUILayout.HorizontalSlider(prodPartBlueValue, 0f, 255f);
            GUILayout.EndHorizontal();

            GUIStyle prodPartstyle = new GUIStyle();

            _inputProdPartHighlightColor = new Color(prodPartRedValue / 255f, prodPartGreenValue / 255f, prodPartBlueValue / 255f);
            prodPartstyleTexture.SetPixel(0, 0, _inputProdPartHighlightColor);
            prodPartstyleTexture.Apply();
            prodPartstyle.normal.background = prodPartstyleTexture;
            GUILayout.Box(new GUIContent(""), prodPartstyle, GUILayout.Height(20));


            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000205"), Localizer.Format("#autoLOC_AmpYear_1000206")), Textures.StatusStyle);            // #autoLOC_AmpYear_1000205 = EC Consumer Module Highlight Color:		// #autoLOC_AmpYear_1000206 = The color that EC consumer modules will be highlighted with.\nMove the sliders to set the Color.
            GUILayout.BeginHorizontal();
            consPartRedValue   = _inputConsPartHighlightColor.r * 255f;
            consPartGreenValue = _inputConsPartHighlightColor.g * 255f;
            consPartBlueValue  = _inputConsPartHighlightColor.b * 255f;
            consPartRedValue   = GUILayout.HorizontalSlider(consPartRedValue, 0f, 255f);
            consPartGreenValue = GUILayout.HorizontalSlider(consPartGreenValue, 0f, 255f);
            consPartBlueValue  = GUILayout.HorizontalSlider(consPartBlueValue, 0f, 255f);
            GUILayout.EndHorizontal();

            GUIStyle consPartstyle = new GUIStyle();

            _inputConsPartHighlightColor = new Color(consPartRedValue / 255f, consPartGreenValue / 255f, consPartBlueValue / 255f);
            consPartstyleTexture.SetPixel(0, 0, _inputConsPartHighlightColor);
            consPartstyleTexture.Apply();
            consPartstyle.normal.background = consPartstyleTexture;
            GUILayout.Box(new GUIContent(""), consPartstyle, GUILayout.Height(20));

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000207"), Localizer.Format("#autoLOC_AmpYear_1000208")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000207 = ESP High Threshold		// #autoLOC_AmpYear_1000208 = The percentage of Main Power where Emergency Shutdow Procedure will shutdown/restart High priority modules. Must be >= 1%
            _inputSESPHighThreshold = Regex.Replace(GUILayout.TextField(_inputSESPHighThreshold, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                    //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000209"), Localizer.Format("#autoLOC_AmpYear_1000210")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000209 = ESP Medium Threshold		// #autoLOC_AmpYear_1000210 = The percentage of Main Power where Emergency Shutdow Procedure will shutdown/restart Medium priority modules. Must be >= High Threshold + 1%
            _inputSESPMediumThreshold = Regex.Replace(GUILayout.TextField(_inputSESPMediumThreshold, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000211"), Localizer.Format("#autoLOC_AmpYear_1000212")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000211 = ESP Low Threshold		// #autoLOC_AmpYear_1000212 = The percentage of Main Power where Emergency Shutdow Procedure will shutdown/restart Low priority modules. Must be >= Medium Threshold + 1%
            _inputSESPLowThreshold = Regex.Replace(GUILayout.TextField(_inputSESPLowThreshold, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                                      //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000213"), Localizer.Format("#autoLOC_AmpYear_1000214")), Textures.StatusStyle, GUILayout.Width(300)); // #autoLOC_AmpYear_1000213 = Emergency Shutdown Cooldown Period		// #autoLOC_AmpYear_1000214 = The Cooldown period of time in seconds after an Emergency Shutdown is performed
            _inputSEmgcyShutOverrideCooldown = Regex.Replace(GUILayout.TextField(_inputSEmgcyShutOverrideCooldown, 5, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");                  //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.Box(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000215"), Localizer.Format("#autoLOC_AmpYear_1000216")), Textures.SectionTitleStyle, GUILayout.Width(300));                // #autoLOC_AmpYear_1000215 = Emergency Shutdown Procedures - Module Defaults		// #autoLOC_AmpYear_1000216 = Default values for ESP system

            for (int i = _inputPartModuleEmergShutDnDflt.Count; i-- > 0;)
            {
                KeyValuePair <ValidEmergencyPartModule, ESPValues> validentry = _inputPartModuleEmergShutDnDflt[i];
                if (!KKPresent &&
                    (validentry.Key.Name == "ClimateControl" || validentry.Key.Name == "SmoothJazz" || validentry.Key.Name == "MassageChair"))
                {
                    continue;
                }
                GUILayout.BeginHorizontal();
                GUILayout.Box(Localizer.Format(validentry.Key.displayName), Textures.StatusStyle, GUILayout.Width(300));
                bool tmpBool = validentry.Value.EmergShutDnDflt;
                tmpBool = GUILayout.Toggle(tmpBool, new GUIContent("", Localizer.Format("#autoLOC_AmpYear_1000217")), GUILayout.MinWidth(30.0F)); //you can play with the width of the text box		// #autoLOC_AmpYear_1000217 = If ON any Parts with this Module will be included in Emergency Shutdown Procedures, If OFF then it won't be included
                List <GUIContent> tmpList = new List <GUIContent>();
                tmpList.Add(new GUIContent(Textures.BtnPriority1, Localizer.Format("#autoLOC_AmpYear_1000218")));                                 // #autoLOC_AmpYear_1000218 = Emergency Shutdown Procedures - Set Default for this Module to Priority One
                tmpList.Add(new GUIContent(Textures.BtnPriority2, Localizer.Format("#autoLOC_AmpYear_1000219")));                                 // #autoLOC_AmpYear_1000219 = Emergency Shutdown Procedures - Set Default for this Module to Priority Two
                tmpList.Add(new GUIContent(Textures.BtnPriority3, Localizer.Format("#autoLOC_AmpYear_1000220")));                                 // #autoLOC_AmpYear_1000220 = Emergency Shutdown Procedures - Set Default for this Module to Priority Three
                GUIContent[]    tmpToggles    = tmpList.ToArray();
                List <GUIStyle> tmpStylesList = new List <GUIStyle>();
                tmpStylesList.Add(Textures.PrioritybtnStyle);
                tmpStylesList.Add(Textures.PrioritybtnStyle);
                tmpStylesList.Add(Textures.PrioritybtnStyle);
                GUIStyle[] tmpStylesToggles = tmpStylesList.ToArray();
                int        tmpESPPriority   = Utilities.ToggleList((int)validentry.Value.EmergShutPriority - 1, tmpToggles, tmpStylesToggles, 20);
                var        tmpIndex         = _inputPartModuleEmergShutDnDflt.FindIndex(a => a.Key == validentry.Key);
                ESPValues  tmpEspValues     = new ESPValues(tmpBool, (ESPPriority)(tmpESPPriority + 1));
                _inputPartModuleEmergShutDnDflt[tmpIndex] = new KeyValuePair <ValidEmergencyPartModule, ESPValues>(validentry.Key, tmpEspValues);
                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();

            GUILayout.EndVertical();

            if (!Double.TryParse(_inputSrrt, out _inputVrrt))
            {
                _inputVrrt = RECHARGE_RESERVE_THRESHOLD;
            }
            if (!Double.TryParse(_inputSplw, out _inputVplw))
            {
                _inputVplw = POWER_LOW_WARNING_AMT;
            }
            if (!Double.TryParse(_inputSESPHighThreshold, out _inputVESPHighThreshold))
            {
                _inputVESPHighThreshold = ESPHighThreshold;
            }
            if (!Double.TryParse(_inputSESPMediumThreshold, out _inputVESPMediumThreshold))
            {
                _inputVESPMediumThreshold = ESPMediumThreshold;
            }
            if (!Double.TryParse(_inputSESPLowThreshold, out _inputVESPLowThreshold))
            {
                _inputVESPLowThreshold = ESPLowThreshold;
            }
            //Apply rules to the ESPThresholds. High must be 1% or higher
            // Medium must be 5% more than High or higher.
            // Low must be 5% more than Medium or higher.
            if (_inputVESPHighThreshold < 1)
            {
                _inputVESPHighThreshold = ESPHighThreshold = 1;
                _inputSESPHighThreshold = _inputVESPHighThreshold.ToString();
                ScreenMessages.PostScreenMessage(
                    Localizer.Format("#autoLOC_AmpYear_1000221"), 5.0f,                         // #autoLOC_AmpYear_1000221 = ESP High Threshold must be 1% or greater. Reset to 1%
                    ScreenMessageStyle.UPPER_CENTER);
            }
            if (_inputVESPMediumThreshold < ESPHighThreshold + 5)
            {
                _inputVESPMediumThreshold = ESPMediumThreshold = ESPHighThreshold + 5;
                _inputSESPMediumThreshold = _inputVESPMediumThreshold.ToString();
                ScreenMessages.PostScreenMessage(
                    Localizer.Format("#autoLOC_AmpYear_1000222", _inputVESPMediumThreshold.ToString("##")), 5.0f,                               // #autoLOC_AmpYear_1000222 = ESP Medium Threshold must be 5% More than High Threshhold. Reset to
                    ScreenMessageStyle.UPPER_CENTER);
            }
            if (_inputVESPLowThreshold < ESPMediumThreshold + 5)
            {
                _inputVESPLowThreshold = ESPLowThreshold = ESPMediumThreshold + 5;
                _inputSESPLowThreshold = _inputVESPLowThreshold.ToString();
                ScreenMessages.PostScreenMessage(
                    Localizer.Format("#autoLOC_AmpYear_1000223", _inputVESPLowThreshold.ToString("##")), 5.0f,                          // #autoLOC_AmpYear_1000223 = ESP Low Threshold must be 5% More than Medium Threshhold. Reset to
                    ScreenMessageStyle.UPPER_CENTER);
            }
            if (!Double.TryParse(_inputSEmgcyShutOverrideCooldown, out _inputVEmgcyShutOverrideCooldown))
            {
                _inputVEmgcyShutOverrideCooldown = EmgcyShutOverrideCooldown;
            }
            if (_inputVEmgcyShutOverrideCooldown < 30)
            {
                _inputVEmgcyShutOverrideCooldown = 30;
                _inputSEmgcyShutOverrideCooldown = "30";
                ScreenMessages.PostScreenMessage(
                    Localizer.Format("#autoLOC_AmpYear_1000224"), 5.0f, ScreenMessageStyle.UPPER_CENTER);                               // #autoLOC_AmpYear_1000224 = ESP Cooldown Period must be at least 30 secs. Reset to 30 secs.
            }

            if (KKPresent)
            {
                if (!Double.TryParse(_inputSccbdf, out _inputVccbdf))
                {
                    _inputVccbdf = CLIMATE_BASE_DRAIN_FACTOR;
                }
                if (!float.TryParse(_inputSctt, out _inputVctt))
                {
                    _inputVctt = CLIMATE_TARGET_TEMP;
                }
                if (!Double.TryParse(_inputSmbdf, out _inputVmbdf))
                {
                    _inputVmbdf = MASSAGE_BASE_DRAIN_FACTOR;
                }
                if (!Double.TryParse(_inputScbdf, out _inputVcbdf))
                {
                    _inputVcbdf = CRAZY_BASE_DRAIN_FACTOR;
                }
                if (!Double.TryParse(_inputSccuf, out _inputVccuf))
                {
                    _inputVccuf = CRAZY_CLIMATE_UNCOMF_FACTOR;
                }
                if (!Double.TryParse(_inputSccrf, out _inputVccrf))
                {
                    _inputVccrf = CRAZY_CLIMATE_REDUCE_FACTOR;
                }
                if (!Double.TryParse(_inputScrrf, out _inputVcrrf))
                {
                    _inputVcrrf = CRAZY_RADIO_REDUCE_FACTOR;
                }
                if (!Double.TryParse(_inputScmrf, out _inputVcmrf))
                {
                    _inputVcmrf = CRAZY_MASSAGE_REDUCE_FACTOR;
                }
                if (!Double.TryParse(_inputScMinL, out _inputVcMinL))
                {
                    _inputVcMinL = CRAZY_MINOR_LIMIT;
                }
                if (!Double.TryParse(_inputScMajL, out _inputVcMajL))
                {
                    _inputVcMajL = CRAZY_MAJOR_LIMIT;
                }
            }

            if (GUILayout.Button(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000225"), Localizer.Format("#autoLOC_AmpYear_1000226"))))           // #autoLOC_AmpYear_1000225 = Save Settings		// #autoLOC_AmpYear_1000226 = This will save you settings changes to the config.cfg file
            {
                CLIMATE_BASE_DRAIN_FACTOR   = _inputVccbdf;
                CLIMATE_TARGET_TEMP         = _inputVctt;
                MASSAGE_BASE_DRAIN_FACTOR   = _inputVmbdf;
                RECHARGE_RESERVE_THRESHOLD  = _inputVrrt / 100;
                POWER_LOW_WARNING_AMT       = _inputVplw;
                CRAZY_BASE_DRAIN_FACTOR     = _inputVcbdf;
                CRAZY_CLIMATE_UNCOMF_FACTOR = _inputVccuf;
                CRAZY_CLIMATE_REDUCE_FACTOR = _inputVccrf;
                CRAZY_RADIO_REDUCE_FACTOR   = _inputVcrrf;
                CRAZY_MASSAGE_REDUCE_FACTOR = _inputVcmrf;
                CRAZY_MINOR_LIMIT           = _inputVcMinL;
                CRAZY_MAJOR_LIMIT           = _inputVcMajL;
                if (Useapplauncher != _inputAppL)
                {
                    Useapplauncher = _inputAppL;
                    AYSCMenuAppLToolBar.chgAppIconStockToolBar(Useapplauncher);
                }
                Useapplauncher            = _inputAppL;
                _debugging                = _inputVdebug;
                Utilities.debuggingOn     = _debugging;
                _toolTipsOn               = _inputToolTipsOn;
                ESPHighThreshold          = _inputVESPHighThreshold;
                ESPMediumThreshold        = _inputVESPMediumThreshold;
                ESPLowThreshold           = _inputVESPLowThreshold;
                EmgcyShutOverrideCooldown = _inputVEmgcyShutOverrideCooldown;
                AYMonitoringUseEC         = _inputAYMonitoringUseEC;
                ProdPartHighlightColor    = _inputProdPartHighlightColor;
                ConsPartHighlightColor    = _inputConsPartHighlightColor;
                //Textures.SetupHighLightStyles(ProdPartHighlightColor, ConsPartHighlightColor);
                PartModuleEmergShutDnDflt.Clear();
                foreach (KeyValuePair <ValidEmergencyPartModule, ESPValues> validentry in _inputPartModuleEmergShutDnDflt)
                {
                    PartModuleEmergShutDnDflt.Add(new KeyValuePair <ValidEmergencyPartModule, ESPValues>(validentry.Key, validentry.Value));
                }
                LoadSettingsSC = true;
                if (KKPresent)
                {
                    SaveKKSettings();
                }
            }
            if (GUILayout.Button(new GUIContent(Localizer.Format("#autoLOC_AmpYear_1000227"), Localizer.Format("#autoLOC_AmpYear_1000228"))))           // #autoLOC_AmpYear_1000227 = Reset Settings		// #autoLOC_AmpYear_1000228 = This will reload the settings from the config.cfg without saving your changes
            {
                LoadSettingsSC = true;
            }
            if (_toolTipsOn)
            {
                Utilities.SetTooltipText();
            }
            GUI.DragWindow();
        }
        private void DrawSettings(int id)
        {
            GUIContent closeContent = new GUIContent(Textures.BtnRedCross, "Close Window");
            Rect       closeRect    = new Rect(settingsRect.width - 21, 4, 16, 16);

            if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle))
            {
                showSettings = false;
                return;
            }

            GUILayout.BeginVertical();
            langSettingsScroll = GUILayout.BeginScrollView(langSettingsScroll);
            GUILayout.BeginVertical();
            GUILayout.Box(Locales.currentLocale.Values["misc_lang"], Textures.sectionTitleStyle);
            for (int i = 0; i < Locales.locales.Count; i++)
            {
                if (GUILayout.Button(Locales.locales[i].LocaleFull))
                {
                    Locales.currentLocale = Locales.locales[i];
                    Locales.Save(Locales.locales[i]);
                    Locales.LoadDiscoveryMessages();
                    OnLocaleChanged(Locales.currentLocale);
                }
            }

            bool _inputAppL = Database.UseAppLauncher;

            if (!ToolbarManager.ToolbarAvailable)
            {
                GUI.enabled = false;
                tmpToolTip  = Locales.currentLocale.Values["settings_useAppLTT_TBNA"];
            }
            else
            {
                tmpToolTip = Locales.currentLocale.Values["settings_useAppLTT_TBA"];
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Locales.currentLocale.Values["settings_useAppL"], tmpToolTip), Textures.statusStyle, GUILayout.Width(250));
            _inputAppL = GUILayout.Toggle(_inputAppL, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (Database.UseAppLauncher != _inputAppL)
            {
                Database.UseAppLauncher = _inputAppL;
                RBMenuAppLToolBar.chgAppIconStockToolBar(Database.UseAppLauncher);
            }
            GUI.enabled = true;

            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            /* GUI.Label(new Rect(10, 195, 280, 32), Locales.currentLocale.Values["misc_instructor"]);
             * if (GUI.Button(new Rect(10, 232, 130, 32), "Wernher von Kerman"))
             * {
             *  if (File.Exists("GameData/ResearchBodies/PluginData/cacheInstructor"))
             *  {
             *      StreamReader sr = new StreamReader("GameData/ResearchBodies/PluginData/cacheInstructor");
             *      string line = sr.ReadLine();
             *
             *      sr.Close();
             *  }
             * }
             * if (GUI.Button(new Rect(150, 232, 130, 32), "Gene Kerman"))
             * { } */
            GUILayout.EndVertical();
            Utilities.SetTooltipText();
            GUI.DragWindow();
        }
        private void windowSC(int id)
        {
            GUIContent closeContent = new GUIContent(Textures.BtnRedCross, "Close Window");
            Rect       closeRect    = new Rect(SCwindowPos.width - 21, 4, 16, 16);

            if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle))
            {
                TSTMenuAppLToolBar.onAppLaunchToggle();
                return;
            }

            //Settings Menu
            GUILayout.BeginVertical();
            // Begin the ScrollView
            CamscrollViewVector = GUILayout.BeginScrollView(CamscrollViewVector);
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Small Size setting of ChemCam Window in pixels", "Small Size setting of ChemCam Window in pixels"), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputSChemwinSml = Regex.Replace(GUILayout.TextField(InputSChemwinSml, 4, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");  //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (!int.TryParse(InputSChemwinSml, out InputVChemwinSml))
            {
                InputVChemwinSml = TSTMstStgs.Instance.TSTsettings.ChemwinSml;
            }
            if (InputVChemwinSml > Utilities.scaledScreenWidth - 20)
            {
                InputVChemwinSml = Utilities.scaledScreenWidth - 20;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Large Size setting of ChemCam Window in pixels", "Large Size setting of ChemCam Window in pixels"), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputSChemwinLge = Regex.Replace(GUILayout.TextField(InputSChemwinLge, 4, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");  //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (!int.TryParse(InputSChemwinLge, out InputVChemwinLge))
            {
                InputVChemwinLge = TSTMstStgs.Instance.TSTsettings.ChemwinLge;
            }
            if (InputVChemwinLge > Utilities.scaledScreenWidth - 20)
            {
                InputVChemwinLge = Utilities.scaledScreenWidth - 20;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Small Size setting of Telescope Window in pixels", "Small Size setting of Telescope Window in pixels"), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputSTelewinSml = Regex.Replace(GUILayout.TextField(InputSTelewinSml, 4, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");  //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (!int.TryParse(InputSTelewinSml, out InputVTelewinSml))
            {
                InputVTelewinSml = TSTMstStgs.Instance.TSTsettings.TelewinSml;
            }
            if (InputVTelewinSml > Utilities.scaledScreenWidth - 20)
            {
                InputVTelewinSml = Utilities.scaledScreenWidth - 20;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Large Size setting of Telescope Window in pixels", "Large Size setting of Telescope Window in pixels"), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputSTelewinLge = Regex.Replace(GUILayout.TextField(InputSTelewinLge, 4, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");  //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (!int.TryParse(InputSTelewinLge, out InputVTelewinLge))
            {
                InputVTelewinLge = TSTMstStgs.Instance.TSTsettings.TelewinLge;
            }
            if (InputVTelewinLge > Utilities.scaledScreenWidth - 20)
            {
                InputVTelewinLge = Utilities.scaledScreenWidth - 20;
            }
            if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX ||
                HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
            {
                GUI.enabled = false;
                tmpToolTip  = "Only Available in Career Mode";
            }
            else
            {
                tmpToolTip = "The maximum number of ChemCam Contracts that can be offered at one time capped at 20";
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Maximum ChemCam Contracts", tmpToolTip), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputSMaxChemCamContracts = Regex.Replace(GUILayout.TextField(InputSMaxChemCamContracts, 4, GUILayout.MinWidth(30.0F)), "[^.0-9]", "");  //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (!int.TryParse(InputSMaxChemCamContracts, out InputVMaxChemCamContracts))
            {
                InputVMaxChemCamContracts = TSTMstStgs.Instance.TSTsettings.maxChemCamContracts;
            }
            if (InputVMaxChemCamContracts > 20)
            {
                InputVMaxChemCamContracts = 20;
            }

            GUI.enabled = true;

            if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX ||
                HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
            {
                GUI.enabled = false;
                tmpToolTip  = "Only Available in Career Mode";
            }
            else
            {
                tmpToolTip = "ChemCam Contracts are only offered for bodies that have already been photographed";
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("ChemCam contracts restricted", tmpToolTip), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputphotoOnlyChemCamContracts = GUILayout.Toggle(InputphotoOnlyChemCamContracts, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            if (!ToolbarManager.ToolbarAvailable)
            {
                GUI.enabled = false;
                tmpToolTip  = "Not available unless ToolBar mod is installed";
            }
            else
            {
                tmpToolTip =
                    "If ON TST Icon will appear in the stock Applauncher, if OFF TST Icon will appear in ToolBar mod";
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Use Stock App Icon", tmpToolTip), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputUseAppLauncher = GUILayout.Toggle(InputUseAppLauncher, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("Debug Logging ON", "Only turn this on if you are experiencing issues with TST and wish to capture a more verbose log to report on the forums."), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            Inputdebugging = GUILayout.Toggle(Inputdebugging, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent("ToolTips ON", "If ON you will see this ToolTip, and others. If OFF ToolTips are not shown"), statusStyle, GUILayout.Width(SCwindow_SettingWidth));
            InputTooltips = GUILayout.Toggle(InputTooltips, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();

            // End the ScrollView
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(new GUIContent("Save & Exit Settings", "Save & Exit Settings"), GUILayout.Width(155f)))
            {
                TSTMstStgs.Instance.TSTsettings.ChemwinSml = InputVChemwinSml;
                TSTMstStgs.Instance.TSTsettings.ChemwinLge = InputVChemwinLge;
                TSTMstStgs.Instance.TSTsettings.TelewinSml = InputVTelewinSml;
                TSTMstStgs.Instance.TSTsettings.TelewinLge = InputVTelewinLge;
                if (TSTMstStgs.Instance.TSTsettings.UseAppLauncher != InputUseAppLauncher)
                {
                    TSTMstStgs.Instance.TSTsettings.UseAppLauncher = InputUseAppLauncher;
                    TSTMenuAppLToolBar.chgAppIconStockToolBar(TSTMstStgs.Instance.TSTsettings.UseAppLauncher);
                }
                TSTMstStgs.Instance.TSTsettings.debugging                 = Inputdebugging;
                TSTMstStgs.Instance.TSTsettings.Tooltips                  = InputTooltips;
                TSTMstStgs.Instance.TSTsettings.maxChemCamContracts       = InputVMaxChemCamContracts;
                TSTMstStgs.Instance.TSTsettings.photoOnlyChemCamContracts = InputphotoOnlyChemCamContracts;
                LoadConfig = true;
                TSTMstStgs.Instance.TSTsettings.Save(TSTMstStgs.Instance.globalNode);
                TSTMenuAppLToolBar.GuiVisible = !TSTMenuAppLToolBar.GuiVisible;
            }
            if (GUILayout.Button(new GUIContent("Reset Settings", "Reset Settings"), GUILayout.Width(155f)))
            {
                LoadConfig = true;
            }
            GUILayout.EndHorizontal();
            //Settings Menu
            GUILayout.EndVertical();
            GUILayout.Space(14);

            GUIContent resizeContent = new GUIContent(Textures.BtnResize, "Resize Window");
            Rect       resizeRect    = new Rect(SCwindowPos.width - 17, SCwindowPos.height - 17, 16, 16);

            GUI.Label(resizeRect, resizeContent, Textures.ResizeStyle);
            HandleResizeEvents(resizeRect);
            if (TSTMstStgs.Instance.TSTsettings.Tooltips)
            {
                Utilities.SetTooltipText();
            }

            GUI.DragWindow();
        }