示例#1
0
        private void MainAtmDeltaV(int id)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            GUILayout.Label("<b>Bodies</b>", GUILayout.Width(45));
            GUILayout.Space(20);
            GUILayout.Label("<b>ATM deltaV</b>", GUILayout.Width(90));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            scrollAtmPosition = GUILayout.BeginScrollView(scrollAtmPosition, GUILayout.Height(200));
            int _bodiesCount = QBody.Bodies.Count;

            for (int i = 0; i < _bodiesCount; i++)
            {
                CelestialBody _body = QBody.Bodies [i];
                if (_body.atmosphere)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(_body.bodyName + ":", GUILayout.Width(50));
                    int _deltaV = 0;
                    if (int.TryParse(GUILayout.TextField(QBody.atmDeltaV(_body).ToString(), GUILayout.Width(50)), out _deltaV))
                    {
                        if (_deltaV != QBody.atmDeltaV(_body))
                        {
                            QBody.Set(_body, _deltaV);
                        }
                    }
                    GUILayout.Label("m/s");
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndScrollView();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Cancel"))
            {
                HideAtmDeltaV();
                QBody.Load();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Save"))
            {
                HideAtmDeltaV();
                QBody.Save();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
示例#2
0
 protected override void Start()
 {
     QSettings.Instance.Load();
     QBody.Load();
     if (!HighLogic.LoadedSceneIsEditor)
     {
         Warning("It's not Editor scene?", "QEditor");
         Destroy(this);
         return;
     }
     skin = HighLogic.Skin;
     skin.label.alignment = TextAnchor.MiddleCenter;
     GameEvents.onEditorShipModified.Add(OnEditorShipModified);
     GameEvents.onGUIEngineersReportReady.Add(EngineersReportReady);
     Log("Start", "QEditor");
 }
示例#3
0
 private void MainSettings(int id)
 {
     GUILayout.BeginVertical();
     GUILayout.BeginHorizontal();
     GUILayout.Box("Options", GUILayout.Height(25));
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     QSettings.Instance.AllVesselEngineer_Disable = GUILayout.Toggle(QSettings.Instance.AllVesselEngineer_Disable, "Always disable", GUILayout.Width(290));
     if (!QSettings.Instance.AllVesselEngineer_Disable)
     {
         GUILayout.FlexibleSpace();
         QSettings.Instance.FlightVesselEngineer_Disable = GUILayout.Toggle(QSettings.Instance.FlightVesselEngineer_Disable, "Disable in Flight", GUILayout.Width(290));
         GUILayout.FlexibleSpace();
         QSettings.Instance.EditorVesselEngineer_Simple = GUILayout.Toggle(QSettings.Instance.EditorVesselEngineer_Simple, "Editor calculation only on VAC", GUILayout.Width(290));
         GUILayout.EndHorizontal();
         GUILayout.Space(5);
         GUILayout.BeginHorizontal();
         QSettings.Instance.VesselEngineer_hidedeltaV = GUILayout.Toggle(QSettings.Instance.VesselEngineer_hidedeltaV, "Hide deltaV", GUILayout.Width(290));
         GUILayout.FlexibleSpace();
         QSettings.Instance.VesselEngineer_hideTWR = GUILayout.Toggle(QSettings.Instance.VesselEngineer_hideTWR, "Hide TWR", GUILayout.Width(290));
         GUILayout.FlexibleSpace();
         QSettings.Instance.VesselEngineer_hideEmptyStages = GUILayout.Toggle(QSettings.Instance.VesselEngineer_hideEmptyStages, "Hide stage with no deltaV/TWR", GUILayout.Width(290));
         GUILayout.EndHorizontal();
         GUILayout.Space(5);
         GUILayout.BeginHorizontal();
         QSettings.Instance.VesselEngineer_showEmptyTWR = GUILayout.Toggle(QSettings.Instance.VesselEngineer_showEmptyTWR, "Show max TWR", GUILayout.Width(290));
         GUILayout.FlexibleSpace();
         QSettings.Instance.VesselEngineer_showStageTotaldV = GUILayout.Toggle(QSettings.Instance.VesselEngineer_showStageTotaldV, "Show Total deltaV on stage", GUILayout.Width(290));
         if (QSettings.Instance.VesselEngineer_showStageTotaldV && QSettings.Instance.VesselEngineer_showStageTotaldV == QSettings.Instance.VesselEngineer_showStageInverseTotaldV)
         {
             QSettings.Instance.VesselEngineer_showStageInverseTotaldV = false;
         }
         GUILayout.FlexibleSpace();
         QSettings.Instance.VesselEngineer_showStageInverseTotaldV = GUILayout.Toggle(QSettings.Instance.VesselEngineer_showStageInverseTotaldV, "Show inverse Total deltaV on stage", GUILayout.Width(290));
         if (QSettings.Instance.VesselEngineer_showStageInverseTotaldV && QSettings.Instance.VesselEngineer_showStageTotaldV == QSettings.Instance.VesselEngineer_showStageInverseTotaldV)
         {
             QSettings.Instance.VesselEngineer_showStageTotaldV = false;
         }
         GUILayout.EndHorizontal();
         GUILayout.Space(5);
         GUILayout.BeginHorizontal();
         QSettings.Instance.Debug = GUILayout.Toggle(QSettings.Instance.Debug, "Show debug logs", GUILayout.Width(290));
         GUILayout.EndHorizontal();
         GUILayout.Space(5);
         if (!QSettings.Instance.EditorVesselEngineer_Simple)
         {
             GUILayout.BeginHorizontal();
             GUILayout.Box("Stages parameters", GUILayout.Height(25));
             GUILayout.EndHorizontal();
             GUILayout.BeginHorizontal();
             GUILayout.Space(20);
             GUILayout.Label("<b>Stages</b>", GUILayout.Width(50));
             GUILayout.Space(20);
             GUILayout.Label("<b>CelestialBody</b>", GUILayout.Width(120));
             GUILayout.Space(40);
             GUILayout.Label("<b>Atmospheric</b>", GUILayout.Width(100));
             GUILayout.Space(30);
             GUILayout.Label("<b>Corrected dV</b>", GUILayout.Width(120));
             GUILayout.Space(30);
             GUILayout.Label("<b>Altitude</b>", GUILayout.Width(150));
             GUILayout.Space(20);
             GUILayout.Label("<b>Mach</b>", GUILayout.Width(150));
             GUILayout.EndHorizontal();
             GUILayout.BeginHorizontal();
             scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Height(200));
             List <QStage> _qStages    = QStage.QStages;
             int           _stageCount = Math.Min(QStage.stagesCount, _qStages.Count);
             for (int i = 0; i < _stageCount; i++)
             {
                 QStage _qStage = _qStages [i];
                 if ((_qStage.Atmosphere && _qStage.atmStage == null) && (!_qStage.Atmosphere && _qStage.vacStage == null))
                 {
                     continue;
                 }
                 if (QSettings.Instance.VesselEngineer_hideEmptyStages && (_qStage.deltaV == 0 || _qStage.maxThrustToWeight == 0))
                 {
                     continue;
                 }
                 GUILayout.BeginHorizontal();
                 GUILayout.Label(string.Format("<b>Stage {0}:</b>", i), GUILayout.Width(50));
                 GUILayout.Space(20);
                 if (GUILayout.Button("◄", GUILayout.Width(20)))
                 {
                     int _index = QBody.Bodies.FindIndex(b => b == _qStage.Body) - 1;
                     if (_index < 0)
                     {
                         _index = QBody.Bodies.Count - 1;
                     }
                     _qStage.Body = QBody.Bodies [_index];
                 }
                 GUILayout.Label(_qStage.Body.bodyName, GUILayout.Width(90), GUILayout.Height(20));
                 if (GUILayout.Button("►", GUILayout.Width(20)))
                 {
                     int _index = QBody.Bodies.FindIndex(b => b == _qStage.Body) + 1;
                     if (_index >= QBody.Bodies.Count)
                     {
                         _index = 0;
                     }
                     _qStage.Body = QBody.Bodies [_index];
                 }
                 GUILayout.Space(20);
                 GUI.enabled = _qStage.Body.atmosphere;
                 if (!_qStage.Body.atmosphere)
                 {
                     _qStage.Atmosphere   = false;
                     _qStage.atmCorrected = false;
                     _qStage.Altitude     = 0f;
                     _qStage.Mach         = 0d;
                 }
                 _qStage.Atmosphere = GUILayout.Toggle(_qStage.Atmosphere, "Atmospheric", GUILayout.Width(100));
                 GUILayout.Space(40);
                 bool _canCorrecteddV = _qStage.Body.atmosphere && QBody.hasAtmValue(_qStage.Body);
                 GUI.enabled = _canCorrecteddV;
                 if (!_canCorrecteddV)
                 {
                     _qStage.atmCorrected = false;
                 }
                 _qStage.atmCorrected = GUILayout.Toggle(_qStage.atmCorrected, "Corrected dV", GUILayout.Width(120));
                 GUILayout.Space(40);
                 GUI.enabled      = _qStage.Body.atmosphere;
                 _qStage.Altitude = GUILayout.HorizontalSlider(_qStage.Altitude, 0f, (float)_qStage.Body.atmosphereDepth, GUILayout.Width(100), GUILayout.Height(30));
                 GUILayout.Label(string.Format("{0:0.0}km", (_qStage.Altitude / 1000)), GUILayout.Width(50));
                 GUILayout.Space(20);
                 float _maxMach = _qStage.maxMach;
                 _qStage.Mach = (double)GUILayout.HorizontalSlider(Mathf.Clamp((float)_qStage.Mach, 0f, _maxMach), 0f, _maxMach, GUILayout.Width(100), GUILayout.Height(30));
                 GUILayout.Label(string.Format("{0:0.00}", _qStage.Mach), GUILayout.Width(40));
                 GUI.enabled = true;
                 GUILayout.EndHorizontal();
             }
             GUILayout.EndScrollView();
             GUILayout.EndHorizontal();
         }
     }
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Add/Set Atmospheric value for celestial bodies"))
     {
         DisplayAtmDeltaV();
     }
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Close"))
     {
         HideApp();
     }
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }