@@ -180,8 +180,17 @@ internal override void Awake()
180180 GameEvents . onGameSceneLoadRequested . Add ( OnGameSceneLoadRequestedForAppLauncher ) ;
181181 GameEvents . Contract . onContractsLoaded . Add ( ContractsReady ) ;
182182
183- // Need this one to handle the hideUI cancelling via pause menu
184- GameEvents . onGameUnpause . Add ( OnUnpause ) ;
183+ GameEvents . onGUIAdministrationFacilitySpawn . Add ( EnterKSCFacility ) ;
184+ GameEvents . onGUIAstronautComplexSpawn . Add ( EnterKSCFacility ) ;
185+ GameEvents . onGUIMissionControlSpawn . Add ( EnterKSCFacility ) ;
186+ GameEvents . onGUIRnDComplexSpawn . Add ( EnterKSCFacility ) ;
187+ GameEvents . onGUIAdministrationFacilityDespawn . Add ( LeaveKSCFacility ) ;
188+ GameEvents . onGUIAstronautComplexDespawn . Add ( LeaveKSCFacility ) ;
189+ GameEvents . onGUIMissionControlDespawn . Add ( LeaveKSCFacility ) ;
190+ GameEvents . onGUIRnDComplexDespawn . Add ( LeaveKSCFacility ) ;
191+
192+ // Need this one to handle the hideUI cancelling via pause menu
193+ GameEvents . onGameUnpause . Add ( OnUnpause ) ;
185194
186195 blnFilterToVessel = false ;
187196 if ( HighLogic . LoadedScene == GameScenes . TRACKSTATION ||
@@ -212,7 +221,7 @@ internal override void Awake()
212221 APIAwake ( ) ;
213222 }
214223
215- private void InitAudio ( )
224+ private void InitAudio ( )
216225 {
217226 audioController = AddComponent < AudioController > ( ) ;
218227 audioController . mbKAC = this ;
@@ -275,8 +284,17 @@ internal override void OnDestroy()
275284 GameEvents . onGameSceneLoadRequested . Remove ( OnGameSceneLoadRequestedForAppLauncher ) ;
276285 GameEvents . Contract . onContractsLoaded . Remove ( ContractsReady ) ;
277286
278- // Need this one to handle the hideUI cancelling via pause menu
279- GameEvents . onGameUnpause . Remove ( OnUnpause ) ;
287+ GameEvents . onGUIAdministrationFacilitySpawn . Remove ( EnterKSCFacility ) ;
288+ GameEvents . onGUIAstronautComplexSpawn . Remove ( EnterKSCFacility ) ;
289+ GameEvents . onGUIMissionControlSpawn . Remove ( EnterKSCFacility ) ;
290+ GameEvents . onGUIRnDComplexSpawn . Remove ( EnterKSCFacility ) ;
291+ GameEvents . onGUIAdministrationFacilityDespawn . Remove ( LeaveKSCFacility ) ;
292+ GameEvents . onGUIAstronautComplexDespawn . Remove ( LeaveKSCFacility ) ;
293+ GameEvents . onGUIMissionControlDespawn . Remove ( LeaveKSCFacility ) ;
294+ GameEvents . onGUIRnDComplexDespawn . Remove ( LeaveKSCFacility ) ;
295+
296+ // Need this one to handle the hideUI cancelling via pause menu
297+ GameEvents . onGameUnpause . Remove ( OnUnpause ) ;
280298
281299
282300 Destroy ( PhaseAngle ) ;
@@ -302,9 +320,13 @@ void ContractsReady()
302320 blnContractsSystemReady = true ;
303321 }
304322
305- #region "Update Code"
306- //Update Function - Happens on every frame - this is where behavioural stuff is typically done
307- internal override void Update ( )
323+ //Hide the KAC when in SC overlay scenes
324+ private void EnterKSCFacility ( ) { inAdminFacility = true ; }
325+ private void LeaveKSCFacility ( ) { inAdminFacility = false ; }
326+
327+ #region "Update Code"
328+ //Update Function - Happens on every frame - this is where behavioural stuff is typically done
329+ internal override void Update ( )
308330 {
309331 KACWorkerGameState . SetCurrentGUIStates ( ) ;
310332 //if scene has changed
@@ -429,7 +451,7 @@ private void OnUnpause()
429451 }
430452
431453 private Boolean GUIVisible = true ;
432-
454+ private Boolean inAdminFacility = false ;
433455
434456 //public void OnGUI()
435457 internal override void OnGUIEvery ( )
@@ -464,7 +486,7 @@ internal override void OnGUIEvery()
464486 isPauseMenuOpen = PauseMenu . isOpen ;
465487 } catch { }
466488
467- if ( GUIVisible && blnFlightUIVisible && ! ( HighLogic . LoadedScene == GameScenes . FLIGHT && isPauseMenuOpen ) )
489+ if ( GUIVisible && blnFlightUIVisible && ! inAdminFacility && ! ( HighLogic . LoadedScene == GameScenes . FLIGHT && isPauseMenuOpen && settings . HideOnPause ) )
468490 {
469491 DrawGUI ( ) ;
470492 }
@@ -539,40 +561,22 @@ public void DrawGUI()
539561 //Draw the icon that should be there all the time
540562 DrawIcons ( ) ;
541563
542- Boolean blnShowInterface = true ;
543- Boolean isPauseMenuOpen = false ;
544- try
545- {
546- isPauseMenuOpen = PauseMenu . isOpen ;
547- }
548- catch { }
564+ // look for passed alarms to display stuff
565+ if ( IconShowByActiveScene )
566+ TriggeredAlarms ( ) ;
549567
550- if ( KACWorkerGameState . CurrentGUIScene == GameScenes . FLIGHT )
568+ //If the mainwindow is visible And no pause menu then draw it
569+ if ( WindowVisibleByActiveScene )
551570 {
552- if ( settings . HideOnPause && isPauseMenuOpen )
553- blnShowInterface = false ;
571+ DrawWindowsPre ( ) ;
572+ DrawWindows ( ) ;
573+ DrawWindowsPost ( ) ;
574+
554575 }
555576
556- //If game has pause menu up see whether to display the interface
557- if ( blnShowInterface )
577+ if ( settings . WarpToEnabled )
558578 {
559- // look for passed alarms to display stuff
560- if ( IconShowByActiveScene )
561- TriggeredAlarms ( ) ;
562-
563- //If the mainwindow is visible And no pause menu then draw it
564- if ( WindowVisibleByActiveScene )
565- {
566- DrawWindowsPre ( ) ;
567- DrawWindows ( ) ;
568- DrawWindowsPost ( ) ;
569-
570- }
571-
572- if ( settings . WarpToEnabled )
573- {
574- DrawNodeButtons ( ) ;
575- }
579+ DrawNodeButtons ( ) ;
576580 }
577581
578582 //Do the stuff to lock inputs of people have that turned on
0 commit comments