コード例 #1
0
        public override void OnGUIEvery()
        {
            if (!Visible) return;

            var button_width = StyleFactory.ButtonLaunchStyle.fixedWidth;
            var button_height = StyleFactory.ButtonLaunchStyle.fixedHeight;

            switch (_launchState)
            {
                case LaunchStates.Normal:
                    //launch
                    if (GUI.Button(new Rect(WindowRect.xMin, WindowRect.yMax - _delta, button_width, button_height),
                        string.Empty,
                        StyleFactory.ButtonLaunchStyle))
                    {
                        _launcher.Run();
                        _launchState = LaunchStates.Launch;
                    }

                    //sequence
                    if (
                        GUI.Button(
                            new Rect(WindowRect.xMin + button_width, WindowRect.yMax - _delta, button_width, button_height),
                            string.Empty,
                            StyleFactory.ButtonSequenceStyle))
                    {
                        Visible = false;
                        _launchSequenceWindow.WindowRect.x = WindowRect.x;
                        _launchSequenceWindow.WindowRect.y = WindowRect.y;
                        _launchSequenceWindow.Visible = true;
                        _launchState = LaunchStates.Sequence;
                    }

                    //settings
                    if (
                        GUI.Button(
                            new Rect(WindowRect.xMin + button_width * 2, WindowRect.yMax - _delta, button_width, button_height),
                            string.Empty,
                            StyleFactory.ButtonSettingsStyle))
                    {
                        Visible = false;
                        _settingsWindow.WindowRect.x = WindowRect.x;
                        _settingsWindow.WindowRect.y = WindowRect.y;
                        _settingsWindow.Visible = true;
                        _launchState = LaunchStates.Settings;
                    }

                    break;
                case LaunchStates.Launch:
                    //abort
                    if (GUI.Button(new Rect(WindowRect.xMin, WindowRect.yMax - _delta, button_width, button_height),
                        string.Empty,
                        StyleFactory.ButtonAbortStyle))
                    {
                        _launcher.Abort();
                        _launchState = LaunchStates.Normal;
                        _tick = 0;
                    }
                    TimeWarp.SetRate(0, false);
                    break;
                case LaunchStates.Abort:
                case LaunchStates.Settings:
                case LaunchStates.Fly:
                    DebugHelper.WriteMessage("Current launch state {0}", _launchState);
                    break;
            }
        }
コード例 #2
0
 void _launcher_OnVesselAborted(object sender, EventArgs e)
 {
     _tick = 0;
     _launchState = LaunchStates.Normal;
 }
コード例 #3
0
 void WindowOnClosed(object sender, EventArgs eventArgs)
 {
     _launchState = LaunchStates.Normal;
     Visible = true;
 }
コード例 #4
0
        public override void OnGUIEvery()
        {
            if (!Visible)
            {
                return;
            }

            var button_width  = StyleFactory.ButtonLaunchStyle.fixedWidth;
            var button_height = StyleFactory.ButtonLaunchStyle.fixedHeight;


            switch (_launchState)
            {
            case LaunchStates.Normal:
                //launch
                if (GUI.Button(new Rect(WindowRect.xMin, WindowRect.yMax - _delta, button_width, button_height),
                               string.Empty,
                               StyleFactory.ButtonLaunchStyle))
                {
                    _launcher.Run();
                    _launchState = LaunchStates.Launch;
                }

                //sequence
                if (
                    GUI.Button(
                        new Rect(WindowRect.xMin + button_width, WindowRect.yMax - _delta, button_width, button_height),
                        string.Empty,
                        StyleFactory.ButtonSequenceStyle))
                {
                    Visible = false;
                    _launchSequenceWindow.WindowRect.x = WindowRect.x;
                    _launchSequenceWindow.WindowRect.y = WindowRect.y;
                    _launchSequenceWindow.Visible      = true;
                    _launchState = LaunchStates.Sequence;
                }

                //settings
                if (
                    GUI.Button(
                        new Rect(WindowRect.xMin + button_width * 2, WindowRect.yMax - _delta, button_width, button_height),
                        string.Empty,
                        StyleFactory.ButtonSettingsStyle))
                {
                    Visible = false;
                    _settingsWindow.WindowRect.x = WindowRect.x;
                    _settingsWindow.WindowRect.y = WindowRect.y;
                    _settingsWindow.Visible      = true;
                    _launchState = LaunchStates.Settings;
                }

                break;

            case LaunchStates.Launch:
                //abort
                if (GUI.Button(new Rect(WindowRect.xMin, WindowRect.yMax - _delta, button_width, button_height),
                               string.Empty,
                               StyleFactory.ButtonAbortStyle))
                {
                    _launcher.Abort();
                    _launchState = LaunchStates.Normal;
                    _tick        = 0;
                }
                TimeWarp.SetRate(0, false);
                break;

            case LaunchStates.Abort:
            case LaunchStates.Settings:
            case LaunchStates.Fly:
                DebugHelper.WriteMessage("Current launch state {0}", _launchState);
                break;
            }
        }
コード例 #5
0
 void WindowOnClosed(object sender, EventArgs eventArgs)
 {
     _launchState = LaunchStates.Normal;
     Visible      = true;
 }
コード例 #6
0
 void _launcher_OnVesselAborted(object sender, EventArgs e)
 {
     _tick        = 0;
     _launchState = LaunchStates.Normal;
 }