Beispiel #1
0
		internal void Register()
		{
			launcher			= launcher			?? (launcher = Asset.Texture2D.LoadFromFile(ICON_DIR, "Historian_Launcher"));
			launcherSupressed	= launcherSupressed	?? (launcherSupressed= Asset.Texture2D.LoadFromFile(ICON_DIR, "Historian_Launcher_Suppressed"));
			toolbar				= toolbar			?? (toolbar = Asset.Texture2D.LoadFromFile(ICON_DIR, "Historian_Toolbar"));
			toolbarSupressed	= toolbarSupressed	?? (toolbarSupressed = Asset.Texture2D.LoadFromFile(ICON_DIR, "Historian_Toolbar_Suppressed"));
			this.button = Toolbar.Button.Create(this
					, ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW
						| ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.SPH
						| ApplicationLauncher.AppScenes.TRACKSTATION | ApplicationLauncher.AppScenes.VAB
					, launcher
					, toolbar
					, Localizer.Format("#Historian_ButtonToolTip")??Version.FriendlyName
				);
			this.supressedController = button.State.Controller.Create<SupressedStatus>(
				new Dictionary<Toolbar.State.Status, Toolbar.State.Data> {
							{ (SupressedStatus)false, Toolbar.State.Data.Create(launcher, toolbar) }
							,{ (SupressedStatus)true, Toolbar.State.Data.Create(launcherSupressed, toolbarSupressed) }
				}
			);
			this.button.Mouse.Add(Toolbar.Button.MouseEvents.Kind.Left, this.Button_OnLeftClick);
			this.button.Mouse.Add(Toolbar.Button.MouseEvents.Kind.Right, this.Button_OnRightClick);
			this.controller.Add(this.button);
			ToolbarController.Instance.ButtonsActive(Configuration.Instance.EnableToolbarButton, Configuration.Instance.EnableLauncherButton);
			this.IsRegistered = true;
		}
Beispiel #2
0
        void AddToolbarButton()
        {
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (!hasAddedButton)
                {
                    button = Toolbar.Button.Create(this
                                                   , ApplicationLauncher.AppScenes.FLIGHT
                                                   , UI.icon.button.off_36, UI.icon.button.disabled_36
                                                   , UI.icon.button.off_24, UI.icon.button.disabled_24
                                                   )
                    ;

                    parkingState = button.State.Controller.Create <ParkedState>(
                        new Dictionary <Toolbar.State.Status, Toolbar.State.Data> {
                        { (ParkedState)false, Toolbar.State.Data.Create(UI.icon.button.off_36, UI.icon.button.off_24) }
                        , { (ParkedState)true, Toolbar.State.Data.Create(UI.icon.button.on_36, UI.icon.button.on_24) }
                    }
                        );

                    button.Toolbar
                    .Add(Toolbar.Button.ToolbarEvents.Kind.Active,
                         new Toolbar.Button.Event(this.ShowToolbarGUI, this.HideToolbarGUI)
                         );
                    ;

                    ToolbarController.Instance.Add(button);
                }
            }
        }
Beispiel #3
0
        internal void Register()
        {
            launcher    = launcher ?? (launcher = Asset.Texture2D.LoadFromFile(ICON_DIR, "ToolbarLargeIcon"));
            toolbar     = toolbar ?? (toolbar = Asset.Texture2D.LoadFromFile(ICON_DIR, "ToolbarSmallIcon"));
            this.button = Toolbar.Button.Create(this
                                                , ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH
                                                , launcher
                                                , toolbar
                                                , Version.FriendlyName
                                                );

            windowState = this.button.State.Controller.Create <WindowState>(
                new Dictionary <Toolbar.State.Status, Toolbar.State.Data> {
                { (WindowState)false, Toolbar.State.Data.Create(launcher, toolbar) }
                , { (WindowState)true, Toolbar.State.Data.Create(launcher, toolbar) }
            }
                );

            this.button.Mouse.Add(Toolbar.Button.MouseEvents.Kind.Left, this.Button_OnLeftClick);
            this.button.Mouse.Add(Toolbar.Button.MouseEvents.Kind.Right, this.Button_OnRightClick);
            this.controller.Add(this.button);
            this.controller.ButtonsActive(true, true);
            this.IsRegistered = true;
        }