コード例 #1
0
        protected override void draw_gui()
        {
            //handle collapsed state
            if (Collapsed)
            {
                if (ShowOnHover)
                {
                    if (Event.current.type == EventType.Repaint)
                    {
                        draw_main_window = WindowPos.Contains(Event.current.mousePosition);
                    }
                    if (!draw_main_window)
                    {
                        UnlockControls();
                        var prefix = CFG.Enabled?
                                     "<b><color=lime>TCA: </color></b>" :
                                     (VSL.LandedOrSplashed? "<b>TCA: </b>" : "<b><color=red>TCA: </color></b>");
                        GUI.Label(collapsed_rect, prefix + StatusString(), Styles.boxed_label);
                    }
                }
                else
                {
                    UnlockControls();
                    GUI.Label(collapsed_rect, new GUIContent("TCA", "Push to show Main Window"),
                              CFG.Enabled? Styles.green : (VSL.LandedOrSplashed? Styles.white : Styles.red));
                    if (Input.GetMouseButton(0) && collapsed_rect.Contains(Event.current.mousePosition))
                    {
                        Collapsed = false;
                    }
                    TooltipManager.GetTooltip();
                }
            }
            else
            {
                draw_main_window = true;
            }
            //draw main window if allowed
            if (draw_main_window)
            {
                LockControls();
                WindowPos =
                    GUILayout.Window(TCA.GetInstanceID(),
                                     WindowPos,
                                     DrawMainWindow,
                                     RemoteControl? "RC: " + vessel.vesselName : vessel.vesselName,
                                     GUILayout.Width(ControlsWidth),
                                     GUILayout.Height(50)).clampToScreen();
                update_collapsed_rect();
            }
            //draw waypoints and all subwindows
            if (RemoteControl && Event.current.type == EventType.Repaint)
            {
                Markers.DrawWorldMarker(TCA.vessel.transform.position, Color.green,
                                        "Remotely Controlled Vessel", NavigationTab.PathNodeMarker, 8);
            }
            if (NAV != null)
            {
                NAV.DrawWaypoints();
            }
            AllWindows.ForEach(w => w.Draw());
            ModulesGraph.Draw();

                        #if DEBUG
            GUI.Label(debug_rect,
                      string.Format("[{0}] {1:HH:mm:ss.fff}",
                                    TCA != null && vessel != null? vessel.situation.ToString() : "",
                                    DateTime.Now),
                      Styles.boxed_label);
                        #endif
        }
コード例 #2
0
 protected override void draw_gui()
 {
     //draw main window if allowed
     if (draw_main_window)
     {
         LockControls();
         WindowPos =
             GUILayout.Window(TCA.GetInstanceID(),
                              WindowPos,
                              DrawMainWindow,
                              RemoteControl? "RC: " + vessel.vesselName : vessel.vesselName,
                              GUILayout.Width(ControlsWidth),
                              GUILayout.Height(50)).clampToScreen();
         update_collapsed_rect();
     }
     //handle collapsed state
     if (Collapsed)
     {
         if (ShowOnHover)
         {
             if (!draw_main_window)
             {
                 UnlockControls();
                 var prefix = CFG.Enabled?
                              Colors.Enabled.Tag("<b>TCA</b>") :
                              (VSL.LandedOrSplashed? "<b>TCA</b>" :
                               Colors.Danger.Tag("<b>TCA</b>"));
                 GUI.Label(collapsed_rect, prefix, Styles.boxed_label);
             }
             if (Event.current.type == EventType.Repaint)
             {
                 if (WindowPos.Contains(Event.current.mousePosition))
                 {
                     draw_main_window = ShowOnHover_fade_in_timer.TimePassed;
                     if (draw_main_window)
                     {
                         ShowOnHover_fade_out_timer.Reset();
                     }
                 }
                 else
                 {
                     draw_main_window = !ShowOnHover_fade_out_timer.TimePassed;
                     if (!draw_main_window)
                     {
                         ShowOnHover_fade_in_timer.Reset();
                     }
                 }
             }
         }
         else
         {
             UnlockControls();
             draw_main_window = false;
             GUI.Label(collapsed_rect, new GUIContent("TCA", "Push to show Main Window"),
                       CFG.Enabled? Styles.enabled : (VSL.LandedOrSplashed? Styles.white : Styles.danger));
             if (Input.GetMouseButton(0) && collapsed_rect.Contains(Event.current.mousePosition))
             {
                 draw_main_window = true;
                 Collapsed        = false;
             }
             TooltipManager.GetTooltip();
         }
     }
     else
     {
         draw_main_window = true;
     }
     //draw waypoints
     NAV?.DrawWaypoints();
     if (RemoteControl &&
         Event.current.type == EventType.Repaint)
     {
         Markers.DrawWorldMarker(TCA.vessel.transform.position, Colors.Good,
                                 "Remotely Controlled Vessel", NavigationTab.PathNodeMarker, 8);
     }
 }