@@ -13,23 +13,35 @@ namespace ModuleManager.GUI
1313#if ! KSP12
1414 internal class Menu
1515 {
16- internal static Menu Show ( ModuleManager parent )
16+ private readonly ModuleManager parent ;
17+ private PopupDialog instance ;
18+
19+ internal Menu ( ModuleManager parent )
1720 {
18- return new Menu ( parent ) ;
21+ this . parent = parent ;
1922 }
2023
21- internal Menu Dismiss ( )
24+ internal void Dismiss ( )
2225 {
2326 this . instance . Dismiss ( ) ;
2427 this . instance = null ;
25- return null ;
2628 }
2729
28- private ModuleManager parent ;
29- private PopupDialog instance ;
30- private Menu ( ModuleManager parent )
30+ internal void OnUpdate ( bool inRnDCenter )
31+ {
32+ if ( GameSettings . MODIFIER_KEY . GetKey ( ) && Input . GetKeyDown ( KeyCode . F11 )
33+ && ( HighLogic . LoadedScene == GameScenes . SPACECENTER || HighLogic . LoadedScene == GameScenes . MAINMENU )
34+ && ! inRnDCenter )
35+ {
36+ if ( null == this . instance )
37+ this . Show ( ) ;
38+ else
39+ this . Dismiss ( ) ;
40+ }
41+ }
42+
43+ private void Show ( )
3144 {
32- this . parent = parent ;
3345 this . instance = PopupDialog . SpawnPopupDialog (
3446 new Vector2 ( 0.5f , 0.5f ) ,
3547 new Vector2 ( 0.5f , 0.5f ) ,
@@ -47,19 +59,22 @@ private Menu(ModuleManager parent)
4759 {
4860 MMPatchLoader . keepPartDB = false ;
4961 this . parent . StartCoroutine ( this . parent . DataBaseReloadWithMM ( ) ) ;
50- } , 140.0f , 30.0f , true ) ,
62+ this . Dismiss ( ) ;
63+ } , 140.0f , 30.0f , false ) ,
5164 new DialogGUIButton ( "Quick Reload Database" ,
5265 delegate
5366 {
5467 MMPatchLoader . keepPartDB = true ;
5568 this . parent . StartCoroutine ( this . parent . DataBaseReloadWithMM ( ) ) ;
56- } , 140.0f , 30.0f , true ) ,
69+ this . Dismiss ( ) ;
70+ } , 140.0f , 30.0f , false ) ,
5771 new DialogGUIButton ( "Dump Database to Files" ,
5872 delegate
5973 {
6074 this . parent . StartCoroutine ( this . parent . DataBaseReloadWithMM ( true ) ) ;
61- } , 140.0f , 30.0f , true ) ,
62- new DialogGUIButton ( "Close" , ( ) => { } , 140.0f , 30.0f , true )
75+ this . Dismiss ( ) ;
76+ } , 140.0f , 30.0f , false ) ,
77+ new DialogGUIButton ( "Close" , ( ) => { this . Dismiss ( ) ; } , 140.0f , 30.0f , false )
6378 ) ) ,
6479 false ,
6580 HighLogic . UISkin ) ;
0 commit comments