Ejemplo n.º 1
0
        public void OnClick()
        {
            //figure out if mod+clicked
            _includeCrew = GameSettings.MODIFIER_KEY.GetKey();
            //includeCrew = false;
            bool ctrlHeld = Input.GetKey(KeyCode.LeftControl);

            if (Input.GetKey(KeyCode.LeftShift))
            {
                OpenConvertWindow(); //convert ships to craft files
                _theButton.SetFalse();
                return;
            }

            //get the selected craft
            SpaceTracking trackingStation = (SpaceTracking)FindObjectOfType(typeof(SpaceTracking));
            Vessel        selectedVessel  = trackingStation.SelectedVessel;

            if (ctrlHeld || _includeCrew) //ctrl or modifier held
            {
                OpenImportWindow();
            }
            else if (selectedVessel != null)
            {
                ExportSelectedCraft(selectedVessel);
            }

            _theButton.SetFalse(false);
        }
Ejemplo n.º 2
0
 private void openDialog(PlanningNodeModel toEdit)
 {
     if (editDialog == null)
     {
         editDialog              = new PlanningNodeEditDialog(toEdit, CanEdit);
         editDialog.CloseDialog += () => launcher.SetFalse(true);
         editDialog.NewNode     += () => {
             var nd = new PlanningNodeModel(
                 renderer.vessel?.mainBody ?? FlightGlobals.GetHomeBody(),
                 renderer.vessel);
             PlanningNodesManager.Instance.nodes.Add(nd);
             editNode(nd);
         };
         editDialog.DeleteNode += () => {
             PlanningNodesManager.Instance.nodes.Remove(editDialog.editingNode);
             OnNodeDeleted();
         };
         editDialog.PrevNode    += () => editNode(PlanningNodesManager.Instance.PrevNode(renderer.vessel, editDialog.editingNode));
         editDialog.NextNode    += () => editNode(PlanningNodesManager.Instance.NextNode(renderer.vessel, editDialog.editingNode));
         editDialog.BodyChanged += OnBodyChanged;
         editDialog.WarpTo      += WarpTo;
         editDialog.Show(launcher.GetAnchor());
     }
     else
     {
         // Already open, just switch to this node
         editDialog.editingNode = toEdit;
     }
 }
Ejemplo n.º 3
0
 public void Start()
 {
     ReCouplerSettings.LoadSettings();
     this.connectRadius_string = ReCouplerSettings.connectRadius.ToString();
     this.connectAngle_string  = ReCouplerSettings.connectAngle.ToString();
     this.allowRoboJoints_bool = ReCouplerSettings.allowRoboJoints;
     this.allowKASJoints_bool  = ReCouplerSettings.allowKASJoints;
     if (!ReCouplerSettings.showGUI)
     {
         highlightOn = false;
         if (button != null)
         {
             button.SetFalse(true);
             ApplicationLauncher.Instance.RemoveModApplication(button);
         }
         if (appLauncherEventSet)
         {
             GameEvents.onGUIApplicationLauncherReady.Remove(OnGuiApplicationLauncherReady);
         }
         if (blizzyToolbarButton != null)
         {
             blizzyToolbarButton.Destroy();
         }
     }
 }
Ejemplo n.º 4
0
 // Update() fires every frame.
 public void Update()
 {
     RateLimitedLogger.Update();
     if ((Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) && Input.GetKeyDown(KeyCode.H))
     {
         // Linuxgurugamer added this scene check to keep HyperEdit off in the editors.
         if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.TRACKSTATION)
         {
             if (View.Window.GameObject.GetComponents <View.Window>().Any(w => w.Title == "HyperEdit"))
             {
                 if (_appLauncherButton == null)
                 {
                     View.Window.CloseAll();
                 }
                 else
                 {
                     _appLauncherButton.SetFalse();
                 }
             }
             else
             {
                 if (_appLauncherButton == null)
                 {
                     CreateCoreView();
                 }
                 else
                 {
                     _appLauncherButton.SetTrue();
                 }
             }
         }
     }
 }
        private static void ItsGrapesTime()
        {
            // instantiate the menu if we're at a refueling station

            atStation = false;
            inOrbit   = false;

            foreach (var part in FlightGlobals.ActiveVessel.Parts)
            {
                if (part.HasModuleImplementing <GasStation>())
                {
                    atStation = true;
                }
            }

            if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING)
            {
                inOrbit = true;
            }

            if (atStation && inOrbit)
            {
                // instantiate the menu
                guiPos = GUILayout.Window(123456, guiPos, MenuWindow,
                                          "Current Prices", new GUIStyle(HighLogic.Skin.window));
                grapesBtn.SetTrue();
            }

            else if (!inOrbit)
            {
                ScreenMessage screenMessage = new ScreenMessage("You are not in orbit!", 3F, ScreenMessageStyle.UPPER_CENTER);
                ScreenMessages.PostScreenMessage(screenMessage);
                grapesBtn.SetFalse();
            }
        }
Ejemplo n.º 6
0
        public void EnableAnimationSuite()
        {
            var vessel = FlightGlobals.ActiveVessel;

            if (vessel.evaController == null)
            {
                ScreenMessages.PostScreenMessage(new ScreenMessage("<color=" + Colors.DefaultMessageColor + ">Active vessel must be an EVA to use the Animation Suite</color>", 3f, ScreenMessageStyle.UPPER_CENTER));

                //set the button back to false
                Button.SetFalse(false);
                return;
            }

            Kerbal        = new SelectedKerbalEVA(vessel.evaController);
            AnimationClip = new EditableAnimationClip(Kerbal);

            if (!Kerbal.EnterAnimationMode())
            {
                //wipe the state
                Kerbal        = null;
                AnimationClip = null;
                CurrentBone   = null;

                //set the button back to false if it failed
                Button.SetFalse(false);
                return;
            }

            MusicIsPlaying = true;
        }
Ejemplo n.º 7
0
 public void OnGamePause()
 {
     if (!showgui)
     {
         return;
     }
     toolbarButton.SetFalse(makeCall: true);
 }
Ejemplo n.º 8
0
		private void Update()
		{
			if (FlightGlobals.ActiveVessel.targetObject is ModuleDockingNode)
			{
				appLauncherButton.SetTrue();
			}
			else if(isActive) appLauncherButton.SetFalse();
		}
Ejemplo n.º 9
0
 /// <summary>
 /// Hide UI and remove input lock on scene switch
 /// </summary>
 /// <param name="ev">Ev.</param>
 public void onGameSceneSwitchRequested(GameEvents.FromToAction <GameScenes, GameScenes> ev)
 {
     if (appLauncherButton != null)
     {
         appLauncherButton.SetFalse();
     }
     guiVisible = false;
     rcVisible  = false;
     InputLockManager.RemoveControlLock("BonVoyageInputLock");
 }
Ejemplo n.º 10
0
 public void SetFalse()
 {
     if (stockButton != null)
     {
         stockButton.SetFalse();
     }
     else
     {
         ToggleButtonActive();
     }
     UpdateToolbarIcon();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// This GameEvent is registered with GameEvents.onGUIApplicationLauncherDestroyed,
 /// at the time the plugin is loaded. It destroys the application button on the
 /// application launcher.
 /// </summary>
 public void OnAppLauncherDestroyed()
 {
     if (appMainButton != null)
     {
         appMainButton.SetFalse(true);
         ApplicationLauncher.Instance.RemoveApplication(appMainButton);
     }
     if (appDebugButton != null)
     {
         appDebugButton.SetFalse(true);
         ApplicationLauncher.Instance.RemoveApplication(appDebugButton);
     }
 }
Ejemplo n.º 12
0
 private void AreWindowsOpenChange(bool isOpen)
 {
     if (_appLauncherButton != null)
     {
         if (isOpen)
         {
             _appLauncherButton.SetTrue(false);
         }
         else
         {
             _appLauncherButton.SetFalse(false);
         }
     }
 }
Ejemplo n.º 13
0
 void onPluginDisable(bool byUser)
 {
     if (byUser)
     {
         button.SetFalse(false);
     }
 }
Ejemplo n.º 14
0
        private void RenderMainWindow(int windowId)
        {
            GUILayout.BeginVertical();
            UI.Layout.LabelCentered("Presets");
            foreach (string skinName in skins.Keys)
            {
                if (UI.Layout.Button(skinName, GUILayout.Height(25)))
                {
                    defaultSkinName = skinName;
                    ovedriven       = false;
                }
            }
            UI.Layout.HR();
            if (UI.Layout.Button("Retune Preset", GUILayout.Height(25)))
            {
                ovedriven = false;
            }

            if (UI.Layout.Button("Open Test Window", GUILayout.Height(25)))
            {
                testWindowVisible = true;
            }

            if (UI.Layout.Button("Close", GUILayout.Height(25)))
            {
                appLauncherButton.SetFalse();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }
Ejemplo n.º 15
0
 public static void ShowWithButton(bool show, ApplicationLauncherButton button)
 {
     if (Instance == null)
     {
         return;
     }
     if (button == null)
     {
         ShowInstance(show);
     }
     else
     {
         if (show)
         {
             if (!Instance.window_enabled)
             {
                 Instance.Show(true);
             }
             button.SetTrue(false);
         }
         else
         {
             if (Instance.window_enabled)
             {
                 Instance.Show(false);
             }
             button.SetFalse(false);
         }
     }
 }
Ejemplo n.º 16
0
 public void onGameSceneSwitchRequested(GameEvents.FromToAction <GameScenes, GameScenes> ev)
 {
     if (appLauncherButton != null)
     {
         appLauncherButton.SetFalse();
     }
 }
Ejemplo n.º 17
0
        private void OnIconClickHandler()
        {
            if (_groupWindow == null)
            {
                _groupWindow = new GroupWindow <ILightArrayConfig>(LightConfig);
                _groupWindow.AllLightConfigReloaded += (sender, e) =>
                {
                    LightConfig.Destroy();      // not perfect..
                    LoadConfig();
                    _groupWindow.SetVisible(false);
                    _groupWindow = null;
                    AllLightConfigReloaded(this, e);
                };
                _groupWindow.AllLightConfigSaved += (sender, e) => SaveConfig();
                _groupWindow.SetVisible(true);
            }
            else
            {
                _groupWindow.ToggleVisible();
            }

            if ((LightConfig != null && !LightConfig.UseBlizzy78Toolbar) || !ToolbarManager.ToolbarAvailable)
            {
                // Don't lock highlight on the button since it's just a toggle
                _appButtonStock.SetFalse(false);
            }
        }
Ejemplo n.º 18
0
        // This is the GUI callback that actually draws the GUI
        void WindowFunction(int windowID)
        {
            // Display the toggles and controls to read the new settings
            newSettings.ManualFailures = GUILayout.Toggle(newSettings.ManualFailures, "Manual failures");
            newSettings.Glow           = GUILayout.Toggle(newSettings.Glow, "Glow");
            newSettings.Messages       = GUILayout.Toggle(newSettings.Messages, "Messages");

            GUILayout.BeginHorizontal();
            GUILayout.Label("Max EVA distance: ");
            evaDistanceString = GUILayout.TextField(evaDistanceString);
            GUILayout.EndHorizontal();

            // Creates the button and returns true when it is pressed
            if (GUILayout.Button("OK"))
            {
                // Parse the string
                this.newSettings.MaxDistance = DangIt.Parse <float>(evaDistanceString, defaultTo: 2f);

                this.Log("Applying the new settings selected from GUI. New settings:\n" + newSettings.ToNode().ToString());
                DangIt.Instance.CurrentSettings = this.newSettings;

                //showGUI = false;
                // "Click" on the app button to close the window
                appBtn.SetFalse(makeCall: true);
            }

            // This call allows the user to drag the window around the screen
            GUI.DragWindow();
        }
Ejemplo n.º 19
0
        private void MakeButton()
        {
            //print("@@@MakeButton");

            if (stockToolbarBtn != null)
            {
                ApplicationLauncher.Instance.RemoveModApplication(stockToolbarBtn);
            }

            stockToolbarBtn = ApplicationLauncher.Instance.AddModApplication(
                ProximityHide, ProximityShow, null, null, null, null,
                ApplicationLauncher.AppScenes.FLIGHT, GetTexture());

            DontDestroyOnLoad(stockToolbarBtn);

            if (!Proximity.ToolbarShowSettings)
            {
                stockToolbarBtn.SetTrue(false);
            }
            else
            {
                stockToolbarBtn.SetFalse(false);
            }

            //print("@@@MakeButton - finished");
        }
Ejemplo n.º 20
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (!isAvailable)
     {
         return;
     }
     if (appLauncherButton != null)
     {
         if (SetTrue)
         {
             if (isFalse)
             {
                 appLauncherButton.SetTrue(force);
             }
         }
         else
         {
             if (isTrue)
             {
                 appLauncherButton.SetFalse(force);
             }
         }
     }
     QuickScroll.Log("Set", "QStockToolbar");
 }
Ejemplo n.º 21
0
 internal void Toggle()
 {
     if (!isActive || !isEnabled)
     {
         return;
     }
     if (isTrue)
     {
         appLauncherButton.SetFalse(true);
     }
     else
     {
         appLauncherButton.SetTrue(true);
     }
     QuickHide.Log("Toggle the AppLauncher: " + AppRef, "QMods");
 }
Ejemplo n.º 22
0
 public void SetToolbarState(bool isOn)
 {
     if (button != null)
     {
         button.SetFalse(false);
     }
 }
Ejemplo n.º 23
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");
				}
			}
		}
Ejemplo n.º 24
0
        public void OnLauncherReady()
        {
            const ApplicationLauncher.AppScenes visibleIn = ApplicationLauncher.AppScenes.FLIGHT;

            if (!ApplicationLauncher.Ready)
            {
                return;
            }

            if (btn == null)
            {
                btn = ApplicationLauncher.Instance.AddModApplication(OnToggleApp, OnToggleApp, null, null, null, null,
                                                                     visibleIn,
                                                                     GameDatabase.Instance.GetTexture("NAS/Plugins/NASIcon", false));
            }

            if (DrawGui)
            {
                btn.SetTrue(false);
            }
            else
            {
                btn.SetFalse(false);
            }
        }
Ejemplo n.º 25
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (!isAvailable)
     {
         return;
     }
     if (appLauncherButton != null)
     {
         if (SetTrue)
         {
             if (appLauncherButton.toggleButton.CurrentState == KSP.UI.UIRadioButton.State.False)
             {
                 appLauncherButton.SetTrue(force);
             }
         }
         else
         {
             if (appLauncherButton.toggleButton.CurrentState == KSP.UI.UIRadioButton.State.True)
             {
                 appLauncherButton.SetFalse(force);
             }
         }
     }
     Log("Set: " + SetTrue + " force: " + force, "QStockToolbar");
 }
Ejemplo n.º 26
0
        public void GuiApplicationLauncherReady()
        {
            if (!GameSettings.ADVANCED_TWEAKABLES)
            {
                return;
            }

            if (_appButton != null)
            {
                return;
            }

            _appButton = ApplicationLauncher.Instance.AddModApplication(
                AppTrue, AppFalse,
                null, null,
                null, null,
                ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH |
                ApplicationLauncher.AppScenes.FLIGHT,
                _offTexture);

            if (_defaultEnabled)
            {
                _appButton.SetTrue();
            }
            else
            {
                _appButton.SetFalse();
            }
        }
Ejemplo n.º 27
0
 internal void Set(bool SetTrue, bool force = false)
 {
     if (!isAvailable)
     {
         Log("Applauncher is not Active (Set)", "QStockToolbar");
         return;
     }
     if (appLauncherButton != null)
     {
         if (SetTrue)
         {
             if (appLauncherButton.State == RUIToggleButton.ButtonState.FALSE)
             {
                 appLauncherButton.SetTrue(force);
             }
         }
         else
         {
             if (appLauncherButton.State == RUIToggleButton.ButtonState.TRUE)
             {
                 appLauncherButton.SetFalse(force);
             }
         }
     }
     Log("Set " + SetTrue, "QStockToolbar");
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Change UI state to hidden to prevent app button weirdness (PopupDialog is automatically hidden on scene change)
        /// </summary>
        /// <param name="ev"></param>
        public void OnGameSceneSwitchRequested(GameEvents.FromToAction <GameScenes, GameScenes> ev)
        {
            if (appLauncherButton != null)
            {
                appLauncherButton.SetFalse(true);
            }
            else
            {
                mainViewVisible = false;
            }
            if (controlViewVisible)
            {
                ToggleControlWindow();
            }

            InputLockManager.RemoveControlLock("BonVoyageInputLock");
        }
Ejemplo n.º 29
0
 private void OnToggleOn()
 {
     if (view == null)
     {
         view = new SettingsView(() => { launcher.SetFalse(true); });
     }
     view.Show();
 }
Ejemplo n.º 30
0
 public static void ForceCloseDebugWindow()
 {
     if (FARDebugButtonStock)
     {
         FARDebugButtonStock.SetFalse(false);
     }
     debugMenu = false;
 }
Ejemplo n.º 31
0
 public void SetOff()
 {
     Enable();
     if (appButton != null && appButton.toggleButton.CurrentState != UIRadioButton.State.False)
     {
         appButton.SetFalse();
     }
 }