Пример #1
0
		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");
				}
			}
		}
Пример #2
0
        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;
        }
Пример #3
0
 internal void OnDestroy()
 {
     if (orbLogButton == null)
         return;
     ApplicationLauncher.Instance.RemoveModApplication(orbLogButton);
     orbLogButton = null;
 }
Пример #4
0
        /// <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;
            }
        }
Пример #5
0
        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);
 }
Пример #7
0
        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);
                }
            }
        }
Пример #8
0
 public void Unregister()
 {
     IsRegistered = false;
     var launcher = ApplicationLauncher.Instance;
     launcher.RemoveModApplication(m_Button);
     m_Button = null;
 }
Пример #9
0
        /// <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);
        }
Пример #10
0
		private void removeButton(GameScenes scene)
		{
			if (SCANappLauncherButton != null)
			{
				ApplicationLauncher.Instance.RemoveModApplication(SCANappLauncherButton);
				SCANappLauncherButton = null;
			}
		}
Пример #11
0
 public void onGUIAppLauncherDestroyed()
 {
     if (appBtn != null)
     {
         ApplicationLauncher.Instance.RemoveModApplication(appBtn);
         appBtn = null;
     }
 }
Пример #12
0
 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));
 }
Пример #13
0
 public static void OnDestroy()
 {
     if (btnLauncher != null)
     {
         ApplicationLauncher.Instance.RemoveModApplication(btnLauncher);
         btnLauncher = null;
     }
 }
Пример #14
0
 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));
 }
Пример #15
0
 public void RemoveAppButton()
 {
     ApplicationLauncher.Instance.RemoveModApplication (MVPButton);
     MapViewPlus.MVPButton = null;
     #if DEBUG
     Debug.Log ("[MVP] Just called to remove button");
     #endif
 }
Пример #16
0
 internal void OnDestroy()
 {
     if (orbLogButton == null)
         return;
     ApplicationLauncher.Instance.RemoveModApplication(orbLogButton);
     orbLogButton = null;
     GameEvents.onEditorShipModified.Remove(UpdateGUIInfo);
 }
Пример #17
0
 private void removeButton(GameScenes scene)
 {
     if (stockToolbarButton != null)
     {
         ApplicationLauncher.Instance.RemoveModApplication(stockToolbarButton);
         stockToolbarButton = null;
     }
 }
Пример #18
0
 void OnGUIAppLauncherDestroyed()
 {
     if (KSIButton != null)
     {
         BTOff();
         ApplicationLauncher.Instance.RemoveModApplication(KSIButton);
         KSIButton = null;
     }
 }
Пример #19
0
        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);
 }
Пример #21
0
 /// <summary>Called when the ApplicationLauncher gets destroyed.</summary>
 void DestroyAppButton()
 {
     if (!Equals(appButton, null))
     {
         ApplicationLauncher.Instance.RemoveModApplication(appButton);
         appButton = null;
         isGUIEnabled = false;
         KFPersistenceManager.SaveConfig();
     }
 }
Пример #22
0
 /// <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();
     }
 }
Пример #23
0
 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);
     }
 }
Пример #24
0
 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();
 }
Пример #25
0
 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;
     }
 }
Пример #26
0
		void OnDestroy()
		{
			Trace("HeapExtend.OnDestroy");
			Trace("ApplicationLauncher is " + (ApplicationLauncher.Ready ? "" : "not ") + "ready");

			if (buttonAppLaunch != null)
			{
				ApplicationLauncher.Instance.RemoveModApplication(buttonAppLaunch);
				buttonAppLaunch = null;
			}
		}
Пример #27
0
 private void AddAppLauncherButton()
 {
     if (useAppLauncher && appLauncherButton == null)
     {
         if (DistantObjectSettings.debugMode)
         {
             Debug.Log(Constants.DistantObject + " -- creating new appLauncher instance - " + this.GetInstanceID());
         }
         appLauncherButton = InitAppLauncherButton();
     }
 }
Пример #28
0
 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;
     }
 }
Пример #29
0
 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)
             );
         }
     }
 }
Пример #31
0
 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));
     }
 }
Пример #32
0
        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"
                    );
            }
        }
Пример #34
0
        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;
        }
Пример #35
0
 //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;
     }
 }
Пример #36
0
        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));
            }
        }
Пример #37
0
 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;
 }
Пример #38
0
        //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);
            }
        }
Пример #39
0
 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)
                            );
     }
 }
Пример #40
0
 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;
 }
Пример #41
0
 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));
 }
Пример #42
0
        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);
            }
        }
Пример #43
0
 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
             );
     }
 }
Пример #44
0
 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));
     }
 }
Пример #45
0
        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;
            }
        }
Пример #46
0
        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;
            }
        }
Пример #47
0
        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;
            }
        }
Пример #48
0
 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);
     }
 }
Пример #49
0
 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();
 }
Пример #50
0
        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
                );
        }
Пример #51
0
 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)
             );
         ;
     }
 }
Пример #52
0
        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)
                    );
            }
        }
Пример #53
0
 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));
     }
 }
Пример #54
0
 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));
     }
 }
Пример #55
0
 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);
     }
 }
Пример #56
0
        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");
        }
Пример #57
0
        /* ************************************************************************************************
        * 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!");
                    }
                }
            }
        }
Пример #58
0
        /// <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;
        }
Пример #59
0
 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);
     }
 }