Exemplo n.º 1
0
        internal void Awake()
        {
            try
            {
                if (HighLogic.LoadedScene != GameScenes.SPACECENTER && HighLogic.LoadedScene != GameScenes.FLIGHT)
                {
                    return;
                }

                DontDestroyOnLoad(this);
                LtSettings.LoadSettings();

                // Added support for Blizzy toolbar and hot switching between Stock and Blizzy
                CreateAppIcons();
            }
            catch (Exception ex)
            {
                Util.LogMessage("LTAddon.Awake. Error: " + ex, Util.LogType.Error);
            }
        }
Exemplo n.º 2
0
        internal void OnDestroy()
        {
            try
            {
                if (LtSettings.loaded)
                {
                    LtSettings.SaveSettings();
                }

                GameEvents.onGameSceneSwitchRequested.Remove(OnGameSceneSwitchRequested);

                GameEvents.onGameSceneLoadRequested.Remove(OnGameSceneLoadRequested);
                GameEvents.onShowUI.Remove(OnShowUi);
                GameEvents.onHideUI.Remove(OnHideUi);

                // Handle toolbars
                DestroyAppIcons();
            }
            catch (Exception ex)
            {
                Util.LogMessage("LTAddon.OnDestroy. Error: " + ex, Util.LogType.Error);
            }
        }
Exemplo n.º 3
0
 // Save settings on scene changes
 private void OnGameSceneLoadRequested(GameScenes requestedScene)
 {
     LtSettings.SaveSettings();
 }