1- using BepInEx . Logging ;
2- using KSP . Game ;
1+ using KSP . Game ;
32using KSP . Messages ;
3+ using KSP . UI . Binding ;
4+ using UnityEngine ;
45
56namespace MicroMod
67{
@@ -11,8 +12,6 @@ internal class MessageManager
1112 private UI _ui ;
1213 internal List < BaseWindow > Windows ;
1314
14- private static readonly ManualLogSource _logger = Logger . CreateLogSource ( "MicroEngineer.MessageManager" ) ;
15-
1615 internal MessageManager ( MicroEngineerMod plugin , Manager manager , UI ui )
1716 {
1817 _plugin = plugin ;
@@ -71,8 +70,6 @@ private void OnPartManipulationCompletedMessage(MessageCenterMessage obj)
7170
7271 private void GameStateEntered ( MessageCenterMessage obj )
7372 {
74- _logger . LogInfo ( "Message triggered: GameStateEnteredMessage" ) ;
75-
7673 Utility . RefreshGameManager ( ) ;
7774 if ( Utility . GameState . GameState == GameState . FlightView || Utility . GameState . GameState == GameState . VehicleAssemblyBuilder || Utility . GameState . GameState == GameState . Map3DView )
7875 {
@@ -81,11 +78,15 @@ private void GameStateEntered(MessageCenterMessage obj)
8178 _ui . Windows = Windows ;
8279
8380 if ( Utility . GameState . GameState == GameState . FlightView || Utility . GameState . GameState == GameState . Map3DView )
81+ {
8482 _ui . ShowGuiFlight = Windows . OfType < MainGuiWindow > ( ) . FirstOrDefault ( ) . IsFlightActive ;
83+ GameObject . Find ( "BTN-MicroEngineerBtn" ) ? . GetComponent < UIValue_WriteBool_Toggle > ( ) ? . SetValue ( _ui . ShowGuiFlight ) ;
84+ }
8585
8686 if ( Utility . GameState . GameState == GameState . VehicleAssemblyBuilder )
8787 {
8888 _ui . ShowGuiOAB = Windows . FindAll ( w => w is EntryWindow ) . Cast < EntryWindow > ( ) . ToList ( ) . Find ( w => w . MainWindow == MainWindow . StageInfoOAB ) . IsEditorActive ;
89+ GameObject . Find ( "BTN - MicroEngineerOAB" ) ? . GetComponent < UIValue_WriteBool_Toggle > ( ) ? . SetValue ( _ui . ShowGuiOAB ) ;
8990 _ui . CelestialBodies . GetBodies ( ) ;
9091 _ui . CelestialBodySelectionStageIndex = - 1 ;
9192 Styles . SetActiveTheme ( Theme . Gray ) ; // TODO implement other themes in OAB
@@ -95,8 +96,6 @@ private void GameStateEntered(MessageCenterMessage obj)
9596
9697 private void GameStateLeft ( MessageCenterMessage obj )
9798 {
98- _logger . LogInfo ( "Message triggered: GameStateLeftMessage" ) ;
99-
10099 Utility . RefreshGameManager ( ) ;
101100 if ( Utility . GameState . GameState == GameState . FlightView || Utility . GameState . GameState == GameState . VehicleAssemblyBuilder || Utility . GameState . GameState == GameState . Map3DView )
102101 {
0 commit comments