示例#1
0
        public void Activate(bool state)
        {
            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtils: NavUtilLibApp.Activate()");
            }

            if (state)
            {
                RenderingManager.AddToPostDrawQueue(3, OnDraw);

                rt = new RenderTexture(640, 640, 24, RenderTextureFormat.ARGB32);

                if (GlobalVariables.Settings.enableDebugging)
                {
                    Debug.Log("NavUtil: Starting systems...");
                }
                if (!var.Settings.navAidsIsLoaded)
                {
                    var.Settings.loadNavAids();
                }

                if (!var.Materials.isLoaded)
                {
                    var.Materials.loadMaterials();
                }

                //if (!var.Audio.isLoaded)
                var.Audio.initializeAudio();

                //load settings to config
                ConfigLoader.LoadSettings(var.Settings.settingsFileURL);

                //ConfigureCamera();

                windowPosition.x = NavUtilLib.GlobalVariables.Settings.hsiPosition.x;
                windowPosition.y = NavUtilLib.GlobalVariables.Settings.hsiPosition.y;


                if (GlobalVariables.Settings.enableDebugging)
                {
                    Debug.Log("NavUtil: Systems started successfully!");
                }
            }
            else
            {
                state = false;
                RenderingManager.RemoveFromPostDrawQueue(3, OnDraw); //close the GUI
                NavUtilLib.GlobalVariables.Settings.hsiPosition.x = windowPosition.x;
                NavUtilLib.GlobalVariables.Settings.hsiPosition.y = windowPosition.y;

                ConfigLoader.SaveSettings(var.Settings.settingsFileURL);
            }
        }
示例#2
0
        public void dEstroy(GameScenes g)
        {
            GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIReady);

            if (appButton != null)
            {
                //save settings to config
                ConfigLoader.SaveSettings(var.Settings.settingsFileURL);

                NavUtilLib.GlobalVariables.Settings.hsiState = false;

                ApplicationLauncher.Instance.RemoveModApplication(appButton);
            }
        }
示例#3
0
        public void dEstroy(GameScenes g)
        {
            //Debug.Log("NavUtils: Destorying App 1");

            GameEvents.onGUIApplicationLauncherReady.Remove(AddButton);

            if (appButton != null)
            {
                //Debug.Log("NavUtils: Destorying App 2");


                //save settings to config
                ConfigLoader.SaveSettings(var.Settings.settingsFileURL);

                NavUtilLib.GlobalVariables.Settings.hsiState = false;

                KSP.UI.Screens.ApplicationLauncher.Instance.RemoveModApplication(appButton);
            }
        }
示例#4
0
        void Awake()
        {
            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtils: NavUtilLibApp.Awake()");
            }

            //load settings to config
            ConfigLoader.LoadSettings(var.Settings.settingsFileURL);

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: useBlizzy? " + NavUtilLib.GlobalVariables.Settings.useBlizzy78ToolBar);
            }

            if (!NavUtilLib.GlobalVariables.Settings.useBlizzy78ToolBar)
            {
                //GameEvents.onGUIApplicationLauncherReady.Add(OnGUIReady);


                if (appButton == null)
                {
                    GameEvents.onGUIApplicationLauncherReady.Add(AddButton);
                }
                GameEvents.onGUIApplicationLauncherUnreadifying.Add(dEstroy);
                GameEvents.onGameSceneLoadRequested.Add(dEstroy);

                GameEvents.onShowUI.Add(ShowGUI);
                GameEvents.onHideUI.Add(HideGUI);
            }



            NavUtilLib.GlobalVariables.Settings.appInstance  = this.GetInstanceID();
            NavUtilLib.GlobalVariables.Settings.appReference = this;
        }