void onAppLauncherLoad() { #if false if (ApplicationLauncher.Ready) { bool hidden; bool contains = (launcher_btn == null) ? false : ApplicationLauncher.Instance.Contains(launcher_btn, out hidden); if (!contains) { launcher_btn = ApplicationLauncher.Instance.AddModApplication( OnALTrue, OnALFalse, null, null, null, null, ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB, GameDatabase.Instance.GetTexture("CorrectCoL/Images/icon", false)); } } #endif if (toolbarControl != null) { return; } toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(OnALTrue, OnALFalse, ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB, "CorrectCoL", "CorrectCoLButton", "CorrectCoL/Images/icon", "CorrectCoL/Images/iconSmall", "Correct CoL" ); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <CCOLParams>().useBlizzy); }
private void CreateButtonIcon() { #if false button = ApplicationLauncher.Instance.AddModApplication( () => { if (vessel != null) { WindowVisible = true; } }, () => WindowVisible = false, null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.TRACKSTATION, GameDatabase.Instance.GetTexture("SlingShotter/Textures/icon", false) ); #endif toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ToggleOn, ToggleOff, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.TRACKSTATION, "Slingshotter_NS", "slingShotterButton", "SlingShotter/PluginData/Textures/icon_38", "SlingShotter/PluginData/Textures/icon_24", "SlingShotter" ); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <Slingshotter>().useBlizzy); }
void OnGUIAppLauncherReady() { #if false { this.stockButton = ApplicationLauncher.Instance.AddModApplication( delegate() { _mainWindowVisible = true; }, delegate() { _mainWindowVisible = false; } , null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW, (Texture)GameDatabase.Instance.GetTexture("NavHud/ToolbarIcon", false)); } #endif toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ToggleWindow, ToggleWindow, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW, "NavHud_NS", "navhudButton", "NavHud/ToolbarIcon", "NavHud/ToolbarIcon", "NavBall HUD" ); toolbarControl.UseBlizzy(useBlizzy); }
void OnGUI() { if (toolbarControl != null) { toolbarControl.UseBlizzy(useBlizzy); } bool showOverlay = !_hud_hidden && _enabled && _enableText && (!MapView.MapIsEnabled || _enableMap); bool showMain = _mainWindowVisible; bool showColour = _colorWindowVisible; if (!showMain && !showColour && !showOverlay) { return; } // No GUI is enabled /* // Old button * if (!_toolbarAvailable) * { * GUILayout.BeginArea(new Rect(200f, 0f, 230f, 30f)); * _mainWindowVisible ^= GUILayout.Button("NH", GUILayout.Width(30f)); * GUILayout.EndArea(); * } */ GUIStyle mainWindowStyle = new GUIStyle(HighLogic.Skin.window); mainWindowStyle.fixedWidth = 470f; if (showMain) { _mainWindowPosition = ClickThruBlocker.GUILayoutWindow(99241, _mainWindowPosition, OnMainWindow, "NavHud", mainWindowStyle); } GUIStyle colorWindowStyle = new GUIStyle(HighLogic.Skin.window); colorWindowStyle.fixedWidth = 300f; if (showColour) { _colorWindowPosition = ClickThruBlocker.GUILayoutWindow(99242, _colorWindowPosition, OnColorWindow, "Color Picker", colorWindowStyle); } if (showOverlay) { _hudTextWindowPosition = ClickThruBlocker.GUILayoutWindow(99243, _hudTextWindowPosition, OnHudTextWindow, "", GUIStyle.none); } GUIStyle hudTextSettingsWindowStyle = new GUIStyle(HighLogic.Skin.window); hudTextSettingsWindowStyle.fixedWidth = 300f; if (_settingKeyBinding) { if (Event.current.isKey) { _toggleKey = Event.current.keyCode; _settingKeyBinding = false; } } }
//SettingsWindow settingsWindow = new SettingsWindow(); void OnGUI() { if (toolbarControl != null) { toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <DangItCustomParams1>().useBlizzy); } GUI.skin = HighLogic.Skin; //if (settingsWindow.Enabled) settingsWindow.Draw(); }
/// <summary> /// Coroutine that creates the button in the toolbar. Will wait for the runtime AND the launcher to be ready /// before creating the button. /// </summary> void AddAppButton() { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(onAppBtnToggle, onAppBtnToggle, ApplicationLauncher.AppScenes.ALWAYS, "DangIt_NS", "dangItButton", "DangIt/Textures/appBtn_38", "DangIt/Textures/appBtn_24", "Dang It!" ); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <DangItCustomParams1>().useBlizzy); }
private void OnAppLauncherReady() { if (toolbarControl != null) { return; } toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ShowMainWindow, HideMainWindow, ApplicationLauncher.AppScenes.FLIGHT, "OLDD_camera", "DockingCameraButton", "OLDD/DockingCam/Icons/DockingCamIcon32", "OLDD/DockingCam/Icons/DockingCamIcon", "Docking Camera"); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <CameraGameSettings>().useBlizzy); }
/// <summary> /// Coroutine that creates the button in the toolbar. Will wait for the runtime AND the launcher to be ready /// before creating the button. /// </summary> void AddAppButton() { #if false while (!ApplicationLauncher.Ready || !this.IsReady) { yield return(null); } try { if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.TRACKSTATION) { // Load the icon for the button Texture btnTex = GameDatabase.Instance.GetTexture("DangIt/Textures/appBtn", false); if (btnTex == null) { throw new Exception("The button texture wasn't loaded!"); } appBtn = ApplicationLauncher.Instance.AddModApplication( onAppBtnToggle, onAppBtnToggle, dummyVoid, // ignore callbacks for more elaborate events dummyVoid, dummyVoid, dummyVoid, ApplicationLauncher.AppScenes.ALWAYS, btnTex); } } catch (Exception e) { this.Log("Error! " + e.Message); throw e; } #endif toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(onAppBtnToggle, onAppBtnToggle, ApplicationLauncher.AppScenes.ALWAYS, "DangIt_NS", "dangItButton", "DangIt/Textures/appBtn_38", "DangIt/Textures/appBtn_24", "Dang It!" ); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <DangItCustomParams1>().useBlizzy); }
public void OnGUI() { if (mainWindowOn) { rectMainWindow = GUI.Window(889204, rectMainWindow, MainWindow, Localizer.Format("#autoLOC_AH_0001")); } if (editorShipWindowOn) { rectEditorShipWindow = GUI.Window(524258, rectEditorShipWindow, EditorShipListWindow, Localizer.Format("#autoLOC_AH_0044")); } if (toolbarControl != null) { toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().useBlizzy); } }
private void OnGUI() { if (toolbarControl != null) { toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <Slingshotter>().useBlizzy); } if (WindowVisible) { GUI.skin = HighLogic.Skin; windowPos = ClickThruBlocker.GUILayoutWindow(1, windowPos, WindowGUI, "SlingShotter | Set Time", GUILayout.MinWidth(300)); if (HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT) { DrawIconForAllOrbits(); } } }
private void AddToolbarButton() { toolbarControl = gameObject.AddComponent <ToolbarControl> (); toolbarControl.AddToAllToolbars( ToolbarButtonOnTrue, ToolbarButtonOnFalse, KSP.UI.Screens.ApplicationLauncher.AppScenes.VAB | KSP.UI.Screens.ApplicationLauncher.AppScenes.SPH, Localizer.Format("#autoLOC_AH_0032"), "823779", "AntennaHelper/Textures/icon_dish_on", "AntennaHelper/Textures/icon_off", "AntennaHelper/Textures/icon_dish_on_small", "AntennaHelper/Textures/icon_dish_off_small", Localizer.Format("#autoLOC_AH_0001")); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().useBlizzy); }
private void OnGUIApplicationLauncherReady() { if (HighLogic.CurrentGame != null && HighLogic.CurrentGame.Mode == Game.Modes.CAREER) { if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(GUISwitch, GUISwitch, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.MAPVIEW, "KSPCasher_NS", "kspCasherButton", "KSPCasher/PluginData/Icon_38", "KSPCasher/PluginData/Icon_24", "KSP Casher" ); toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <Casher>().useBlizzy); } } }
public void OnGUI() { toolbarControl.UseBlizzy(false); if (_machine.Started) { var state = _machine.CurrentState as IGuiBehavior; if (state == null) { return; } state.Draw(); } else { if (GravityTurnAPI.GravityTurnActive) { initial.Draw(); } } }
void OnGUI() { if (toolbarController != null) { toolbarController.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().useBlizzy); } if (!guiHasStarted) { OnGUIStarter(); } if (!hasStarted && (showActiveConnectWindow || showSelectCircleTypeWindow)) { rectNotStartedWindow = GUILayout.Window(485768, rectNotStartedWindow, NotStartedWindow, Localizer.Format("#autoLOC_AH_0001")); return; } if (showActiveConnectWindow) { rectActiveConnectWindow = GUILayout.Window(434324, rectActiveConnectWindow, ActiveConnectWindow, Localizer.Format("#autoLOC_AH_0001")); } if (showSelectCircleTypeWindow) { rectSelectCircleTypeWindow = GUILayout.Window(647886, rectSelectCircleTypeWindow, SelectCircleTypeWindow, Localizer.Format("#autoLOC_AH_0052")); } if (showPotentialRelaysWindow) { rectPotentialRelaysWindow.position = new Vector2( rectActiveConnectWindow.position.x, rectActiveConnectWindow.position.y + rectActiveConnectWindow.size.y); rectPotentialRelaysWindow = GUILayout.Window(307428, rectPotentialRelaysWindow, PotentialRelaysWindow, Localizer.Format("#autoLOC_AH_0053")); } if (showLinkDetailWindow) { rectLinkDetailWindow.position = rectActiveConnectWindow.position - linkDetailPosOffset; rectLinkDetailWindow = GUILayout.Window(675752, rectLinkDetailWindow, LinkDetailWindow, Localizer.Format("#autoLOC_AH_0054", new string[] { selectedLink ["aName"], selectedLink ["bName"] })); } }
private void initToolbar() { //bon = GameDatabase.Instance.GetTexture("BOSS/Resources/bon", false); //boff = GameDatabase.Instance.GetTexture("BOSS/Resources/boff", false); { if (this.toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ToggleMainWindow, ToggleMainWindow, ApplicationLauncher.AppScenes.ALWAYS, "FlightPlan_NS", "flightPlanButton", "BOSS/Resources/bon_38", "BOSS/Resources/boff_38", "BOSS/Resources/bon_24", "BOSS/Resources/boff_24", "Bolt-On Screenshot System" ); toolbarControl.UseBlizzy(useToolbarIfAvailable); } } }
//private void drawGUI() void OnGUI() { if (toolbarControl != null) { toolbarControl.UseBlizzy(useToolbarIfAvailable); } if (unitySkin) { GUI.skin = null; } else { GUI.skin = HighLogic.Skin; } if (showFullUI) { if (showUI) { showUIPos = ClickThruBlocker.GUILayoutWindow(568, showUIPos, UIContent, "B.O.S.S. Control", GUILayout.Width(150), GUILayout.Height(150)); } if (showHelp) { helpWindowPos = ClickThruBlocker.GUILayoutWindow(570, helpWindowPos, UIContentHelp, "Help!!!", GUILayout.Width(400), GUILayout.Height(400)); } if (showBurst) { BurstPos = ClickThruBlocker.GUILayoutWindow(569, BurstPos, UIContentBurst, "Burst Control", GUILayout.Width(150), GUILayout.Height(150)); } } }
private void AddToolbarButton() { KSP.UI.Screens.ApplicationLauncher.AppScenes scenes = KSP.UI.Screens.ApplicationLauncher.AppScenes.FLIGHT | KSP.UI.Screens.ApplicationLauncher.AppScenes.MAPVIEW; if (!HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().enableInFlight) { scenes = KSP.UI.Screens.ApplicationLauncher.AppScenes.MAPVIEW; } if (!HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().enableInMapView) { scenes = KSP.UI.Screens.ApplicationLauncher.AppScenes.FLIGHT; } if (!toolbarButtonAdded) { toolbarController = gameObject.AddComponent <ToolbarControl> (); toolbarController.AddToAllToolbars( ToolbarButtonOnTrue, ToolbarButtonOnFalse, scenes, Localizer.Format("#autoLOC_AH_0032"), "368879", "AntennaHelper/Textures/icon_sat_on", "AntennaHelper/Textures/icon_off", "AntennaHelper/Textures/icon_dish_on_small", "AntennaHelper/Textures/icon_dish_off_small", Localizer.Format("#autoLOC_AH_0001")); toolbarController.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().useBlizzy); toolbarButtonAdded = true; } }
//OnDraw Shows the MainGUI Window private void OnGUI() { if (HighLogic.CurrentGame == null || HighLogic.CurrentGame.Mode != Game.Modes.CAREER) { return; } if (toolbarControl != null) { toolbarControl.UseBlizzy(HighLogic.CurrentGame.Parameters.CustomParams <Casher>().useBlizzy); } GUI.skin.window.richText = true; if (HighLogic.LoadedScene == GameScenes.SPACECENTER && ShowGUI == true) { if (!stylesSetup) { SetupStyles(); } GUI.skin = HighLogic.Skin; if (!windowPosInitted && windowPos.height > 1) { windowPos.xMin = Screen.width - 336 - 14; windowPos.yMin = Screen.height - windowPos.height - 40f; windowPos.yMax = Screen.height - 40f; windowPosInitted = true; } windowPos = ClickThruBlocker.GUILayoutWindow( typeof(KSPCasher).FullName.GetHashCode(), windowPos, MainGUI, "KSP-Casher"); GUI.depth = 0; } }