// We add this to our window as a callback
 // It tells us when the window is opened so we can keep the button in sync
 public void OnChecklistWindowOpened(object sender, EventArgs e)
 {
     _logger.Trace("OnChecklistWindowOpened");
     if (checklistToolbarControl != null)
     {
         checklistToolbarControl.SetTrue(false);
     }
     UpdateChecklistVisibility(true);
 }
Exemplo n.º 2
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (toolbarControl != null)
     {
         if (SetTrue)
         {
             toolbarControl.SetTrue(force);
         }
         else
         {
             toolbarControl.SetFalse(force);
         }
     }
     QDebug.Log("QStock.Set", "QStockToolbar");
 }
Exemplo n.º 3
0
 void onPluginEnable(bool byUser)
 {
     if (byUser)
     {
         toolbarControl.SetTrue(false);
     }
 }
Exemplo n.º 4
0
        void Update()
        {
            //Thanks bananashavings http://forum.kerbalspaceprogram.com/index.php?/profile/156147-bananashavings/ - https://gist.github.com/bananashavings/e698f4359e1628b5d6ef
            //Also thanks to Crzyrndm for the fix to that code!
            //(HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.EDITOR)

            if ((GameSettings.MODIFIER_KEY.GetKey()) && Input.GetKeyDown(KeyCode.Slash))
            {
                windowEnabled = !windowEnabled;
                if (ApplicationLauncher.Ready)
                {
                    if (toolbarControl != null)
                    {
                        if (windowEnabled)
                        {
                            toolbarControl.SetTrue(true);
                        }
                        else
                        {
                            toolbarControl.SetFalse(true);
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        public AppLauncher(GameObject gameObject)
        {
            Log.Info("AppLauncher instantiation");
            if (instance == null)
            {
                instance = this;
            }
            Log.Info("iconPathActive: " + iconPathActive + ", iconPath: " + iconPath);
            Log.Info("toolbarIconPathActive: " + toolbarIconPathActive + ", toolbarIconPath: " + toolbarIconPath);


            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(onTrue, onFalse,
                                            visibleScenes,
                                            MODID,
                                            "RCSBuildAidButton",
                                            iconPathActive,
                                            iconPath,
                                            toolbarIconPathActive,
                                            toolbarIconPath,
                                            MODNAME
                                            );

            if (RCSBuildAid.Enabled)
            {
                toolbarControl.SetTrue(false);
            }
            Events.PluginEnabled  += onPluginEnable;
            Events.PluginDisabled += onPluginDisable;
        }
Exemplo n.º 6
0
        void CreateAppButton()
        {
            toolbarControl = gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(MiniOn,
                                            MiniOff,
                                            ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.FLIGHT,
                                            MODID,
                                            "wernerCheckerButton",
                                            "WernherChecker/Images/icon-38",
                                            "WernherChecker/Images/icon-24",
                                            MODNAME
                                            );


            if (!minimized)
            {
                toolbarControl.SetTrue(true);
            }
            if (HighLogic.LoadedScene == GameScenes.EDITOR)
            {
                minimized = !HighLogic.CurrentGame.Parameters.CustomParams <WernersSettings>().alwaysOpeninEditor;
            }
            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                minimized = !HighLogic.CurrentGame.Parameters.CustomParams <WernersSettings>().alwaysOpenInFlight;
            }
        }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 8
0
 public static void setBtnState(bool state, bool click = false)
 {
     if (state)
     {
         toolbarControl.SetTrue(click);
     }
     else
     {
         toolbarControl.SetFalse(click);
     }
 }
Exemplo n.º 9
0
        public void Update()
        {
            if (showBurst) //Set sampling to one always whenver burst mode is on to prevent crashing.
            {
                superSampleValueInt    = 1;
                superSampleValueString = "1";
            }
            try
            {
                if (buttonsEnabled && Input.GetKey(takeScreenshotKey) && (modifier == KeyCode.None || Input.GetKey(modifier)))
                //                    Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)))
                //Input.GetKeyDown(screenshotKey))
                {
                    if (showBurst)
                    {
                        print("burst mode start");
                        fireBurstShot();
                    }
                    else
                    {
                        print("Screenshot button pressed!");
                        takeScreenshot();
                    }
                }
                if (Input.GetKeyDown(showGUIKey))
                {
                    // = !showFullUI;
                    //showUI = !showUI;
                    if (!showFullUI)
                    {
                        toolbarControl.SetTrue(true);
                    }
                    else
                    {
                        toolbarControl.SetFalse(true);
                    }
#if false
                    toolbarButton.Visible
                    toolbarButton.TexturePath = showFullUI ? "BOSS/bon" : "BOSS/boff";
#endif
                    saveSettings();
                }
            }
            catch //(UnityException e)
            //Catches the unity exception for a keycode that isnt a valid key. Updating the UI to let the user know.
            {
                if (!invalidkey)
                {
                    invalidkey = true;
                }
            }
        }
        private void ChecklistButton_RightClick(object sender, EventArgs e)
        {
            if (Config.RighClickMutesMusic)
            {
                // Toggle the muted state
                Muted = !Muted;
                ScreenMessages.PostScreenMessage("[x] Science! - Music Mute");
            }
            else
            {
                if (_active && UiActive())
                {
                    if (GameHelper.AllowStatusWindow())
                    {
                        bool NewVisibility = !_statusWindow.IsVisible();
                        _statusWindow.SetVisible(NewVisibility);
                        UpdateStatusVisibility(NewVisibility);

                        _logger.Trace("ChecklistButton_RightClick, _statusWindow.IsVisible(): " + _statusWindow.IsVisible());
                        if (_statusWindow.IsVisible())
                        {
                            if (statusToolbarControl != null)
                            {
                                statusToolbarControl.SetTrue(true);
                            }
                            ScienceEventHandler.ScheduleExperimentUpdate(seconds: 0.1f);
                        }
                        else
                        {
                            if (statusToolbarControl != null)
                            {
                                statusToolbarControl.SetFalse(true);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (toolbarControl != null)
     {
         if (SetTrue)
         {
             toolbarControl.SetTrue(force);
         }
         else
         {
             toolbarControl.SetFalse(force);
         }
     }
     Log("Set: " + SetTrue + " " + force, "QStockToolbar");
 }
Exemplo n.º 12
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (toolbarControl != null)
     {
         if (SetTrue)
         {
             //if (appLauncherButton.toggleButton.CurrentState == KSP.UI.UIRadioButton.State.False) {
             toolbarControl.SetTrue(force);
             //}
         }
         else
         {
             //if (appLauncherButton.toggleButton.CurrentState == KSP.UI.UIRadioButton.State.True) {
             toolbarControl.SetFalse(force);
             //}
         }
     }
     Log("Set " + SetTrue + " force: " + force, "QStockToolbar");
 }
Exemplo n.º 13
0
        public void InitToolbar()
        {
            toolbarControl = RCSBuildAid.instance.gameObject.AddComponent <ToolbarControl>();
            toolbarControl.AddToAllToolbars(onTrue, onFalse,
                                            visibleScenes,
                                            MODID,
                                            "RCSBuildAidButton",
                                            iconPathActive,
                                            iconPath,
                                            toolbarIconPathActive,
                                            toolbarIconPath,
                                            MODNAME
                                            );

            if (RCSBuildAid.Enabled)
            {
                toolbarControl.SetTrue(false);
            }
            Events.PluginEnabled  += onPluginEnable;
            Events.PluginDisabled += onPluginDisable;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Force button to on state
 /// </summary>
 public void SetOn()
 {
     //_button.SetOn();
     toolbarControl.SetTrue(true);
 }