Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Awake()
- {
- try
- {
- Debug.Log("[DangIt]: Awaking runtime...");
- GameEvents.onGUIApplicationLauncherReady.Add(OnLauncherReady);
- }
- catch (Exception e)
- {
- Debug.Log(e.Message);
- throw;
- }
- }
- void OnLauncherReady()
- {
- if (ApplicationLauncher.Ready)
- {
- try
- {
- Debug.Log("About to add the app button...");
- Texture btnTex = GameDatabase.Instance.GetTexture("DangIt/Textures/appBtn", false);
- if (btnTex == null)
- throw new Exception("The texture wasn't loaded!");
- appBtn = ApplicationLauncher.Instance.AddModApplication(
- onAppBtnToggleOn,
- onAppBtnToggleOff,
- dummyVoid,
- dummyVoid,
- dummyVoid,
- dummyVoid,
- ApplicationLauncher.AppScenes.SPACECENTER,
- btnTex);
- }
- catch (Exception e)
- {
- Debug.Log("[DangIt]: Error! " + e.Message);
- throw;
- }
- }
- }
- void onAppBtnToggleOn()
- {
- newSettings = this.currentSettings.ShallowClone();
- this.showGUI = true;
- }
- void onAppBtnToggleOff()
- {
- newSettings = null;
- this.showGUI = false;
- }
- void dummyVoid()
- {
- return;
- }
- void OnGUI()
- {
- if (showGUI)
- {
- GUI.skin = HighLogic.Skin;
- windowRect = GUILayout.Window("DangItSettings".GetHashCode(), windowRect, WindowFunction, "DangIt! Settings",
- GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement