internal void InitializeToolbar(GameObject go) { ApplicationLauncher.AppScenes spaceCenter = 0; Log.Info("[SR] InitializeToolbar"); if (toolbarControl == null) { if (!Settings1.Instance.hideSpaceCenterButton) { spaceCenter = ApplicationLauncher.AppScenes.SPACECENTER; } toolbarControl = go.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars( null, null, OnHoverOn, OnHoverOff, null, null, (spaceCenter | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.MAPVIEW), MODID, "stageControlButton", ButtonLoc + "-38", ButtonLoc + "-24", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(DoLeftClick, DoRightClick); } }
void OnGUIAppLauncherReady() { #if false if (launcherButton == null) { launcherButton = ApplicationLauncher.Instance.AddModApplication( ToggleDayNight, ToggleDayNight, null, null, null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, (Texture)GameDatabase.Instance.GetTexture(munIcon, false)); } #endif toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, MODID, "LightsOutButton", munIcon + "-38", munIcon + "-24", MODNAME, "Left-click to toggle building lights\nRight-click to toggle vessel lights" ); toolbarControl.AddLeftRightClickCallbacks(ToggleDayNight, TogglePartLights); }
private void MakeButton() { if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ProximityHide, ProximityShow, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW, MODID, "proximityButton", GetTextureName(38), GetTextureName(24), MODNAME ); toolbarControl.AddLeftRightClickCallbacks(null, ToggleOnRightClick); } toolbarControl.buttonActive = true; if (!Proximity.ToolbarShowSettings) { toolbarControl.SetTrue(false); } else { toolbarControl.SetFalse(false); } }
private void AddLauncher() { if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(OnToggleOn, OnToggleOff, ApplicationLauncher.AppScenes.FLIGHT, MODID, "InsightButton", AppIconPath, AppIconPath, MODNAME); toolbarControl.AddLeftRightClickCallbacks(OnLeftClick, OnRightClick); } }
private void InitializeToolbarButton() { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars (null, null, ApplicationLauncher.AppScenes.FLIGHT, MODID, "abfwButton", TOOLBAR_BTN_38, TOOLBAR_BTN_24, MODNAME ); toolbarControl.AddLeftRightClickCallbacks(StockToolbarButtonClick, RightClick); }
void AddButtons() { if (!buttonCreated) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(onStockToolbarClick, onStockToolbarClick, ApplicationLauncher.AppScenes.FLIGHT, MODID, "rcsLandAidButton", "Diazo/RCSLandAid/PluginData/Textures/iconWhiteB-38", "Diazo/RCSLandAid/PluginData/Textures/iconWhiteB-24", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(LeftClick, RightClick); buttonCreated = true; } }
/// <summary> /// Initializes our button /// </summary> void initToolbarButtons() { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION, MODID, "KSPCalendarButton", "KSPCalendar/PluginData/Icons/KSPC_Button_Enabled_32", "KSPCalendar/PluginData/Icons/KSPC_Button_32", "KSPCalendar/PluginData/Icons/KSPC_Button_Enabled_24", "KSPCalendar/PluginData/Icons/KSPC_Button_24", "KSPCalendar" ); toolbarControl.AddLeftRightClickCallbacks(ToggleWindow, ToggleConfig); }
void CreateButton() { if (toolbarControl == null) { Log.Write("ExperimentManager.CreateButton", Log.LEVEL.INFO); toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(ButtonLeftClicked, ButtonLeftClicked, ApplicationLauncher.AppScenes.FLIGHT, MODID, "saButton", NormalFlaskTexture, NormalFlaskTexture, "Left-click to view alert experiments; Right-click for settings" ); toolbarControl.AddLeftRightClickCallbacks(null, ButtonRightClicked); } }
public void UpdateToolbarStock() { if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, MODID, "wasdButton", TEXTURE_DIR + "WASD-on-38", TEXTURE_DIR + "WASD-38", TEXTURE_DIR + "WASD-on-24", TEXTURE_DIR + "WASD-24", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(GUIToggle, ToggleActive); } }
private void InitializeButton() { // _logger.Info( "InitializeButton" ); #if false if (_button != null) { Remove(); } if (UseBlizzyIfPossible && BlizzysToolbarButton.IsAvailable) { _button = new BlizzysToolbarButton ( BlizzyNamespace, BlizzyButtonId, BlizzyToolTip, BlizzyText, BlizzyTexturePath, BlizzyVisibility ); } else { _button = new AppLauncherButton(LauncherTexture, LauncherVisibility); } _button.Open += OnButtonOn; _button.Close += OnButtonOff; _button.RightClick += OnRightClick; _button.Add(); #else if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.FLIGHT, MODID, "airparkButton", "AirPark/PluginData/Icon/AirPark", "AirPark/PluginData/Icon/AirPark", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(LeftButtonToggle, RightButton); } #endif }
void AddToolbarButton() { if (toolbarControl == null) { toolbarControl = gameObject.AddComponent <ToolbarControl>(); toolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION, MODID, "ClearInputLocks", "000_ClickThroughBlocker/PluginData/lock-38", "000_ClickThroughBlocker/PluginData/lock-24", MODNAME ); toolbarControl.AddLeftRightClickCallbacks(ClearInputLocksToggle, CallModeWindow); clickThroughToggleControl = gameObject.AddComponent <ToolbarControl>(); clickThroughToggleControl.AddToAllToolbars(ToggleFocusSetting, ToggleFocusSetting, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION, MODID2, "CTBToggle", FFC_38, FFM_38, FFC_24, FFM_24, MODNAME2 ); } }
// Add the buttons private void AddButtons() { //Texture2D StockTexture; if (checklistToolbarControl == null) { checklistToolbarControl = gameObject.AddComponent <ToolbarControl>(); checklistToolbarControl.AddToAllToolbars(null, null, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION, MODID, "xScienceButton1", "[x]_Science!/PluginData/Icons/icon", "[x]_Science!/PluginData/Icons/icon-small", MODNAME ); checklistToolbarControl.AddLeftRightClickCallbacks(LeftButtonToggle, RightButton); } //_checklistButton = new UnifiedButton( gameObject, 1); #if false if (BlizzysToolbarButton.IsAvailable) { _checklistButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar; var texturePath = "ScienceChecklist/ChecklistSmall.png"; if (!GameDatabase.Instance.ExistsTexture(texturePath)) { var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-small.png", 24, 24); var ti = new GameDatabase.TextureInfo(null, texture, false, true, true); ti.name = texturePath; GameDatabase.Instance.databaseTexture.Add(ti); } // _logger.Info( "Load : Blizzy texture" ); _checklistButton.BlizzyNamespace = WINDOW_NAME_CHECKLIST; _checklistButton.BlizzyButtonId = "checklist_button"; _checklistButton.BlizzyToolTip = "[x] Science! Checklist"; _checklistButton.BlizzyText = "Science Report and Checklist"; _checklistButton.BlizzyTexturePath = texturePath; _checklistButton.BlizzyVisibility = new GameScenesVisibility(GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION); // _logger.Info( "Load : Set Blizzy Stuff" ); } StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon.png", 38, 38); /* if( StockTexture != null ) * _logger.Info( "Load : Stock texture" ); * else * _logger.Info( "Load : cant load texture" );*/ _checklistButton.LauncherTexture = StockTexture; _checklistButton.LauncherVisibility = ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION; // _logger.Info( "Load : Set Stock Stuff" ); _checklistButton.ButtonOn += ChecklistButton_Open; _checklistButton.ButtonOff += ChecklistButton_Close; _checklistButton.RightClick += ChecklistButton_RightClick; _checklistButton.Add( ); #endif if (Config.RighClickMutesMusic) // So we need both buttons { #if false _statusButton = new UnifiedButton(gameObject, 2); if (BlizzysToolbarButton.IsAvailable) { _statusButton.UseBlizzyIfPossible = Config.UseBlizzysToolbar; var texturePath = "ScienceChecklist/StatusSmall.png"; if (!GameDatabase.Instance.ExistsTexture(texturePath)) { var texture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status-small.png", 24, 24); var ti = new GameDatabase.TextureInfo(null, texture, false, true, true); ti.name = texturePath; GameDatabase.Instance.databaseTexture.Add(ti); } // _logger.Info( "Load : Blizzy texture" ); _statusButton.BlizzyNamespace = WINDOW_NAME_CHECKLIST; _statusButton.BlizzyButtonId = "status_button"; _statusButton.BlizzyToolTip = "[x] Science! Here & Now"; _statusButton.BlizzyText = "Science Status Window"; _statusButton.BlizzyTexturePath = texturePath; _statusButton.BlizzyVisibility = new GameScenesVisibility(GameScenes.FLIGHT); // _logger.Info( "Load : Set Blizzy Stuff" ); } UnifiedButton.toolbarControl.SetTexture("[x]_Science!/PluginData/Icons/icon-status", "[x]_Science!/PluginData/Icons/icon-status-small"); StockTexture = TextureHelper.FromResource("ScienceChecklist.icons.icon-status.png", 38, 38); /* if( StockTexture != null ) * _logger.Info( "Load : Stock texture" ); * else * _logger.Info( "Load : cant load texture" );*/ _statusButton.LauncherTexture = StockTexture; _statusButton.LauncherVisibility = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW; // _logger.Info( "Load : Set Stock Stuff" ); _statusButton.ButtonOn += StatusButton_Open; _statusButton.ButtonOff += StatusButton_Close; _statusButton.Add( ); #endif if (statusToolbarControl == null) { statusToolbarControl = gameObject.AddComponent <ToolbarControl>(); statusToolbarControl.AddToAllToolbars(StatusButton_Open, StatusButton_Close, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW, MODID + "2", "xScienceButton2", "[x]_Science!/PluginData/Icons/icon-status", "[x]_Science!/PluginData/Icons/icon-status-small", WINDOW_CHECKLIST ); } } if (statusToolbarControl != null) { if (_statusWindow.IsVisible()) { statusToolbarControl.SetTrue(true); } else { statusToolbarControl.SetFalse(true); } } }