예제 #1
0
 void DrawMainWindow(int windowID)
 {
     //help button
     if (GUI.Button(new Rect(WindowPos.width - 23f, 0f, 20f, 18f),
                    new GUIContent("?", "Help"), Styles.label))
     {
         TCAManual.ToggleInstance();
     }
     if (TCA.IsControllable)
     {
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         //tca toggle
         var enabled_style = Styles.inactive_button;
         if (CFG.Enabled)
         {
             enabled_style = Styles.enabled_button;
         }
         else if (!VSL.LandedOrSplashed)
         {
             if (EnabledBlinker.On)
             {
                 enabled_style = Styles.danger_button;
             }
             Status(0.1, "red", "<b>TCA is disabled</b>");
         }
         if (GUILayout.Button("Enabled", enabled_style, GUILayout.Width(70)))
         {
             TCA.ToggleTCA();
         }
                         #if DEBUG
         if (GUILayout.Button("ReGlobals", Styles.active_button, GUILayout.ExpandWidth(false)))
         {
             Globals.Load();
             Styles.ConfigureButtons();
             TCA.OnReloadGlobals();
         }
                         #endif
         //squad mode switch
         if (SQD != null)
         {
             SQD.Draw();
         }
         GUILayout.FlexibleSpace();
         StatusString();
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         GUILayout.BeginVertical(Styles.white, GUILayout.MinHeight(ControlsHeight), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true));
         if (ActiveTab != null)
         {
             ActiveTab.Draw();
         }
         GUILayout.EndVertical();
         tabs_scroll = GUILayout.BeginScrollView(tabs_scroll, Styles.white, GUILayout.ExpandHeight(true), GUILayout.Width(55));
         for (int i = 0, AllTabsCount = AllTabs.Count; i < AllTabsCount; i++)
         {
             var t = AllTabs[i];
             if (t.DrawTabButton(t == ActiveTab))
             {
                 ActiveTab     = t;
                 CFG.ActiveTab = i;
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndHorizontal();
         DrawStatusMessage();
         GUILayout.EndVertical();
     }
     else
     {
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         VSL.Info.Draw();
         GUILayout.FlexibleSpace();
         StatusString();
         GUILayout.EndHorizontal();
         GUILayout.Label("Vessel is Uncontrollable", Styles.label, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
         DrawStatusMessage();
         GUILayout.EndVertical();
     }
     TooltipsAndDragWindow();
 }
 void DrawMainWindow(int windowID)
 {
     //help button
     if (GUI.Button(new Rect(0, 0f, 20f, 18f),
                    Collapsed? uncollapse_button : collapse_button, Styles.label))
     {
         Collapsed        = !Collapsed;
         draw_main_window = Collapsed;
         if (Collapsed)
         {
             ShowOnHover_fade_in_timer.Reset();
             ShowOnHover_fade_out_timer.Reset();
             update_collapsed_rect();
         }
     }
     if (GUI.Button(new Rect(WindowPos.width - 20f, 0f, 20f, 18f),
                    help_button, Styles.label))
     {
         TCAManual.ToggleInstance();
     }
     //vessel switching
     if (HaveRemoteControl)
     {
         if (GUI.Button(new Rect(22, 0f, 20f, 18f), prev_vessel_button, Styles.label))
         {
             switch_vessel(FlightGlobals.Vessels.Next);
         }
         if (RemoteControl &&
             GUI.Button(new Rect(44, 0f, 20f, 18f), active_vessel_button, Styles.label))
         {
             onVesselChange(ActiveVesselTCA.vessel);
         }
         if (RemoteControl &&
             GUI.Button(new Rect(WindowPos.width - 64f, 0f, 20f, 18f), switch_vessel_button, Styles.label))
         {
             FlightGlobals.SetActiveVessel(vessel);
         }
         if (GUI.Button(new Rect(WindowPos.width - 42f, 0f, 20f, 18f), next_vessel_button, Styles.label))
         {
             switch_vessel(FlightGlobals.Vessels.Prev);
         }
     }
     if (TCA.IsControllable)
     {
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         //tca toggle
         var enabled_style = Styles.inactive_button;
         if (CFG.Enabled)
         {
             enabled_style = Styles.enabled_button;
         }
         else if (!VSL.LandedOrSplashed && EnabledBlinker.On)
         {
             enabled_style = Styles.danger_button;
         }
         if (GUILayout.Button("Enabled", enabled_style, GUILayout.Width(70)))
         {
             TCA.ToggleTCA();
         }
         #if DEBUG
         if (GUILayout.Button("ReGlobals", Styles.active_button, GUILayout.ExpandWidth(false)))
         {
             Globals.Load();
             Styles.ConfigureButtons();
             TCA.OnReloadGlobals();
         }
         #endif
         //squad mode switch
         if (SQD != null)
         {
             SQD.Draw();
         }
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         GUILayout.BeginVertical(Styles.white, GUILayout.MinHeight(ControlsHeight), GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true));
         if (ActiveTab != null)
         {
             ActiveTab.Draw();
         }
         GUILayout.EndVertical();
         tabs_scroll = GUILayout.BeginScrollView(tabs_scroll, Styles.white, GUILayout.ExpandHeight(true), GUILayout.Width(55));
         for (int i = 0, AllTabsCount = AllTabs.Count; i < AllTabsCount; i++)
         {
             var t = AllTabs[i];
             if (t.DrawTabButton(t == ActiveTab))
             {
                 ActiveTab     = t;
                 CFG.ActiveTab = i;
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndHorizontal();
         GUILayout.EndVertical();
     }
     else
     {
         GUILayout.BeginVertical();
         GUILayout.BeginHorizontal();
         VSL.Info.Draw();
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.Label("Vessel is Uncontrollable", Styles.label, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
         GUILayout.EndVertical();
     }
     TooltipsAndDragWindow();
 }