Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Hook to the event to add my button
- public override void OnAwake()
- {
- GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
- }
- // Add the button to the toolbar
- void OnGUIAppLauncherReady()
- {
- if (ApplicationLauncher.Ready)
- {
- Debug.Log("About to add the app button...");
- Texture btnTex = GameDatabase.Instance.GetTexture("DangIt/Textures/appBtn", false);
- appBtn = ApplicationLauncher.Instance.AddModApplication(
- onAppBtnToggleOn,
- onAppBtnToggleOff,
- dummyVoid,
- dummyVoid,
- dummyVoid,
- dummyVoid,
- ApplicationLauncher.AppScenes.SPACECENTER,
- btnTex);
- }
- }
- // Enable the GUI
- void onAppBtnToggleOn()
- {
- newSettings = this.currentSettings.ShallowClone();
- this.showGUI = true;
- }
- // Disable the GUI
- void onAppBtnToggleOff()
- {
- newSettings = null;
- this.showGUI = false;
- }
- // Nothing
- void dummyVoid()
- {
- return;
- }
- // Draw the window when enabled
- void OnGUI()
- {
- if (showGUI)
- {
- GUI.skin = HighLogic.Skin;
- windowRect = GUILayout.Window(0, windowRect, WindowFunction, "DangIt! Settings");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement