Ejemplo n.º 1
0
        private void UpdateDeployment(double deltaTime)
        {
            var hasSignal = !RemoteTechHook.Instance.HasAnyConnection(Shared.Vessel.id) || Shared.Vessel.HasCrewControl();

            if (hasSignal)
            {
                if (!signalLossWarning)
                {
                    DrawStatus("Signal lost.  Waiting to re-acquire signal.");
                    progressBarSubBuffer.Enabled = true;
                    signalLossWarning            = true;
                }
            }
            else
            {
                if (signalLossWarning)
                {
                    if (double.IsPositiveInfinity(waitTotal))
                    {
                        waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
                    }
                    signalLossWarning = false;
                }

                waitElapsed += Math.Min(deltaTime, waitTotal - waitElapsed);
                DrawProgressBar(waitElapsed, waitTotal);

                if (waitElapsed == waitTotal)
                {
                    if (deployingBatch)
                    {
                        // deploy all commands
                        foreach (string commandText in batchQueue)
                        {
                            base.ProcessCommand(commandText);
                        }

                        batchQueue.Clear();
                        deployingBatch = false;
                    }
                    else
                    {
                        // deploy first command
                        if (commandQueue.Count > 0)
                        {
                            string commandText = commandQueue[0];
                            commandQueue.RemoveAt(0);
                            base.ProcessCommand(commandText);
                        }
                    }

                    StopDeployment();
                }
            }
        }
Ejemplo n.º 2
0
        private void UpdateDeployment(double deltaTime)
        {
            if (!RemoteTechHook.Instance.HasAnyConnection(_shared.Vessel.id))
            {
                if (!_signalLossWarning)
                {
                    DrawStatus("Signal lost.  Waiting to re-acquire signal.");
                    _progressBarSubBuffer.Enabled = true;
                    _signalLossWarning            = true;
                }
            }
            else
            {
                if (_signalLossWarning)
                {
                    if (double.IsPositiveInfinity(_waitTotal))
                    {
                        _waitTotal = RemoteTechUtility.GetTotalWaitTime(_shared.Vessel);
                    }
                    _signalLossWarning = false;
                }

                _waitElapsed += Math.Min(deltaTime, _waitTotal - _waitElapsed);
                DrawProgressBar(_waitElapsed, _waitTotal);

                if (_waitElapsed == _waitTotal)
                {
                    if (_deployingBatch)
                    {
                        // deploy all commands
                        foreach (string commandText in _batchQueue)
                        {
                            base.ProcessCommand(commandText);
                        }

                        _batchQueue.Clear();
                        _deployingBatch = false;
                    }
                    else
                    {
                        // deploy first command
                        if (_commandQueue.Count > 0)
                        {
                            string commandText = _commandQueue[0];
                            _commandQueue.RemoveAt(0);
                            base.ProcessCommand(commandText);
                        }
                    }

                    StopDeployment();
                }
            }
        }
Ejemplo n.º 3
0
        public void Update(double deltaTime)
        {
            if (!deploymentInProgress && commandQueue.Count > 0 && !BatchMode)
            {
                waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
                StartDeployment();
                deltaTime = 0; // so the elapsed time is zero in this update
            }

            if (deploymentInProgress)
            {
                UpdateDeployment(deltaTime);
            }
        }
Ejemplo n.º 4
0
        private void ProcessDeployCommand()
        {
            if (!BatchMode)
            {
                throw new Exception("Batch mode is not active.");
            }
            if (batchQueue.Count == 0)
            {
                throw new Exception("There are no commands to deploy.");
            }

            waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
            if (double.IsPositiveInfinity(waitTotal))
            {
                throw new Exception("No connection available.");
            }

            Print("Deploying...");
            BatchMode      = false;
            deployingBatch = true;
            StartDeployment();
        }