File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Source/RunActivity/Viewer3D Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,8 @@ public partial class MapViewer : Form
123123 private double lastUpdateTime ;
124124
125125 private bool MapCustomizationVisible = false ;
126+
127+ private Form GameForm ;
126128 #endregion
127129
128130 public MapViewer ( Simulator simulator , Viewer viewer )
@@ -154,6 +156,8 @@ public MapViewer(Simulator simulator, Viewer viewer)
154156 AddNewMessage ( e . Time , e . Message ) ;
155157 } ;
156158
159+ GameForm = ( Form ) System . Windows . Forms . Control . FromHandle ( Viewer . Game . Window . Handle ) ; // qqq
160+
157161 // Initialise the timer used to handle user input
158162 UITimer = new Timer ( ) ;
159163 UITimer . Interval = 100 ;
@@ -1338,6 +1342,13 @@ void UITimer_Tick(object sender, EventArgs e)
13381342 }
13391343 Visible = true ;
13401344
1345+ if ( Viewer . MapViewerEnabledSetToTrue )
1346+ {
1347+ GenerateView ( ) ;
1348+ GameForm . Focus ( ) ;
1349+ Viewer . MapViewerEnabledSetToTrue = false ;
1350+ }
1351+
13411352 if ( Program . Simulator . GameTime - lastUpdateTime < 1 )
13421353 return ;
13431354
Original file line number Diff line number Diff line change @@ -192,6 +192,8 @@ void CameraActivate()
192192 public Vector3 FarPoint { get ; private set ; }
193193
194194 public bool MapViewerEnabled { get ; set ; } = false ;
195+ public bool MapViewerEnabledSetToTrue { get ; set ; } = false ;
196+
195197 public bool SoundDebugFormEnabled { get ; set ; }
196198
197199 public TRPFile TRP ; // Track profile file
@@ -421,6 +423,10 @@ public void Restore(BinaryReader inf)
421423
422424 WindowManager . Restore ( inf ) ;
423425 MapViewerEnabled = inf . ReadBoolean ( ) ;
426+ if ( MapViewerEnabled )
427+ {
428+ MapViewerEnabledSetToTrue = true ;
429+ }
424430
425431 var cameraToRestore = inf . ReadInt32 ( ) ;
426432 foreach ( var camera in WellKnownCameras )
@@ -1171,7 +1177,15 @@ void HandleUserInput(ElapsedTime elapsedTime)
11711177 if ( UserInput . IsPressed ( UserCommand . GameSwitchManualMode ) ) PlayerTrain . RequestToggleManualMode ( ) ;
11721178 if ( UserInput . IsPressed ( UserCommand . GameResetOutOfControlMode ) ) new ResetOutOfControlModeCommand ( Log ) ;
11731179
1174- if ( UserInput . IsPressed ( UserCommand . GameMultiPlayerDispatcher ) ) { MapViewerEnabled = ! MapViewerEnabled ; return ; }
1180+ if ( UserInput . IsPressed ( UserCommand . GameMultiPlayerDispatcher ) )
1181+ {
1182+ MapViewerEnabled = ! MapViewerEnabled ;
1183+ if ( MapViewerEnabled )
1184+ {
1185+ MapViewerEnabledSetToTrue = true ;
1186+ }
1187+ return ;
1188+ }
11751189 if ( UserInput . IsPressed ( UserCommand . DebugSoundForm ) ) { SoundDebugFormEnabled = ! SoundDebugFormEnabled ; return ; }
11761190
11771191 if ( UserInput . IsPressed ( UserCommand . CameraJumpSeeSwitch ) )
You can’t perform that action at this time.
0 commit comments