Ejemplo n.º 1
0
        private void Window(int windowID)
        {
            bold_label           = new GUIStyle(GUI.skin.label);
            bold_label.fontStyle = FontStyle.Bold;
            if (GUI.Button(new Rect(windowPosition.width - 20, 2, 18, 18), "x"))
            {
                render_window = false;
            }

            GUILayout.BeginVertical();
            if (vessel.altitude < PluginHelper.getMaxAtmosphericAltitude(vessel.mainBody))
            {
                if (analysis_count > analysis_length)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Gas", bold_label, GUILayout.Width(150));
                    GUILayout.Label("Abundance", bold_label, GUILayout.Width(150));
                    GUILayout.EndHorizontal();
                    GUILayout.Space(5);
                    foreach (AtmosphericResource atmospheric_resource in AtmosphericResourceHandler.GetAtmosphericCompositionForBody(vessel.mainBody.flightGlobalsIndex).Values)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label(atmospheric_resource.DisplayName, GUILayout.Width(150));
                        string resource_abundance_str;
                        if (atmospheric_resource.ResourceAbundance > 0.001)
                        {
                            resource_abundance_str = (atmospheric_resource.ResourceAbundance * 100.0).ToString() + "%";
                        }
                        else
                        {
                            if (atmospheric_resource.ResourceAbundance > 0.000001)
                            {
                                resource_abundance_str = (atmospheric_resource.ResourceAbundance * 1e6).ToString() + " ppm";
                            }
                            else
                            {
                                resource_abundance_str = (atmospheric_resource.ResourceAbundance * 1e9).ToString() + " ppb";
                            }
                        }
                        GUILayout.Label(resource_abundance_str, GUILayout.Width(150));
                        GUILayout.EndHorizontal();
                    }
                }
                else
                {
                    double percent_analysed = (double)analysis_count / analysis_length * 100;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Analysing...", GUILayout.Width(150));
                    GUILayout.Label(percent_analysed.ToString("0.00") + "%", GUILayout.Width(150));
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                GUILayout.Label("--No Atmosphere to Sample--", GUILayout.ExpandWidth(true));
                analysis_count = 0;
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
Ejemplo n.º 2
0
        public void ToggleResource()
        {
            currentresource++;

            if (AtmosphericResourceHandler.getAtmosphericResourceName(vessel.mainBody.flightGlobalsIndex, currentresource) == null &&
                AtmosphericResourceHandler.getAtmosphericResourceContent(vessel.mainBody.flightGlobalsIndex, currentresource) > 0 &&
                currentresource != 0)
            {
                ToggleResource();
            }

            if (currentresource >= AtmosphericResourceHandler.GetAtmosphericCompositionForBody(vessel.mainBody.flightGlobalsIndex).Count)
            {
                currentresource = 0;
            }

            resflow  = String.Empty;
            resflowf = 0;
        }
Ejemplo n.º 3
0
        private void Window(int windowID)
        {
            bold_label = new GUIStyle(GUI.skin.label)
            {
                fontStyle = FontStyle.Bold
            };

            if (GUI.Button(new Rect(windowPosition.width - 20, 2, 18, 18), "x"))
            {
                render_window = false;
            }

            GUILayout.BeginVertical();
            if (vessel.altitude < PluginHelper.GetMaxAtmosphericAltitude(vessel.mainBody))
            {
                if (analysis_count > analysis_length)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(Localizer.Format("#LOC_KSPIE_FNMassSpectrometer_Gas"), bold_label, GUILayout.Width(150));     //"Gas"
                    GUILayout.Label(Localizer.Format("#LOC_KSPIE_MassSpectrometer_Abundance"), bold_label, GUILayout.Width(150)); //"Abundance"
                    GUILayout.EndHorizontal();
                    GUILayout.Space(5);
                    foreach (var atmospheric_resource in AtmosphericResourceHandler.GetAtmosphericCompositionForBody(vessel.mainBody).Values)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label(atmospheric_resource.DisplayName, GUILayout.Width(150));
                        string resource_abundance_str;
                        if (atmospheric_resource.ResourceAbundance > 0.001)
                        {
                            resource_abundance_str = (atmospheric_resource.ResourceAbundance * 100.0) + "%";
                        }
                        else
                        {
                            if (atmospheric_resource.ResourceAbundance > 0.000001)
                            {
                                resource_abundance_str = (atmospheric_resource.ResourceAbundance * 1e6) + " ppm";
                            }
                            else
                            {
                                resource_abundance_str = (atmospheric_resource.ResourceAbundance * 1e9) + " ppb";
                            }
                        }
                        GUILayout.Label(resource_abundance_str, GUILayout.Width(150));
                        GUILayout.EndHorizontal();
                    }
                }
                else
                {
                    double percent_analysed = (double)analysis_count / analysis_length * 100;
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(Localizer.Format("#LOC_KSPIE_MassSpectrometer_Analysing"), GUILayout.Width(150));//"Analysing..."
                    GUILayout.Label(percent_analysed.ToString("0.00") + "%", GUILayout.Width(150));
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                GUILayout.Label(Localizer.Format("#LOC_KSPIE_FNLCMassSpectrometer_NoAtomspheretoSample"), GUILayout.ExpandWidth(true));//"--No Atmosphere to Sample--"
                analysis_count = 0;
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }