Exemplo n.º 1
0
 private void UpdateNavGlobals()
 {
     navUpdateTimer.Start();
     try
     {
         NavGlobals.Update();
     }
     finally
     {
         navUpdateTimer.Stop();
     }
 }
Exemplo n.º 2
0
            protected override void DrawOverlay()
            {
                int   w      = GetWidth();
                int   h      = GetHeight();
                int   margin = w / 20;
                float x0     = w - buttonSwitch.GetWidth() - margin;
                float y      = 4;

                if (buttonSwitch.Draw(x0, y))
                {
                    NavGlobals.SelectNextAirfield();
                }
            }
Exemplo n.º 3
0
            public void Update()
            {
                UpdateGauges();

                updateTimer.Start();
                try
                {
                    // if log level is at least INFO and performance statistics are enabled
                    // write statistical data in the log every 10 seconds
                    if (configuration.performanceStatisticsEnabled && Log.IsLogable(Log.LEVEL.INFO) && HighLogic.LoadedSceneIsFlight)
                    {
                        if (lastPerformanceLog + 10000 < timer.ElapsedMilliseconds)
                        {
                            lastPerformanceLog = timer.ElapsedMilliseconds;
                            Log.Info("Nanogauges performance statistics:\n" + TimedStatistics.instance.ToString());
                        }
                    }

                    // check for Profile Hotkeys
                    profileManager.Update();

                    // check for keys
                    //
                    gauges.ShowCloseButtons(hotkeyManager.GetKey(HotkeyManager.HOTKEY_CLOSE_AND_DRAG));

                    //
                    bool hotkeyPressed = hotkeyManager.GetKey(HotkeyManager.HOTKEY_MAIN); // Input.GetKey(hotkey);

                    // Hotkeys for Gaugesets
                    if (!hotkeyPressed)
                    {
                        // simple Hotkeys
                        if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_HIDE))
                        {
                            if (gauges.Hidden())
                            {
                                gauges.Unhide();
                            }
                            else
                            {
                                gauges.Hide();
                            }
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_PREVSET))
                        {
                            SetGaugeSet(configuration.GetGaugeSetId().decrement());
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_NEXTSET))
                        {
                            SetGaugeSet(configuration.GetGaugeSetId().increment());
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_LOCK_PROFILE))
                        {
                            profileManager.ToggleLock();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SELECT_NAV))
                        {
                            NavGlobals.SelectNextAirfield();
                        }
                    }
                    else
                    {
                        // Hotkeys in chord with main hotkey
                        //
                        if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_STANDARD))
                        {
                            SetGaugeSet(GaugeSet.ID.STANDARD);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_LAUNCH))
                        {
                            SetGaugeSet(GaugeSet.ID.LAUNCH);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_LAND))
                        {
                            SetGaugeSet(GaugeSet.ID.LAND);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_DOCK))
                        {
                            SetGaugeSet(GaugeSet.ID.DOCK);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_ORBIT))
                        {
                            SetGaugeSet(GaugeSet.ID.ORBIT);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_FLIGHT))
                        {
                            SetGaugeSet(GaugeSet.ID.FLIGHT);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET1))
                        {
                            SetGaugeSet(GaugeSet.ID.SET1);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET2))
                        {
                            SetGaugeSet(GaugeSet.ID.SET2);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_SET3))
                        {
                            SetGaugeSet(GaugeSet.ID.SET3);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_SET_ENABLE_ALL))
                        {
                            configuration.EnableAllGauges(gauges);
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_WINDOW_CONFIG))
                        {
                            createConfigOnce();
                            toggleConfigVisibility();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_STANDARDLAYOUT))
                        {
                            gauges.LayoutCurrentGaugeSet(new StandardLayout(NanoGauges.gauges, configuration));
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_ALT_HIDE))
                        {
                            if (gauges.Hidden())
                            {
                                gauges.Unhide();
                            }
                            else
                            {
                                gauges.Hide();
                            }
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_AUTOLAYOUT))
                        {
                            gauges.AutoLayout();
                        }
                        else if (hotkeyManager.GetKeyDown(HotkeyManager.HOTKEY_ALIGNMENT_GAUGE))
                        {
                            gauges.ShowAligmentGauge(!gauges.IsAligmentGaugeVisible());
                        }
                    }
                }
                finally
                {
                    updateTimer.Stop();
                }
                hotkeyManager.ignoring = false;
            }