public Program()
        {
            // init echo wrapper
            EchoR = log =>
            {
                EchoOutput.AppendLine(log);
                Echo(log);
            };

            debugTerminals       = new DebugTerminal(this);
            informationTerminals = new DisplayTerminal(this);
            terminalCycle        = SetTerminalCycle();

            this.BroadcastListener = this.IGC.RegisterBroadcastListener(STATE_BROADCAST_TAG);
            this.BroadcastListener.SetMessageCallback();

            // initialise the process steps we will need to do
            processSteps = new Action[]
            {
                ListenBroadcastMessages
            };

            Runtime.UpdateFrequency = FREQUENCY;

            EchoR(string.Format("Compiled {0} {1}", SCRIPT_NAME, VERSION_NICE_TEXT));

            // format terminal info text
            scriptUpdateText = string.Format(FORMAT_UPDATE_TEXT, SCRIPT_NAME, VERSION_NICE_TEXT);
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Program"/> class.
        /// </summary>
        public Program()
        {
            // init echo wrapper
            EchoR = log =>
            {
                echoOutput.AppendLine(log);
                Echo(log);
            };

            // init settings
            RetrieveCustomSetting();

            // initialise the process steps we will need to do
            processSteps = new Action[]
            {
                ProcessStepCheckBroadcastMessages,
                ProcessStepDetectGridsUsingSensor,
                ProcessStepDetectGridsUsingCamera,
                ProcessStepCleanDetectedEntities
            };

            Runtime.UpdateFrequency = FREQUENCY;

            CelestialMap      = new Map(this, celestialBodies);
            programmableBlock = new ProgrammableBlock(this);
            shipController    = new ShipController(this);
            textPanel         = new DisplayTerminal(this, CelestialMap);

            this.BroadcastListener = this.IGC.RegisterBroadcastListener(GpsBroadcastTag);
            this.BroadcastListener.SetMessageCallback();

            terminalCycle = SetTerminalCycle();

            EchoR(string.Format("Compiled {0} {1}", SCRIPT_NAME, VERSION_NICE_TEXT));

            // format terminal info text
            scriptUpdateText = string.Format(FORMAT_UPDATE_TEXT, SCRIPT_NAME, VERSION_NICE_TEXT);
        }
예제 #3
0
        public Program()
        {
            // init echo wrapper
            EchoR = log =>
            {
                EchoOutput.AppendLine(log);
                Echo(log);
            };

            _commands["shutdown"]     = Shutdown;
            _commands["reset"]        = Reset;
            _commands["test"]         = Test;
            _commands["start"]        = Start;
            _commands["stop"]         = Stop;
            _commands["step"]         = ExecuteStep;
            _commands["nextstep"]     = NextStep;
            _commands["addwaypoint"]  = AddWaypoint;
            _commands["nextwaypoint"] = NextWaypoint;

            RetrieveCustomSetting();
            RetrieveStorage();
            UpdateLastShipPosition();

            debugTerminals       = new DebugTerminal(this);
            informationTerminals = new DisplayTerminal(this);
            terminalCycle        = SetTerminalCycle();
            subProcessStepCycle  = SetSubProcessStepCycle();

            // initialise the process steps we will need to do
            processSteps = new Action[]
            {
                ProcessStepResetControl,                // 0
                ProcessStepConnectConnector,            // 1
                ProcessStepRechargeBatteries,           // 2
                ProcessStepDisconnectConnector,         // 3
                ProcessStepFindNextWaypoint,            // 4
                ProcessStepWaitBeforeUndocking,         // 5
                ProcessStepDoBeforeUndocking,           // 6
                ProcessStepUndockShip,                  // 7
                ProcessStepMoveAwayFromDock,            // 8
                ProcessStepResetThrustOverride,         // 9
                ProcessStepGoToWaypoint,                // 10
                ProcessStepTravelToWaypoint,            // 11
                ProcessStepDockToStation,               // 12
                ProcessStepWaitDockingCompletion,       // 13
                ProcessStepDisconnectConnector,         // 16
                ProcessStepResetThrustOverride,         // 14
                ProcessStepDoAfterDocking,              // 15
                ProcessStepWaitAtWaypoint,              // 17
                //ProcessStepWaitUndefinetely
            };

            Runtime.UpdateFrequency = UpdateFrequency.None;
            if (isRunning)
            {
                Runtime.UpdateFrequency = FREQUENCY;
            }

            EchoR(string.Format("Compiled {0} {1}", SCRIPT_NAME, VERSION_NICE_TEXT));

            // format terminal info text
            scriptUpdateText = string.Format(FORMAT_UPDATE_TEXT, SCRIPT_NAME, VERSION_NICE_TEXT);
        }