forked from Summerfirefly/ASW
-
Notifications
You must be signed in to change notification settings - Fork 1
/
DepthContorllerApplicationLauncher.cs
67 lines (57 loc) · 1.59 KB
/
DepthContorllerApplicationLauncher.cs
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
using KSP.UI.Screens;
using UnityEngine;
namespace AntiSubmarineWeapon
{
[KSPAddon(KSPAddon.Startup.Flight, false)]
public class DepthContorllerApplicationLauncher : MonoBehaviour
{
public static ApplicationLauncherButton btn;
private static bool DrawGui
{
get
{
return ModGlobal.drawSettingsWindow;
}
set
{
ModGlobal.drawSettingsWindow = value;
}
}
public void Awake()
{
GameEvents.onGUIApplicationLauncherReady.Add(OnLauncherReady);
}
public void OnDestroy()
{
if (btn != null)
{
ApplicationLauncher.Instance.RemoveModApplication(btn);
}
btn = null;
}
public void OnLauncherReady()
{
const ApplicationLauncher.AppScenes visibleIn = ApplicationLauncher.AppScenes.FLIGHT;
if (!ApplicationLauncher.Ready)
return;
if (btn == null)
{
btn = ApplicationLauncher.Instance.AddModApplication(OnToggleApp, OnToggleApp, null, null, null, null,
visibleIn,
GameDatabase.Instance.GetTexture("NAS/Plugins/NASIcon", false));
}
if (DrawGui)
{
btn.SetTrue(false);
}
else
{
btn.SetFalse(false);
}
}
public void OnToggleApp()
{
DrawGui = !DrawGui;
}
}
}