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

Commit

Permalink
Fix some issues with events. Partially revert editor GUI change.
Browse files Browse the repository at this point in the history
  • Loading branch information
magico13 committed May 1, 2016
1 parent 4a5b3bf commit 91ad9ce
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
14 changes: 9 additions & 5 deletions Kerbal_Construction_Time/KCT_Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,19 @@ public void addEvents()
}
});*/

GameEvents.onGUIAdministrationFacilitySpawn.Add(() => { KCT_GUI.hideAll(); });
GameEvents.onGUIAstronautComplexSpawn.Add(() => { KCT_GUI.hideAll(); });
GameEvents.onGUIMissionControlSpawn.Add(() => { KCT_GUI.hideAll(); });
GameEvents.onGUIRnDComplexSpawn.Add(() => { KCT_GUI.hideAll(); });
GameEvents.onGUIKSPediaSpawn.Add(() => { KCT_GUI.hideAll(); });
GameEvents.onGUIAdministrationFacilitySpawn.Add(HideAllGUIs);
GameEvents.onGUIAstronautComplexSpawn.Add(HideAllGUIs);
GameEvents.onGUIMissionControlSpawn.Add(HideAllGUIs);
GameEvents.onGUIRnDComplexSpawn.Add(HideAllGUIs);
GameEvents.onGUIKSPediaSpawn.Add(HideAllGUIs);

eventAdded = true;
}

public void HideAllGUIs()
{
KCT_GUI.hideAll();
}
/* public void LevelLoadedEvent(GameScenes scene)
{
List<GameScenes> validScenes = new List<GameScenes> { GameScenes.SPACECENTER, GameScenes.TRACKSTATION, GameScenes.EDITOR };
Expand Down
17 changes: 13 additions & 4 deletions Kerbal_Construction_Time/KCT_GUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ public static void hideAll()
showSimLengthChooser = false;
showPresetSaver = false;
showLaunchSiteSelector = false;


if (!KCT_GameStates.settings.PreferBlizzyToolbar)
{
if (KCT_Events.instance != null && KCT_Events.instance.KCTButtonStock != null)
{
KCT_Events.instance.KCTButtonStock.SetFalse(true);
}
}
clicked = false;

//VABSelected = false;
Expand Down Expand Up @@ -450,10 +459,10 @@ private static void DrawEditorGUI(int windowID)
//GUILayout.Label("Total Build Points (BP):", GUILayout.ExpandHeight(true));
//GUILayout.Label(Math.Round(buildTime, 2).ToString(), GUILayout.ExpandHeight(true));
GUILayout.BeginHorizontal();
GUILayout.Label("Build Time at rate: ");
GUILayout.Label("Build Time at ");
if (buildRateForDisplay == null) buildRateForDisplay = KCT_Utilities.GetBuildRate(0, type, null).ToString();
buildRateForDisplay = GUILayout.TextField(buildRateForDisplay, GUILayout.Width(75));
// GUILayout.Label(" BP/s:");
GUILayout.Label(" BP/s:");
List<double> rates = new List<double>();
if (type == KCT_BuildListVessel.ListType.VAB) rates = KCT_Utilities.BuildRatesVAB(null);
else rates = KCT_Utilities.BuildRatesSPH(null);
Expand Down Expand Up @@ -544,10 +553,10 @@ private static void DrawEditorGUI(int windowID)

KCT_BuildListVessel.ListType type = EditorLogic.fetch.launchSiteName == "LaunchPad" ? KCT_BuildListVessel.ListType.VAB : KCT_BuildListVessel.ListType.SPH;
GUILayout.BeginHorizontal();
GUILayout.Label("Build Time at rate: ");
GUILayout.Label("Build Time at ");
if (buildRateForDisplay == null) buildRateForDisplay = KCT_Utilities.GetBuildRate(0, type, null).ToString();
buildRateForDisplay = GUILayout.TextField(buildRateForDisplay, GUILayout.Width(75));
// GUILayout.Label(" BP/s:");
GUILayout.Label(" BP/s:");
List<double> rates = new List<double>();
if (ship.type == KCT_BuildListVessel.ListType.VAB) rates = KCT_Utilities.BuildRatesVAB(null);
else rates = KCT_Utilities.BuildRatesSPH(null);
Expand Down
2 changes: 1 addition & 1 deletion Kerbal_Construction_Time/KCT_GUI_BuildList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ public static void DrawBuildListWindow(int windowID)

GUILayout.EndVertical();

if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null && KCT_GameStates.settings.PreferBlizzyToolbar)
// if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null && KCT_GameStates.settings.PreferBlizzyToolbar)
if (!Input.GetMouseButtonDown(1) && !Input.GetMouseButtonDown(2))
GUI.DragWindow();
}
Expand Down

0 comments on commit 91ad9ce

Please sign in to comment.