예제 #1
0
        internal override void Awake()
        {
            LogFormatted("Awakening the TransferWindowPlanner (TWP)");

            LogFormatted("Loading Settings");
            settings = new Settings("settings.cfg");
            if (!settings.Load())
            {
                LogFormatted("Settings Load Failed");
            }

            InitWindows();

            if (settings.SelectedCalendar == CalendarTypeEnum.Earth)
            {
                KSPDateStructure.SetEarthCalendar(settings.EarthEpoch);
                windowSettings.ddlSettingsCalendar.SelectedIndex = (Int32)settings.SelectedCalendar;
            }

            //plug us in to the draw queue and start the worker
            //Rem out for unity5
            //RenderingManager.AddToPostDrawQueue(1, DrawGUI);

            //Get whether the toolbar is there
            settings.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;

            //setup the Toolbar button if necessary
            if (settings.ButtonStyleToDisplay == Settings.ButtonStyleEnum.Toolbar)
            {
                btnToolbar = InitToolbarButton();
            }

            //Hook the App Launcher
            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(DestroyAppLauncherButton);

            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);

            // Need this one to handle the hideUI cancelling via pause menu
            GameEvents.onGameUnpause.Add(OnUnpause);

            //Hook the Angle renderers
            if (lstScenesForAngles.Contains(HighLogic.LoadedScene))
            {
                PhaseAngle = MapView.MapCamera.gameObject.AddComponent <AngleRenderPhase>();
                EjectAngle = MapView.MapCamera.gameObject.AddComponent <AngleRenderEject>();
            }

            //do the daily version check if required
            if (settings.DailyVersionCheck)
            {
                settings.VersionCheck(false);
            }
        }
예제 #2
0
        internal override void Awake()
        {
            LogFormatted("Awakening the TransferWindowPlanner (TWP)");

            LogFormatted("Loading Settings");
            settings = new Settings("settings.cfg");
            if (!settings.Load())
                LogFormatted("Settings Load Failed");

            InitWindows();

            if(settings.SelectedCalendar==CalendarTypeEnum.Earth) {
                KSPDateStructure.SetEarthCalendar(settings.EarthEpoch);
                windowSettings.ddlSettingsCalendar.SelectedIndex = (Int32)settings.SelectedCalendar;
            } 

            //plug us in to the draw queue and start the worker
            RenderingManager.AddToPostDrawQueue(1, DrawGUI);


            //Get whether the toolbar is there
            settings.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;

            //setup the Toolbar button if necessary
            if (settings.ButtonStyleToDisplay == Settings.ButtonStyleEnum.Toolbar)
            {
                btnToolbar = InitToolbarButton();
            }

            //Hook the App Launcher
            OnGUIAppLauncherReady();
            //GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);

            //Hook the Angle renderers
            if (lstScenesForAngles.Contains(HighLogic.LoadedScene))
            {
                PhaseAngle = MapView.MapCamera.gameObject.AddComponent<AngleRenderPhase>();
                EjectAngle = MapView.MapCamera.gameObject.AddComponent<AngleRenderEject>();
            }

            //do the daily version check if required
            if (settings.DailyVersionCheck)
                settings.VersionCheck(false);
        }
예제 #3
0
        internal override void Awake()
        {
            LogFormatted("Awakening the TransferWindowPlanner (TWP)");

            LogFormatted("Loading Settings");
            settings = new Settings("PluginData/settings.cfg");
            Boolean blnSettingsLoaded = settings.Load();
            if (!blnSettingsLoaded)
            {
                settings = new Settings("settings.cfg");
                blnSettingsLoaded = settings.Load();
                if (blnSettingsLoaded)
                {
                    settings.FilePath = "PluginData/settings.cfg";
                    if (!System.IO.Directory.Exists(Resources.PathPlugin + "/PluginData"))
                        System.IO.Directory.CreateDirectory(Resources.PathPlugin + "/PluginData");
                    System.IO.File.Move(Resources.PathPlugin + "/settings.cfg", Resources.PathPlugin + "/PluginData/settings.cfg");
                }
            }

            if (!blnSettingsLoaded)
            {
                settings.FilePath = "PluginData/settings.cfg";
                LogFormatted("Settings Load Failed");
            }

            InitWindows();

            if(settings.SelectedCalendar==CalendarTypeEnum.Earth) {
                KSPDateStructure.SetEarthCalendar(settings.EarthEpoch);
                windowSettings.ddlSettingsCalendar.SelectedIndex = (Int32)settings.SelectedCalendar;
            }

            //plug us in to the draw queue and start the worker
            //Rem out for unity5
            //RenderingManager.AddToPostDrawQueue(1, DrawGUI);

            //Get whether the toolbar is there
            settings.BlizzyToolbarIsAvailable = ToolbarManager.ToolbarAvailable;

            //setup the Toolbar button if necessary
            if (settings.ButtonStyleToDisplay == Settings.ButtonStyleEnum.Toolbar)
            {
                btnToolbar = InitToolbarButton();
            }

            //Hook the App Launcher
            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(DestroyAppLauncherButton);

            GameEvents.onGameSceneLoadRequested.Add(OnGameSceneLoadRequestedForAppLauncher);

            // Need this one to handle the hideUI cancelling via pause menu
            GameEvents.onGameUnpause.Add(OnUnpause);

            //Hook the Angle renderers
            if (lstScenesForAngles.Contains(HighLogic.LoadedScene))
            {
                PhaseAngle = MapView.MapCamera.gameObject.AddComponent<AngleRenderPhase>();
                EjectAngle = MapView.MapCamera.gameObject.AddComponent<AngleRenderEject>();
            }

            //do the daily version check if required
            if (settings.DailyVersionCheck)
                settings.VersionCheck(false);
        }