public WaypointTraveller(MotorControl motorControl, IMyRemoteControl mainControl, IMyTextSurface outputSurface)
        {
            this.motorControl  = motorControl;
            this.mainControl   = mainControl;
            this.outputSurface = outputSurface;

            this.currentPointIndex = 0;
            this.travelState       = TravelState.Stopped;
            this.path = new Waypath("Default Path", new List <Waypoint>());

            commandTree = new PanelCommander.CommandTree()
            {
                label    = "Waypath Traveller",
                commands = new List <PanelCommander.Command>()
                {
                    new PanelCommander.Command()
                    {
                        label = "Travel", action = Travel
                    },
                    new PanelCommander.Command()
                    {
                        label = "Pause", action = Pause
                    },
                    new PanelCommander.Command()
                    {
                        label = "Skip", action = Skip
                    },
                    new PanelCommander.Command()
                    {
                        label = "Back", action = Back
                    },
                    new PanelCommander.Command()
                    {
                        label = "Reset", action = Reset
                    },
                    new PanelCommander.Command()
                    {
                        label = "Stop", action = Stop
                    },
                },
                subtrees = new List <PanelCommander.CommandTree>(),
            };
        }
Ejemplo n.º 2
0
        void Initalize()
        {
            var positionedWheels = DetectWheels();
            var control          = DetectControls();
            var cockpits         = DetectCockpits();
            var displayPanels    = DetectPanels(cockpits);
            var gyros            = DetectGyroscopes();

            this.ticker = new Ticker();
            this.motor  = new MotorControl(positionedWheels, control);

            this.mainControl    = control;
            this.traveller      = new WaypointTraveller(motor, control, displayPanels[0]);
            this.greedleManager = new GreedleManager(IGC, null);
            this.recorder       = new WaypathRecorder(
                mainControl,
                new Waypath("Default Waypath", new List <Waypoint>()),
                displayPanels[1],
                OnRecorderPathUpdate
                );
            this.pathOutput = displayPanels[2];

            this.commander = new PanelCommander(
                new PanelCommander.CommandTree()
            {
                label    = "Main Menu",
                subtrees = new List <PanelCommander.CommandTree>()
                {
                    traveller.commandTree,
                    greedleManager.commandTree,
                    recorder.commandTree,
                },
                commands = new List <PanelCommander.Command>()
                {
                    new PanelCommander.Command()
                    {
                        label = "Save State to CustomData", action = SaveToData
                    },
                    new PanelCommander.Command()
                    {
                        label = "Load State from CustomData", action = LoadFromData
                    },
                    new PanelCommander.Command()
                    {
                        label = "Set Greedles to Path", action = DeployGreedles
                    },
                    new PanelCommander.Command()
                    {
                        label = "Switch Waypath", action = NextWaypath
                    },
                    new PanelCommander.Command()
                    {
                        label = "New Waypath", action = StartNewWaypath
                    },
                    new PanelCommander.Command()
                    {
                        label = "Delete Waypath", action = RemoveWaypath
                    },
                    new PanelCommander.Command()
                    {
                        label = "Dump Traveller GPS Data to Surface", action = TravellerDump
                    },
                }
            },
                displayPanels[displayPanels.Length - 2]
                );

            Load();
            DrawPaths();
        }