forked from KSP-ModularManagement/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.cs
More file actions
90 lines (82 loc) · 2.34 KB
/
Copy pathMenu.cs
File metadata and controls
90 lines (82 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
This file is part of Module Manager /L
© 2018-2024 LisiasT
Module Manager /L is licensed as follows:
* GPL 3.0 : https://www.gnu.org/licenses/gpl-3.0.txt
Module Manager /L is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License 3.0
along with Module Manager /L. If not, see <https://www.gnu.org/licenses/>.
*/
using UnityEngine;
namespace ModuleManager.GUI
{
#if !KSP12
internal class Menu
{
private readonly ModuleManager parent;
private PopupDialog instance;
internal Menu(ModuleManager parent)
{
this.parent = parent;
}
internal void Dismiss()
{
this.instance.Dismiss();
this.instance = null;
}
internal void OnUpdate(bool inRnDCenter)
{
if (GameSettings.MODIFIER_KEY.GetKey() && Input.GetKeyDown(KeyCode.F11)
&& (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.MAINMENU)
&& !inRnDCenter)
{
if (null == this.instance)
this.Show();
else
this.Dismiss();
}
}
private void Show()
{
this.instance = PopupDialog.SpawnPopupDialog(
new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog(
"ModuleManagerMenu",
"",
"ModuleManager",
HighLogic.UISkin,
new Rect(0.5f, 0.5f, 220f, 60f),
new DialogGUIFlexibleSpace(),
new DialogGUIVerticalLayout(
new DialogGUIFlexibleSpace(),
#if false
new DialogGUIButton("Reload Database",
delegate
{
this.parent.StartCoroutine(this.parent.DataBaseReloadWithMM(false));
this.Dismiss();
}, 200.0f, 30.0f, false),
#endif
new DialogGUIButton("Quick Reload Database",
delegate
{
this.parent.StartCoroutine(this.parent.QuickDataBaseReloadWithMM());
this.Dismiss();
}, 200.0f, 30.0f, false),
new DialogGUIButton("Dump Database to Files",
delegate
{
this.parent.StartCoroutine(this.parent.DumpDataBaseToFiles());
this.Dismiss();
}, 200.0f, 30.0f, false),
new DialogGUIButton("Close", () => { this.Dismiss(); } , 200.0f, 30.0f, false)
)),
false,
HighLogic.UISkin);
}
}
#endif
}