Skip to content

Commit b192b16

Browse files
committed
hide debug toolbar
1 parent ece9c02 commit b192b16

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

KerbalVR_Mod/KerbalVR/KerbalVR_AppGUI.cs

+20-14
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ public static string APP_BUTTON_LOGO_ALT {
3737

3838
#region Private Members
3939
protected ApplicationLauncherButton appMainButton = null;
40+
#if DEBUG
4041
protected ApplicationLauncherButton appDebugButton = null;
42+
#endif
4143
protected static GameObject uiMainCanvas = null;
4244
protected static GameObject uiDebugCanvas = null;
43-
#endregion
45+
#endregion
4446

4547
protected void Awake() {
4648
// when ready for a GUI, load it
@@ -68,19 +70,17 @@ public void OnAppLauncherReady() {
6870
GameDatabase.Instance.GetTexture(APP_BUTTON_LOGO, false));
6971
}
7072

73+
#if DEBUG
7174
// create a debugging tools app button instance if it doesn't already exist
7275
if (appDebugButton == null) {
7376
appDebugButton = ApplicationLauncher.Instance.AddModApplication(
7477
OnDebugToggleTrue,
7578
OnDebugToggleFalse,
7679
null, null, null, null,
77-
#if DEBUG
7880
ApplicationLauncher.AppScenes.ALWAYS,
79-
#else
80-
ApplicationLauncher.AppScenes.NEVER,
81-
#endif
82-
GameDatabase.Instance.GetTexture(APP_BUTTON_LOGO_ALT, false));
81+
GameDatabase.Instance.GetTexture(APP_BUTTON_LOGO_ALT, false));
8382
}
83+
#endif
8484

8585
// load the UI prefab
8686
if (uiMainCanvas == null) {
@@ -111,10 +111,12 @@ public void OnAppLauncherDestroyed() {
111111
appMainButton.SetFalse(true);
112112
ApplicationLauncher.Instance.RemoveApplication(appMainButton);
113113
}
114+
#if DEBUG
114115
if (appDebugButton != null) {
115116
appDebugButton.SetFalse(true);
116117
ApplicationLauncher.Instance.RemoveApplication(appDebugButton);
117118
}
119+
#endif
118120
}
119121

120122
/// <summary>
@@ -125,17 +127,18 @@ public void OnMainToggleTrue() {
125127
}
126128

127129
/// <summary>
128-
/// Callback when the debug application button is toggled on.
130+
/// Callback when the main application button is toggled off.
129131
/// </summary>
130-
public void OnDebugToggleTrue() {
131-
uiDebugCanvas.SetActive(true);
132+
public void OnMainToggleFalse() {
133+
uiMainCanvas.SetActive(false);
132134
}
133135

136+
#if DEBUG
134137
/// <summary>
135-
/// Callback when the main application button is toggled off.
138+
/// Callback when the debug application button is toggled on.
136139
/// </summary>
137-
public void OnMainToggleFalse() {
138-
uiMainCanvas.SetActive(false);
140+
public void OnDebugToggleTrue() {
141+
uiDebugCanvas.SetActive(true);
139142
}
140143

141144
/// <summary>
@@ -144,14 +147,17 @@ public void OnMainToggleFalse() {
144147
public void OnDebugToggleFalse() {
145148
uiDebugCanvas.SetActive(false);
146149
}
150+
#endif
147151

148152
/// <summary>
149153
/// Callback when the game changes scenes.
150154
/// </summary>
151155
protected void OnSceneChange(GameEvents.FromToAction<GameScenes, GameScenes> fromToScenes) {
152156
// on scene change, command the button to toggle off, so the GUI closes
153157
appMainButton.SetFalse(true);
158+
#if DEBUG
154159
appDebugButton.SetFalse(true);
160+
#endif
155161
}
156162
}
157163

@@ -310,9 +316,9 @@ void OnHmdStatusUpdated(bool isRunning) {
310316

311317
public class AppDebugGUI : AppGUI
312318
{
313-
#region Private Members
319+
#region Private Members
314320
private Text debugText;
315-
#endregion
321+
#endregion
316322

317323
private void Awake() {
318324
// get text label objects

0 commit comments

Comments
 (0)