internal override void Awake() { //WindowRect = new Rect(mbTWP.windowMain.WindowRect.x + mbTWP.windowMain.WindowRect.width, mbTWP.windowMain.WindowRect.y, 300, 200); WindowRect = new Rect(0, 0, WindowWidth, WindowHeight); settings = TransferWindowPlanner.settings; TooltipMouseOffset = new Vector2d(-10, 10); ddlSettingsTab = new DropDownList(EnumExtensions.ToEnumDescriptions<SettingsTabs>(), this); ddlSettingsSkin = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.DisplaySkin>(), (Int32)settings.SelectedSkin, this); ddlSettingsSkin.OnSelectionChanged += ddlSettingsSkin_SelectionChanged; ddlSettingsButtonStyle = new DropDownList(EnumExtensions.ToEnumDescriptions<Settings.ButtonStyleEnum>(), (Int32)settings.ButtonStyleChosen, this); ddlSettingsButtonStyle.OnSelectionChanged += ddlSettingsButtonStyle_OnSelectionChanged; ddlSettingsCalendar = new DropDownList(EnumExtensions.ToEnumDescriptions<CalendarTypeEnum>(), this); //NOTE:Pull out the custom option for now ddlSettingsCalendar.Items.Remove(CalendarTypeEnum.Custom.Description()); ddlSettingsCalendar.OnSelectionChanged += ddlSettingsCalendar_OnSelectionChanged; ddlManager.AddDDL(ddlSettingsCalendar); ddlManager.AddDDL(ddlSettingsButtonStyle); ddlManager.AddDDL(ddlSettingsSkin); ddlManager.AddDDL(ddlSettingsTab); onWindowVisibleChanged += TWPWindowSettings_onWindowVisibleChanged; }
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); }
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); }