Ejemplo n.º 1
0
        protected override void DrawWindowContents(int windowID)
        {
            GUILayout.BeginVertical( );

            if (_filter.CurrentSituation != null && _parent.Science.CurrentVesselScience != null)
            {
                var desc = _filter.CurrentSituation.Description;
                GUILayout.Box
                (
                    new GUIContent
                    (
                        char.ToUpper(desc[0]) + desc.Substring(1),
                        MakeSituationToolTip( )
                    ),
                    _situationStyle,
                    GUILayout.Width(wScale(250))
                );
            }

            GUILayout.Space(wScale(10));

            GUILayout.BeginHorizontal();

            GUILayout.Label("Min Science", _scienceThresholdLabelStyle);

            float prev_scienceThreshold = _parent.Config.ScienceThreshold;
            float scienceThreshold      = Adds.AcceleratedSlider(_parent.Config.ScienceThreshold, 0.1f, 50f, 1.8f, new[] {
                new Adds.StepRule(0.5f, 10f),
                new Adds.StepRule(1f, 40f),
                new Adds.StepRule(2f, 50f),
            });

            if (prev_scienceThreshold != scienceThreshold)
            {
                _parent.Config.ScienceThreshold = scienceThreshold;
                _parent.Config.Save();
            }

            GUILayout.Label(_parent.Config.ScienceThreshold.ToString("F1"), _scienceThresholdLabelStyle, GUILayout.Width(wScale(26)));

            GUILayout.EndHorizontal();

            int Top = wScale(90);

            if (_filter.DisplayScienceInstances != null)
            {
                for (var i = 0; i < _filter.DisplayScienceInstances.Count; i++)
                {
                    var experiment = _filter.DisplayScienceInstances[i];

                    if (experiment.NextScienceIncome >= _parent.Config.ScienceThreshold)
                    {
                        var rect = new Rect(wScale(5), Top, wScale(250), wScale(30));
                        DrawExperiment(experiment, rect);
                        Top += wScale(35);
                    }
                }
            }
            else
            {
                _logger.Trace("DisplayExperiments is null");
            }



            if (_filter.DisplayScienceInstances.Count > 0)
            {
                GUILayout.Space(wScale(_filter.DisplayScienceInstances.Count * 35));                     // Leave space for experiments, as drawn above
            }
            GUILayout.Space(wScale(10));

            GUILayout.BeginHorizontal( );
            GUIContent Content = null;

            if (_parent.Config.StopTimeWarp)
            {
                Content = new GUIContent(_GfxTimeWarp, "Time warp will be stopped");
            }
            else
            {
                Content = new GUIContent(_GfxTimeWarpOff, "Time warp will not be stopped");
            }
            if (GUILayout.Button(Content, GUILayout.Width(wScale(36)), GUILayout.Height(wScale(32))))
            {
                _parent.Config.StopTimeWarp = !_parent.Config.StopTimeWarp;
                _parent.Config.Save( );
            }



            if (_parent.Config.PlayNoise)
            {
                Content = new GUIContent(_GfxAudioAlert, "Audio alert will sound");
            }
            else
            {
                Content = new GUIContent(_GfxAudioAlertOff, "No audio alert");
            }
            if (GUILayout.Button(Content, GUILayout.Width(wScale(36)), GUILayout.Height(wScale(32))))
            {
                _parent.Config.PlayNoise = !_parent.Config.PlayNoise;
                _parent.Config.Save( );
            }



            if (_parent.Config.ShowResultsWindow)
            {
                Content = new GUIContent(_GfxResultsWindow, "Show results window");
            }
            else
            {
                Content = new GUIContent(_GfxResultsWindowOff, "Supress results window");
            }
            if (GUILayout.Button(Content, GUILayout.Width(wScale(36)), GUILayout.Height(wScale(32))))
            {
                _parent.Config.ShowResultsWindow = !_parent.Config.ShowResultsWindow;
                _parent.Config.Save( );
            }
            GUILayout.EndHorizontal( );
            GUILayout.EndVertical( );

            GUILayout.Space(wScale(2));
        }