public void Update() { if (buttonAppLaunch == null) { if (ApplicationLauncher.Ready) { if (texAppLaunch == null) { texAppLaunch = new Texture2D(38, 38, TextureFormat.RGBA32, false); texAppLaunch.LoadImage(System.IO.File.ReadAllBytes(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "applaunch.png"))); } buttonAppLaunch = ApplicationLauncher.Instance.AddModApplication( ExtendHeap, ExtendHeap, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, texAppLaunch ); buttonAppLaunch.SetFalse(false); } else { Trace("ApplicationLauncher is not ready in Update"); } } }
internal ApplicationLauncherButton InitAppLauncherButton() { btnAppLauncher = null; try { btnAppLauncher = ApplicationLauncher.Instance.AddModApplication( onAppLaunchToggleOn, onAppLaunchToggleOff, onAppLaunchHoverOn, onAppLaunchHoverOff, null, null, ApplicationLauncher.AppScenes.ALWAYS, texButton); //AppLauncherButtonMutuallyExclusive(settings.AppLauncherMutuallyExclusive); //btnAppLauncher = ApplicationLauncher.Instance.AddApplication( // onAppLaunchToggleOn, onAppLaunchToggleOff, // onAppLaunchHoverOn, onAppLaunchHoverOff, // null, null, // (Texture)Resources.texAppLaunchIcon); //btnAppLauncher.VisibleInScenes = ApplicationLauncher.AppScenes.FLIGHT; } catch (Exception ex) { MonoBehaviourExtended.LogFormatted("AppLauncher: Failed to set up App Launcher Button\r\n{0}", ex.Message); btnAppLauncher = null; } return btnAppLauncher; }
internal void OnDestroy() { if (orbLogButton == null) return; ApplicationLauncher.Instance.RemoveModApplication(orbLogButton); orbLogButton = null; }
/// <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> IEnumerator AddAppButton() { while (!ApplicationLauncher.Ready || !this.IsReady) yield return null; try { if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { // 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( onAppBtnToggleOn, onAppBtnToggleOff, dummyVoid, // ignore callbacks for more elaborate events dummyVoid, dummyVoid, dummyVoid, ApplicationLauncher.AppScenes.ALWAYS, btnTex); } } catch (Exception e) { this.Log("Error! " + e.Message); throw e; } }
private void CreateButtons() { if (this.buildButton == null && (HighLogic.LoadedScene == GameScenes.EDITOR || HighLogic.LoadedScene == GameScenes.SPH)) { this.buildButton = ApplicationLauncher.Instance.AddModApplication( this.BuildOn, this.BuildOff, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, texture ); } if (this.flightButton == null && HighLogic.LoadedScene == GameScenes.FLIGHT) { this.flightButton = ApplicationLauncher.Instance.AddModApplication( this.FlightOn, this.FlightOff, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, texture ); } }
public StateFundingApplicationLauncher() { View = new StateFundingHubView (); Texture2D Image = new Texture2D (2, 2); Image.LoadImage (File.ReadAllBytes ("GameData/StateFunding/assets/cashmoney.png")); Button = ApplicationLauncher.Instance.AddModApplication (onTrue, onFalse, onHover, onHoverOut, onEnable, onDisable, ApplicationLauncher.AppScenes.SPACECENTER, Image); }
public void Awake() { if (HighLogic.LoadedScene == GameScenes.FLIGHT) { DontDestroyOnLoad(this); Settings.Load(); InvokeRepeating("RunSave", interval, interval); if (ToolbarManager.ToolbarAvailable) { button = ToolbarManager.Instance.add("CrewManifest", "CrewManifest"); button.TexturePath = "CrewManifest/Icons/IconOff_24"; button.ToolTip = "Crew Manifest"; button.Visibility = new GameScenesVisibility(GameScenes.FLIGHT); button.OnClick += onButtonClick; } //if (appButton == null && Settings.AppLauncher) if (appButton == null) { appButton = ApplicationLauncher.Instance.AddModApplication( onButtonClick, onButtonClick, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, offTexture); } } }
public void Unregister() { IsRegistered = false; var launcher = ApplicationLauncher.Instance; launcher.RemoveModApplication(m_Button); m_Button = null; }
/// <summary> /// Adds the button to the KSP toolbar. /// </summary> public void Add() { // _logger.Trace("Add"); if (_button != null) { _logger.Debug("Button already added"); return; } var texture = new Texture2D(38, 38, TextureFormat.ARGB32, false); var iconStream = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("ScienceChecklist.icons.icon.png").ReadToEnd (); texture.LoadImage(iconStream); texture.Apply(); // _logger.Info("Adding button"); _button = ApplicationLauncher.Instance.AddModApplication( OnToggleOn, OnToggleOff, null, null, null, null, ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION, texture); }
private void removeButton(GameScenes scene) { if (SCANappLauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(SCANappLauncherButton); SCANappLauncherButton = null; } }
public void onGUIAppLauncherDestroyed() { if (appBtn != null) { ApplicationLauncher.Instance.RemoveModApplication(appBtn); appBtn = null; } }
public void Start() { showWindow = false; if (btnLauncher == null) btnLauncher = ApplicationLauncher.Instance.AddModApplication(() => showWindow = !showWindow, () => showWindow = !showWindow, null, null, null, null, ApplicationLauncher.AppScenes.SPACECENTER, GameDatabase.Instance.GetTexture("000_FilterExtensions/Icons/FilterCreator", false)); }
public static void OnDestroy() { if (btnLauncher != null) { ApplicationLauncher.Instance.RemoveModApplication(btnLauncher); btnLauncher = null; } }
public static void Start() { if (btnLauncher == null) btnLauncher = ApplicationLauncher.Instance.AddModApplication(OnToggleTrue, OnToggleFalse, null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT, GameDatabase.Instance.GetTexture("KramaxAutoPilot/Icon/AppLauncherIcon", false)); }
public void RemoveAppButton() { ApplicationLauncher.Instance.RemoveModApplication (MVPButton); MapViewPlus.MVPButton = null; #if DEBUG Debug.Log ("[MVP] Just called to remove button"); #endif }
internal void OnDestroy() { if (orbLogButton == null) return; ApplicationLauncher.Instance.RemoveModApplication(orbLogButton); orbLogButton = null; GameEvents.onEditorShipModified.Remove(UpdateGUIInfo); }
private void removeButton(GameScenes scene) { if (stockToolbarButton != null) { ApplicationLauncher.Instance.RemoveModApplication(stockToolbarButton); stockToolbarButton = null; } }
void OnGUIAppLauncherDestroyed() { if (KSIButton != null) { BTOff(); ApplicationLauncher.Instance.RemoveModApplication(KSIButton); KSIButton = null; } }
IEnumerator addButton() { while (!ApplicationLauncher.Ready) yield return null; stockToolbarButton = ApplicationLauncher.Instance.AddModApplication(toggle, toggle, null, null, null, null, (ApplicationLauncher.AppScenes)63, CapComSkins.toolbarIcon); GameEvents.onGUIApplicationLauncherUnreadifying.Add(removeButton); }
void Awake() { var texture = new Texture2D(36, 36, TextureFormat.RGBA32, false); var textureFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PlanLog.png"); print("Loading " + textureFile); texture.LoadImage(File.ReadAllBytes(textureFile)); this.planLogButton = ApplicationLauncher.Instance.AddModApplication(GuiOn, GuiOff, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, texture); }
/// <summary>Called when the ApplicationLauncher gets destroyed.</summary> void DestroyAppButton() { if (!Equals(appButton, null)) { ApplicationLauncher.Instance.RemoveModApplication(appButton); appButton = null; isGUIEnabled = false; KFPersistenceManager.SaveConfig(); } }
/// <summary>Called when the ApplicationLauncher gets destroyed.</summary> void DestroyAppButton() { if (!Equals(appButton, null)) { ApplicationLauncher.Instance.RemoveModApplication(appButton); // removing appButton from toolbar appButton = null; // notifying garbage collector to delete this object isGUIEnabled = false; // close the cfg window if it's still open KFPersistenceManager.SaveConfig(); } }
public static void Setup() { if (btnLauncher == null) { prograde = GameDatabase.Instance.GetTexture("TweakableSAS/Icon/Prograde", false); retrograde = GameDatabase.Instance.GetTexture("TweakableSAS/Icon/Retrograde", false); btnLauncher = ApplicationLauncher.Instance.AddModApplication(OnToggleTrue, OnToggleFalse, null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT, prograde); } }
public void Start() { customTestCategory = new customSubCategory("testCategory", ""); customTestCategory.filters.Add(new Filter(false)); customTestCategory.filters[0].checks.Add(defaultCheck()); if (btn == null) btn = ApplicationLauncher.Instance.AddModApplication(Toggle, Toggle, null, null, null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, (Texture2D)GameDatabase.Instance.GetTexture("000_FilterExtensions/Icons/FilterCreator", false)); StartCoroutine(initialise()); populateLists(); }
internal void DestroyAppLauncherButton() { MonoBehaviourExtended.LogFormatted("AppLauncher: Destroying Button-BEFORE NULL CHECK"); if (btnAppLauncher != null) { MonoBehaviourExtended.LogFormatted("AppLauncher: Found button to destroy"); ApplicationLauncher.Instance.RemoveModApplication(btnAppLauncher); btnAppLauncher = null; } }
void OnDestroy() { Trace("HeapExtend.OnDestroy"); Trace("ApplicationLauncher is " + (ApplicationLauncher.Ready ? "" : "not ") + "ready"); if (buttonAppLaunch != null) { ApplicationLauncher.Instance.RemoveModApplication(buttonAppLaunch); buttonAppLaunch = null; } }
private void AddAppLauncherButton() { if (useAppLauncher && appLauncherButton == null) { if (DistantObjectSettings.debugMode) { Debug.Log(Constants.DistantObject + " -- creating new appLauncher instance - " + this.GetInstanceID()); } appLauncherButton = InitAppLauncherButton(); } }
private void AddButton() { if (ApplicationLauncher.Ready && add) { Texture2D buttonTexture = new Texture2D(38, 38); buttonTexture.LoadImage(File.ReadAllBytes(Path.Combine(RCUtils.pluginDataURL, "RC_Icon.png"))); button = ApplicationLauncher.Instance.AddModApplication(Show, Hide, Empty, Empty, Empty, Empty, ApplicationLauncher.AppScenes.SPACECENTER, (Texture)buttonTexture); add = false; } }
void OnGUIAppLauncherReady() { if (ApplicationLauncher.Ready) { HangarButton = ApplicationLauncher.Instance.AddModApplication( onAppLaunchToggleOn, onAppLaunchToggleOff, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.SPH|ApplicationLauncher.AppScenes.VAB|ApplicationLauncher.AppScenes.FLIGHT, GameDatabase.Instance.GetTexture(ICON, false)); } }
public void setupAppButton_BuildWindow() { if (appBuildWindowButton == null) { if (ApplicationLauncher.Ready) { appBuildWindowButton = ApplicationLauncher.Instance.AddModApplication( ExBuildWindow.ToggleGUI, ExBuildWindow.ToggleGUI, null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT, GameDatabase.Instance.GetTexture("ExtraplanetaryLaunchpads/Textures/icon_button", false) ); } } }
private void AddButton() { if (_button == null) { _button = ApplicationLauncher.Instance.AddModApplication(() => _isVisible = true, () => { _isVisible = false; if (_engineSelector.Visible) { _engineSelector.Hide(); } }, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, GameDatabase.Instance.GetTexture("KerbalRPNCalc/Textures/Icon", false)); } }
void OnGUIAppLauncherReady() { if (launcherButton != null) { return; } launcherButton = ApplicationLauncher.Instance.AddModApplication( TurnHighlightOn, TurnHighlightOff, null, null, null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture(HighlightIconOff, false)); }
private void AddLauncher() { if (ApplicationLauncher.Ready && launcher == null) { launcher = ApplicationLauncher.Instance.AddModApplication( onAppLaunchToggleOn, null, null, null, null, null, ApplicationLauncher.AppScenes.SPACECENTER, AppIcon); launcher?.gameObject?.SetTooltip( "KerbalChangelog_mainTitle", "KerbalChangelog_mainTooltip" ); } }
private void RemoveAppLauncher() { if (appLauncherButton == null) //button already removed { return; } var applauncher = ApplicationLauncher.Instance; if (applauncher == null) //aplauncher is null { return; } applauncher.RemoveModApplication(appLauncherButton); appLauncherButton = null; }
//remove any existing buttons from the toolbar private void remove_from_toolbar() { if (CraftManager.main_ui_toolbar_button || CraftManager.quick_tag_toolbar_button) { CraftManager.log("Removing buttons from toolbar"); } if (CraftManager.main_ui_toolbar_button) { ApplicationLauncher.Instance.RemoveModApplication(CraftManager.main_ui_toolbar_button); CraftManager.main_ui_toolbar_button = null; } if (CraftManager.quick_tag_toolbar_button) { ApplicationLauncher.Instance.RemoveModApplication(CraftManager.quick_tag_toolbar_button); CraftManager.quick_tag_toolbar_button = null; } }
public void OnGUIAppLauncherReady() { bool vis; if (ApplicationLauncher.Ready && (KCTButtonStock == null || !ApplicationLauncher.Instance.Contains(KCTButtonStock, out vis))) //Add Stock button { KCTButtonStock = ApplicationLauncher.Instance.AddModApplication( KCT_GUI.onClick, KCT_GUI.onClick, DummyVoid, //TODO: List next ship here? DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.ALWAYS, GameDatabase.Instance.GetTexture("KerbalConstructionTime/icons/KCT_on", false)); } }
void _addButton() { if (button != null) { return; } button = ApplicationLauncher.Instance.AddModApplication(onTrue, onFalse, null, null, null, null, visibleScenes, GameDatabase.Instance.GetTexture(iconPath, false)); if (RCSBuildAid.Enabled) { /* this doesn't seem to work */ //button.SetTrue (false); button.toggleButton.startTrue = true; } Events.PluginEnabled += onPluginEnable; Events.PluginDisabled += onPluginDisable; }
//Vessel state handlers internal void OnDestroy() { //Debug.Log("[RosterManager]: RosterManagerAddon.OnDestroy"); try { if (RMSettings.Loaded) { try { RMSettings.SaveSettings(); } catch { // Do nothing. } } // Handle Toolbars if (_rmRosterBlizzy == null) { if (_rmRosterStock != null) { ApplicationLauncher.Instance.RemoveModApplication(_rmRosterStock); _rmRosterStock = null; } if (_rmRosterStock == null) { // Remove the stock toolbar button launcher handler GameEvents.onGUIApplicationLauncherReady.Remove(OnGuiAppLauncherReady); } } else { _rmRosterBlizzy?.Destroy(); } //Reset Roster Window data WindowRoster.DisplayMode = WindowRoster.DisplayModes.None; WindowRoster.SelectedKerbal = null; WindowRoster.ToolTip = ""; //Settings.ShowRoster = false; } catch (Exception ex) { RmUtils.LogMessage("Error in: RosterManagerAddon.OnDestroy. " + ex, "Error", true); } }
private void OnGUIAppLauncherReady() { if (ApplicationLauncher.Ready) { debugButtonStock = ApplicationLauncher.Instance.AddModApplication ( OnAppLaunchToggleOn, OnAppLaunchToggleOff, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.SPACECENTER, (Texture)GameDatabase.Instance.GetTexture("B9_Aerospace_ProceduralWings/Plugins/icon_stock", false) ); } }
void OnGUIAppLauncherReady() { if (HighLogic.LoadedScene == GameScenes.SPACECENTER && CivPopButton == null) { InitStyle(); string IconFile = "CivPopIcon"; CivPopButton = ApplicationLauncher.Instance.AddModApplication( BTOn, BTOff, BTHoverOn, BTHoverOff, null, null, ApplicationLauncher.AppScenes.SPACECENTER, (Texture)GameDatabase.Instance.GetTexture(assetFolder + IconFile, false)); } CivPopGUIOn = false; }
private void OnAppLauncherReady() { if (button != null) { ApplicationLauncher.Instance.RemoveModApplication(button); button = null; } button = ApplicationLauncher.Instance.AddModApplication( () => Visible = true, () => Visible = false, null, null, null, null, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, GameDatabase.Instance.GetTexture(AppLauncherIconLocation, false)); }
private void OnGuiAppLauncherDestroyed() { try { if (_stockButton == null) { return; } ApplicationLauncher.Instance.RemoveModApplication(_stockButton); _stockButton = null; } catch (Exception ex) { Util.LogMessage("LTAddon.OnGuiAppLauncherDestroyed. Error: " + ex, Util.LogType.Error); } }
private void CreateAppButton() { if (appButton == null) { Logger.Log("Creating app button."); appButton = ApplicationLauncher.Instance.AddModApplication( OnButtonTrue, //onTrue OnButtonFalse, //onFalse null, //onHover null, //onHoverOut null, //onEnable null, //onDisable ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW, app_icon_normal ); } }
public void ResetAppLauncher() { Utils.Log("[UI]: Reset App Launcher", LogType.UI); //FindData(); if (stockToolbarButton == null) { stockToolbarButton = ApplicationLauncher.Instance.AddModApplication( OnToolbarButtonToggle, OnToolbarButtonToggle, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture(toolbarUIIconURLOff, false)); } }
internal void SetAppButtonToTrue() { if (!ApplicationLauncher.Ready) { LogFormatted_DebugOnly("not ready yet"); AppLauncherToBeSetTrueAttemptDate = DateTime.Now; return; } ApplicationLauncherButton ButtonToToggle = btnAppLauncher; if (ButtonToToggle == null) { LogFormatted_DebugOnly("Button Is Null"); AppLauncherToBeSetTrueAttemptDate = DateTime.Now; return; } }
public void OnDestroy() { Debug.Log("KSPIRC::OnDestroy"); if (windowButton != null) { windowButton.Destroy(); windowButton = null; } if (appLauncherButton != null) { ApplicationLauncher.Instance.DisableMutuallyExclusive(appLauncherButton); ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); appLauncherButton = null; } }
public void OnDestroy() { GameEvents.onGameSceneLoadRequested.Remove(this.onSceneChangeRequested); GameEvents.OnKSCFacilityUpgraded.Remove(this.onFacilityUpgraded); if (this.toolbarButton != null) { this.toolbarButton.Destroy(); this.toolbarButton = null; } if (this.appLauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(this.appLauncherButton); this.appLauncherButton = null; } }
private void OnGUIAppLauncherReady() { Utilities.Log_Debug("OnGUIAppLauncherReady"); if (ApplicationLauncher.Ready) { Utilities.Log_Debug("Adding AppLauncherButton"); stockToolbarButton = ApplicationLauncher.Instance.AddModApplication( onAppLaunchToggle, onAppLaunchToggle, DummyVoid, DummyVoid, DummyVoid, DummyVoid, VisibleinScenes, appbtnTexOFF); } }
protected void OnGUIAppLauncherReady() { showWindow = false; if (ApplicationLauncher.Ready && stockToolbarButton == null) { stockToolbarButton = ApplicationLauncher.Instance.AddModApplication( OnToolbarButtonToggle, OnToolbarButtonToggle, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.MAPVIEW, (Texture)GameDatabase.Instance.GetTexture(toolbarUIIconURLOff, false)); } CreateToolbarPanel(); }
private void AddAppLauncher() { if (appLauncherButton != null) //button already added { return; } var applauncher = ApplicationLauncher.Instance; if (applauncher == null) //aplauncher is null { return; } var tex = new Texture2D(38, 38, TextureFormat.RGBA32, false); for (int x = 0; x < 38; x++) { for (int y = 0; y < 38; y++) { tex.SetPixel(x, y, Color.clear); } } for (int x = 0; x < 26; x++) { for (int y = 0; y < 26; y++) { if (x % 4 == 0 || y % 4 == 0) { tex.SetPixel(x + 6, y + 6, Color.white); } } } tex.Apply(); appLauncherButton = applauncher.AddModApplication( ToggleGraphotronWindow, ToggleGraphotronWindow, () => { }, () => { }, () => { }, () => { }, ApplicationLauncher.AppScenes.FLIGHT, tex ); }
void AddButton() { if (ApplicationLauncher.Ready && !NavUtilLib.GlobalVariables.Settings.useBlizzy78ToolBar) { appButton = ApplicationLauncher.Instance.AddModApplication( onAppLaunchToggleOn, onAppLaunchToggleOff, onAppLaunchHoverOn, onAppLaunchHoverOff, onAppLaunchEnable, onAppLaunchDisable, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("KerbalScienceFoundation/NavInstruments/CommonTextures/toolbarButton3838", false) ); ; } }
void setupAppButton() { if (FSAppButton == null) { FSAppButton = ApplicationLauncher.Instance.AddModApplication( onTrue: toggleCollection, onFalse: toggleCollection, onHover: null, onHoverOut: null, onEnable: null, onDisable: null, visibleInScenes: ApplicationLauncher.AppScenes.FLIGHT, texture: getIconTexture(autoTransfer) ); } }
void OnAppButtonReady() { Debug.Log("App launcher Ready"); if (ApplicationLauncher.Ready) { Debug.Log("Doing Flight Button things"); KTButton = ApplicationLauncher.Instance.AddModApplication( OnAppLaunchToggleOn, OnAppLaunchToggleOff, DummyVoid, DummyVoid, DummyVoid, DummyVoid, ApplicationLauncher.AppScenes.FLIGHT, (Texture)GameDatabase.Instance.GetTexture("KerbalTimer/Textures/appButton", false)); } }
private void createButton() { if (this.lButton == null /* && !hasInitialised*/) // Have we already created the button? /*hasInitialised = true;*/ { CountdownToLaunch.Log("Adding Application button"); this.lButton = ApplicationLauncher.Instance.AddModApplication( this.onTrue, this.onFalse, null, null, null, null, ApplicationLauncher.AppScenes.FLIGHT, GameDatabase.Instance.GetTexture("iPeer/CountdownToLaunch/clock.png", false)); } }
private void SetupGUI() { if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedSceneIsEditor || HighLogic.LoadedScene == GameScenes.TRACKSTATION) { if (appLauncherButton == null) { if (HighLogic.LoadedScene == GameScenes.SPACECENTER || BARISSettings.PartsCanBreak) { appLauncherButton = ApplicationLauncher.Instance.AddModApplication(ToggleGUI, ToggleGUI, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, appIcon); } } } else if (appLauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); } }
public void AddButton() { if (!ApplicationLauncher.Ready) { return; } var useBlizzyOnly = false; if (ToolbarManager.ToolbarAvailable) { useBlizzyOnly = SafeHouse.Config.UseBlizzyToolbarOnly; } if (firstTime) { FirstTimeSetup(); firstTime = false; } if (!useBlizzyOnly && launcherButton == null) { ApplicationLauncher launcher = ApplicationLauncher.Instance; launcherButton = launcher.AddModApplication( CallbackOnTrue, CallbackOnFalse, CallbackOnHover, CallbackOnHoverOut, CallbackOnEnable, CallbackOnDisable, APP_SCENES, launcherButtonTexture); launcher.AddOnShowCallback(CallbackOnShow); launcher.AddOnHideCallback(CallbackOnHide); launcher.EnableMutuallyExclusive(launcherButton); } if (blizzyButton == null) { AddBlizzyButton(); } SetupBackingConfigInts(); SafeHouse.Logger.SuperVerbose("[kOSToolBarWindow] Launcher Icon init successful"); }
/* ************************************************************************************************ * Function Name: Awake * Input: N/A * Output: N/A * Purpose: Awake is a function that Unity looks for when instantiating a MonoBehavior or derived * class. Awake should fire at the start of a scene, typically directly after a scene change. * ************************************************************************************************/ public void Awake() { if (ApplicationLauncher.Ready) { appLauncherButton = InitializeApplicationButton(); if (appLauncherButton != null) { appLauncherButton.VisibleInScenes = ApplicationLauncher.AppScenes.SPACECENTER; if (CactEyeConfig.DebugMode) { Debug.Log("CactEye 2: Debug: Application Launcher Button created!"); } } } }
/// <summary> /// Raises the app launcher ready event. Method to create an app button on the AppLauncher, as well as tell /// what/how the GUI is loaded. /// </summary> public void OnAppLauncherReady() { InitStyle(); string iconFile = "PopModIcon";//This is the name of the file that stores the mod's icon to be used in the appLauncher if (HighLogic.LoadedScene == GameScenes.SPACECENTER && appButton == null) { //i.e. if running for the first time appButton = ApplicationLauncher.Instance.AddModApplication( OnToggleTrue, //Run OnToggleTrue() when user clicks button OnToggleFalse, //Run OnToggleFalse() when user clicks button again null, null, null, null, //do nothing during hover, exiting, enable/disable ApplicationLauncher.AppScenes.ALWAYS, //When to show applauncher/GUI button GameDatabase.Instance.GetTexture(assetFolder + iconFile, false)); //where to look for mod applauncher icon //Debug.Log (debuggingClass.modName + "Finishing Awake()");//What I am using to debug } CivPopGUIOn = false; }
private void OnGuiAppLauncherDestroyed() { //Debug.Log("[RosterManager]: RosterManagerAddon.OnGUIAppLauncherDestroyed"); try { if (_rmRosterStock == null) { return; } ApplicationLauncher.Instance.RemoveModApplication(_rmRosterStock); _rmRosterStock = null; } catch (Exception ex) { RmUtils.LogMessage("Error in: RosterManagerAddon.OnGUIAppLauncherDestroyed. " + ex, "Error", true); } }
private void OnGuiAppLauncherReady() { try { this.button = ApplicationLauncher.Instance.AddModApplication( () => { EditorExtensions.Instance.Show(); }, //RUIToggleButton.onTrue () => { EditorExtensions.Instance.Hide(); }, //RUIToggleButton.onFalse () => { EditorExtensions.Instance.ShowMenu(); }, //RUIToggleButton.OnHover () => { EditorExtensions.Instance.HideMenu(); }, //RUIToggleButton.onHoverOut null, //RUIToggleButton.onEnable null, //RUIToggleButton.onDisable ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, //visibleInScenes GameDatabase.Instance.GetTexture(texPathDefault, false) //texture ); Log.Debug("Added ApplicationLauncher button"); } catch (Exception ex) { Log.Error("Error adding ApplicationLauncher button: " + ex.Message); } }