コード例 #1
0
ファイル: InfoModule.cs プロジェクト: sopindm/bjeb
        protected override void onSetup(Screen screen)
        {
            window.area.set(1100, 200, 300, 200);
            content.views.clear();

            _stats.Clear();

            _stats.Add(new StatLabel("Mass", (() => vessel.body.mass.ToString("F2") + " t")));
            _stats.Add(new StatLabel("Forward", (() => vessel.rootRotation.forward.ToString())));
            _stats.Add(new StatLabel("Inclination", (() => (vessel.orbit.inclination * 180 / Math.PI) .ToString())));
            _stats.Add(new StatLabel("LAN", (() => (vessel.orbit.LAN * 180 / Math.PI).ToString())));
            _stats.Add(new StatLabel("Parameter", (() => vessel.orbit.parameter.ToString())));
            _stats.Add(new StatLabel("Eccentricity", (() => vessel.orbit.eccentricity.ToString())));
            _stats.Add(new StatLabel("True anomaly", (() => vessel.orbit.trueAnomaly.ToString())));
            _stats.Add(new StatLabel("Argument of periapsis", (() => (vessel.orbit.argumentOfPeriapsis * 180 / Math.PI).ToString())));
            _stats.Add(new StatLabel("Time at periapsis", (() => vessel.orbit.timeAtPeriapsis.ToString())));

            _stats.Add(new StatLabel("Bodies", (() =>
                    {
                        string names = "";

                        foreach(var body in computer.universe.celestialBodies)
                            names += " " + body.name;

                        return names;
                    })));

            _statsLayout.views.clear();
            _statsLayout.style = Style.TextArea;

            foreach(var stat in _stats)
                _statsLayout.views.add(stat.view);

            content.views.add(_statsLayout);
        }
コード例 #2
0
ファイル: ASASModule.cs プロジェクト: sopindm/bjeb
        protected override void onSetup(Screen screen)
        {
            window.area.set(0, 200, 320, 180);
            content.views.clear();

            Layout referenceLayout = Layout.makeHorizontal();

            referenceLayout.views.add(optionToggle("ORB", false));
            referenceLayout.views.add(optionToggle("SUR", true));
            referenceLayout.views.add(optionToggle("TRG", false));

            referenceLayout.views.add(new Space());

            _yawOn = optionToggle("YAW", true);
            _pitchOn = optionToggle("PCH", true);
            _rollOn = optionToggle("RLL", true);

            referenceLayout.views.add(_yawOn);
            referenceLayout.views.add(_pitchOn);
            referenceLayout.views.add(_rollOn);

            active = false;

            _yaw = new AxisController("YAW", true);
            _pitch = new AxisController("PITCH", false);
            _roll = new AxisController("ROLL", true);

            content.views.add(referenceLayout);
            content.views.add(new Space(10));
            content.views.add(_yaw.view);
            content.views.add(new Space(10));
            content.views.add(_pitch.view);
            content.views.add(new Space(10));
            content.views.add(_roll.view);
            content.views.add(new Space(10));

            content.views.add(makeOptionsLayout());
        }
コード例 #3
0
ファイル: Computer.cs プロジェクト: sopindm/bjeb
        public void onSetup(Screen screen)
        {
            _window = new gui.Window();
            _window.area.set(screen.width - 550, 50, 200, 50);

            _window.title = "BJEB";
            _window.draggable = true;
            _window.skin = gui.Skin.Window7;

            _window.views.clear();

            _window.views.add(new Button("D") { area = new Area(_window.area.width.Value - 60, 5, 20, 20),
                        onClick = ((b, m) => {
                                if(_window.draggable)
                                {
                                    b.text = "F";
                                    _window.draggable = false;
                                }
                                else
                                {
                                    b.text = "D";
                                    _window.draggable = true;
                                }}) });

            Layout content = Layout.makeVertical();

            _window.views.add(new Button("_")
                { area = new Area(_window.area.width.Value - 40, 5, 20, 20),
                        onClick = ((b, m) => {
                                if(content.isShowing)
                                {
                                    content.hide();
                                    _window.area.height = 50;
                                }
                                else content.show(); })});

            _window.views.add(new Button("X") { area = new Area(_window.area.width.Value - 20, 5, 20, 20) });

            _switches.Clear();

            foreach(var module in modules)
            {
                _switches.Add(module, new ModuleSwitch(content, module));
                module.show();
            }

            _window.views.add(content);
            _window.views.add(new Layout());

            foreach(var module in modules)
            {
                module.setup(screen);
            }
        }
コード例 #4
0
ファイル: AttitudeController.cs プロジェクト: sopindm/bjeb
        protected override void onSetup(Screen screen)
        {
            window.area.set(300, 500, 400, 150);
            content.views.clear();

            _sensetivity = new Selector(0.1f, 1, 10, "Sensetivity");
            _inertia = new Selector(1, 1, 10, "Inertia");

            content.views.add(_sensetivity.view);

            _controller = new PIDControllerV(10000, 0, 800, -1000000, 1000000);

            target = Quaternion.identity;

            controlYaw = Control.No;
            controlPitch = Control.No;
            controlRoll = Control.No;
        }
コード例 #5
0
ファイル: Module.cs プロジェクト: sopindm/bjeb
        public void setup(Screen screen)
        {
            window.draggable = true;
            window.title = name;
            window.skin = gui.Skin.Window7;

            window.views.clear();

            window.views.add(content);
            window.views.add(new Layout());

            content.views.clear();
            onSetup(screen);

            window.views.add(new Button("D") { area = new Area(window.area.width.Value - 60, 5, 20, 20),
                        onClick = ((b, m) => {
                                if(window.draggable)
                                {
                                    b.text = "F";
                                    window.draggable = false;
                                }
                                else
                                {
                                    b.text = "D";
                                    window.draggable = true;
                                }}) });

            window.views.add(new Button("_")
                { area = new Area(window.area.width.Value - 40, 5, 20, 20),
                        onClick = ((b, m) => {
                                if(content.isShowing)
                                {
                                    content.hide();
                                    window.area.height = 50;
                                }
                                else content.show(); })});

            window.views.add(new Button("X") { area = new Area(window.area.width.Value - 20, 5, 20, 20),
                        onClick= ((b, m) => hide())});
        }
コード例 #6
0
ファイル: Module.cs プロジェクト: sopindm/bjeb
 protected abstract void onSetup(Screen screen);
コード例 #7
0
ファイル: Protocol.cs プロジェクト: sopindm/CodeSamples
        public static DebugSettings requestSetup(Connection connection, Screen screen)
        {
            connection.stream.write("setup");
            screen.serialize(connection.stream);
            connection.flush();

            DebugSettings settings = new DebugSettings();
            settings.deserialize(connection.stream);

            return settings;
        }
コード例 #8
0
ファイル: ClientProtocol.cs プロジェクト: sopindm/CodeSamples
        public void setup(Screen screen)
        {
            _windows = null;

            _settings = Protocol.requestSetup(_connection, screen);
            _guiUpdateHandler = new UpdateHandler(_settings.guiUpdateRate);
            _stateUpdateHandler = new UpdateHandler(_settings.stateUpdateRate);

            _background.wait();
            _background = new Task(() =>
                    {
                        if(_settings.updateGui)
                            _client.execute(() => Protocol.requestGuiUpdate(_windows, _connection));

                        _requestGui();
                    });
        }