示例#1
0
        private UIListItemContainer CreateBodyStage(int stageIndex, QStage qStage)
        {
            if (QSettings.Instance.VesselEngineer_hideEmptyStages && (qStage.deltaV == 0 || qStage.maxThrustToWeight == 0))
            {
                return(null);
            }
            UIListItemContainer _item = GCascadingList.CreateBody(textEditorStage(stageIndex, qStage.Body, qStage.Atmosphere), textEngineer(stageIndex, qStage), true);

            _item.AddInputDelegate(new EZInputDelegate(SetConfig));
            Log("Create body Stage: " + stageIndex, "QEditor");
            return(_item);
        }
示例#2
0
        private UIListItemContainer CreateBodyStage(int stageIndex, Stage stage, CelestialBody body = null, bool atmosphere = false)
        {
            if (QSettings.Instance.VesselEngineer_hideEmptyStages && (stage.deltaV == 0 || stage.maxThrustToWeight == 0))
            {
                return(null);
            }
            if (body == null)
            {
                body = QTools.Home;
            }
            UIListItemContainer _item = GCascadingList.CreateBody(textEditorStage(stageIndex, body, atmosphere), textEngineer(stageIndex, stage), true);

            _item.AddInputDelegate(new EZInputDelegate(SetConfig));
            Log("Create body Stage: " + stageIndex, "QEditor");
            return(_item);
        }
示例#3
0
        internal void UpdateEngineer(string title, bool calculation = false)
        {
            BTButton                   button;
            UIListItemContainer        header = GCascadingList.CreateHeader(textTitle(title), out button, true);
            UIListItemContainer        footer = GCascadingList.CreateFooter();
            List <UIListItemContainer> bodies = CreateVesselEngineerBody(calculation);

            if (VesselEngineer != null)
            {
                VesselEngineer = GCascadingList.ruiList.UpdateCascadingItem(VesselEngineer, header, footer, bodies, button);
            }
            else
            {
                VesselEngineer = GCascadingList.ruiList.AddCascadingItem(header, footer, bodies, button);
            }
            Log(title + "Engineer Updated", "QEditor");
        }
示例#4
0
        private List <UIListItemContainer> CreateVesselEngineerBody(bool calculation = false)
        {
            List <UIListItemContainer> _items = new List <UIListItemContainer> ();
            UIListItemContainer        _item;

            if (calculation)
            {
                _item = GCascadingList.CreateBody(textColor("Calculation..."), string.Empty);
            }
            else
            {
                List <QStage> _qStages   = null;
                Stage[]       _stages    = null;
                Stage         _lastStage = null;
                int           _length;
                bool          _simple = QSettings.Instance.EditorVesselEngineer_Simple;
                if (_simple)
                {
                    _stages    = QVessel.Stages;
                    _lastStage = QVessel.LastStage;
                    _length    = _stages.Length;
                }
                else
                {
                    _qStages = QStage.QStages;
                    _length  = QStage.stagesCount;
                }
                if ((!_simple || _stages != null) && _length > 0)
                {
                    for (int i = 0; i < _length; i++)
                    {
                        _item = null;
                        if (_simple)
                        {
                            Stage _stage = _stages [i];
                            _item = CreateBodyStage(i, _stage);
                        }
                        else
                        {
                            QStage _qStage = _qStages [i];
                            _item = CreateBodyStage(i, _qStage);
                        }
                        if (_item != null)
                        {
                            _items.Add(_item);
                        }
                    }
                }
                if (_items.Count > 0)
                {
                    _item = GCascadingList.CreateBody("Total deltaV:", (_simple ? textTotalDeltaV(_lastStage) : textTotalDeltaV(QStage.TotalDeltaV)));
                }
                else
                {
                    _item = GCascadingList.CreateBody(textColor("Click here to config"), string.Empty);
                }
            }
            _item.AddInputDelegate(new EZInputDelegate(SetConfig));
            _items.Add(_item);
            Log("VesselEngineer body created", "QEditor");
            return(_items);
        }