Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Commit 91ad9ce

Browse files
committed
Fix some issues with events. Partially revert editor GUI change.
1 parent 4a5b3bf commit 91ad9ce

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

Kerbal_Construction_Time/KCT_Events.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,19 @@ public void addEvents()
6464
}
6565
});*/
6666

67-
GameEvents.onGUIAdministrationFacilitySpawn.Add(() => { KCT_GUI.hideAll(); });
68-
GameEvents.onGUIAstronautComplexSpawn.Add(() => { KCT_GUI.hideAll(); });
69-
GameEvents.onGUIMissionControlSpawn.Add(() => { KCT_GUI.hideAll(); });
70-
GameEvents.onGUIRnDComplexSpawn.Add(() => { KCT_GUI.hideAll(); });
71-
GameEvents.onGUIKSPediaSpawn.Add(() => { KCT_GUI.hideAll(); });
67+
GameEvents.onGUIAdministrationFacilitySpawn.Add(HideAllGUIs);
68+
GameEvents.onGUIAstronautComplexSpawn.Add(HideAllGUIs);
69+
GameEvents.onGUIMissionControlSpawn.Add(HideAllGUIs);
70+
GameEvents.onGUIRnDComplexSpawn.Add(HideAllGUIs);
71+
GameEvents.onGUIKSPediaSpawn.Add(HideAllGUIs);
7272

7373
eventAdded = true;
7474
}
7575

76+
public void HideAllGUIs()
77+
{
78+
KCT_GUI.hideAll();
79+
}
7680
/* public void LevelLoadedEvent(GameScenes scene)
7781
{
7882
List<GameScenes> validScenes = new List<GameScenes> { GameScenes.SPACECENTER, GameScenes.TRACKSTATION, GameScenes.EDITOR };

Kerbal_Construction_Time/KCT_GUI.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,15 @@ public static void hideAll()
339339
showSimLengthChooser = false;
340340
showPresetSaver = false;
341341
showLaunchSiteSelector = false;
342+
343+
344+
if (!KCT_GameStates.settings.PreferBlizzyToolbar)
345+
{
346+
if (KCT_Events.instance != null && KCT_Events.instance.KCTButtonStock != null)
347+
{
348+
KCT_Events.instance.KCTButtonStock.SetFalse(true);
349+
}
350+
}
342351
clicked = false;
343352

344353
//VABSelected = false;
@@ -450,10 +459,10 @@ private static void DrawEditorGUI(int windowID)
450459
//GUILayout.Label("Total Build Points (BP):", GUILayout.ExpandHeight(true));
451460
//GUILayout.Label(Math.Round(buildTime, 2).ToString(), GUILayout.ExpandHeight(true));
452461
GUILayout.BeginHorizontal();
453-
GUILayout.Label("Build Time at rate: ");
462+
GUILayout.Label("Build Time at ");
454463
if (buildRateForDisplay == null) buildRateForDisplay = KCT_Utilities.GetBuildRate(0, type, null).ToString();
455464
buildRateForDisplay = GUILayout.TextField(buildRateForDisplay, GUILayout.Width(75));
456-
// GUILayout.Label(" BP/s:");
465+
GUILayout.Label(" BP/s:");
457466
List<double> rates = new List<double>();
458467
if (type == KCT_BuildListVessel.ListType.VAB) rates = KCT_Utilities.BuildRatesVAB(null);
459468
else rates = KCT_Utilities.BuildRatesSPH(null);
@@ -544,10 +553,10 @@ private static void DrawEditorGUI(int windowID)
544553

545554
KCT_BuildListVessel.ListType type = EditorLogic.fetch.launchSiteName == "LaunchPad" ? KCT_BuildListVessel.ListType.VAB : KCT_BuildListVessel.ListType.SPH;
546555
GUILayout.BeginHorizontal();
547-
GUILayout.Label("Build Time at rate: ");
556+
GUILayout.Label("Build Time at ");
548557
if (buildRateForDisplay == null) buildRateForDisplay = KCT_Utilities.GetBuildRate(0, type, null).ToString();
549558
buildRateForDisplay = GUILayout.TextField(buildRateForDisplay, GUILayout.Width(75));
550-
// GUILayout.Label(" BP/s:");
559+
GUILayout.Label(" BP/s:");
551560
List<double> rates = new List<double>();
552561
if (ship.type == KCT_BuildListVessel.ListType.VAB) rates = KCT_Utilities.BuildRatesVAB(null);
553562
else rates = KCT_Utilities.BuildRatesSPH(null);

Kerbal_Construction_Time/KCT_GUI_BuildList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ public static void DrawBuildListWindow(int windowID)
10591059

10601060
GUILayout.EndVertical();
10611061

1062-
if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null && KCT_GameStates.settings.PreferBlizzyToolbar)
1062+
// if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null && KCT_GameStates.settings.PreferBlizzyToolbar)
10631063
if (!Input.GetMouseButtonDown(1) && !Input.GetMouseButtonDown(2))
10641064
GUI.DragWindow();
10651065
}

0 commit comments

Comments
 (0)