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 (ORSAtmosphericResource atmospheric_resource in ORSAtmosphericResourceHandler.getAtmosphericCompositionForBody(vessel.mainBody.flightGlobalsIndex))
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.Label(atmospheric_resource.getDisplayName(), GUILayout.Width(150));
                        string resource_abundance_str;
                        if (atmospheric_resource.getResourceAbundance() > 0.001)
                        {
                            resource_abundance_str = (atmospheric_resource.getResourceAbundance() * 100.0).ToString() + "%";
                        }
                        else
                        {
                            if (atmospheric_resource.getResourceAbundance() > 0.000001)
                            {
                                resource_abundance_str = (atmospheric_resource.getResourceAbundance() * 1e6).ToString() + " ppm";
                            }
                            else
                            {
                                resource_abundance_str = (atmospheric_resource.getResourceAbundance() * 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();
        }
Exemple #2
0
        public void ToggleResource() {
            currentresource++;

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

            if (currentresource >= ORSAtmosphericResourceHandler.getAtmosphericCompositionForBody(vessel.mainBody.flightGlobalsIndex).Count) {
                currentresource = 0;
            }
        }