void DoCoordinatePicking()
        {
            if (pickingPositionTarget && !MapView.MapIsEnabled)
            {
                StopPickPositionTargetOnMap();  //stop picking on leaving map view
            }
            if (!pickingPositionTarget)
            {
                return;
            }

            if (MapView.MapIsEnabled && vessel.isActiveVessel)
            {
                if (!GuiUtils.MouseIsOverWindow(core))
                {
                    Coordinates mouseCoords = GuiUtils.GetMouseCoordinates(mainBody);

                    if (mouseCoords != null)
                    {
                        GLUtils.DrawGroundMarker(mainBody, mouseCoords.latitude, mouseCoords.longitude, new Color(1.0f, 0.56f, 0.0f), true, 60);

                        string biome = mainBody.GetExperimentBiomeSafe(mouseCoords.latitude, mouseCoords.longitude);
                        GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 200, 50), mouseCoords.ToStringDecimal() + "\n" + biome);

                        if (Input.GetMouseButtonDown(0))
                        {
                            SetPositionTarget(mainBody, mouseCoords.latitude, mouseCoords.longitude);
                            StopPickPositionTargetOnMap();
                        }
                    }
                }
            }
        }
 public override void OnUpdate()
 {
     if (pickingPositionTarget && !GuiUtils.MouseIsOverWindow(core) && GuiUtils.GetMouseCoordinates(mainBody) != null)
     {
         Screen.showCursor = false;
     }
     else
     {
         Screen.showCursor = true;
     }
 }
Example #3
0
        //Lifted this more or less directly from the Kerbal Engineer source. Thanks cybutek!
        void PreventClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (!weLockedInputs && mouseOverWindow && !Input.GetMouseButton(1))
            {
                LockControl();
            }
            else if (weLockedInputs && !mouseOverWindow)
            {
                UnlockControl();
            }
        }
 public override void OnUpdate()
 {
     if (MapView.MapIsEnabled && pickingPositionTarget)
     {
         if (!GuiUtils.MouseIsOverWindow(core) && GuiUtils.GetMouseCoordinates(mainBody) != null)
         {
             Cursor.visible = false;
         }
         else
         {
             Cursor.visible = true;
         }
     }
 }
Example #5
0
        void PreventInFlightClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (!weLockedInputs && mouseOverWindow)
            {
                InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.MAP, "MechJeb_noclick");
                weLockedInputs = true;
            }
            if (weLockedInputs && !mouseOverWindow)
            {
                InputLockManager.RemoveControlLock("MechJeb_noclick");
                weLockedInputs = false;
            }
        }
Example #6
0
        //Lifted this more or less directly from the Kerbal Engineer source. Thanks cybutek!
        void PreventEditorClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (!weLockedInputs && mouseOverWindow)
            {
                EditorLogic.fetch.Lock(true, true, true, "MechJeb_noclick");
                weLockedInputs = true;
            }
            if (weLockedInputs && !mouseOverWindow)
            {
                EditorLogic.fetch.Unlock("MechJeb_noclick");
                weLockedInputs = false;
            }
        }
Example #7
0
        void PreventInFlightClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (!weLockedInputs && mouseOverWindow && !Input.GetMouseButton(1))
            {
                InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "MechJeb_noclick");
                weLockedInputs = true;
            }
            if (weLockedInputs && !mouseOverWindow)
            {
                InputLockManager.RemoveControlLock("MechJeb_noclick");
                weLockedInputs = false;
            }
        }
Example #8
0
        //Lifted this more or less directly from the Kerbal Engineer source. Thanks cybutek!
        void PreventEditorClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (mouseOverWindow && !EditorLogic.editorLocked)
            {
                EditorLogic.fetch.Lock(true, true, true);
                weLockedEditor = true;
            }
            if (weLockedEditor && !mouseOverWindow && EditorLogic.editorLocked)
            {
                EditorLogic.fetch.Unlock();
            }
            if (!EditorLogic.editorLocked)
            {
                weLockedEditor = false;
            }
        }
Example #9
0
        void PreventInFlightClickthrough()
        {
            bool mouseOverWindow = GuiUtils.MouseIsOverWindow(this);

            if (!weLockedInputs && mouseOverWindow)
            {
                InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.MAP | ControlTypes.ACTIONS_ALL, "MechJeb_noclick");
                // Setting this prevents the mouse wheel to zoom in/out while in map mode
                ManeuverGizmo.HasMouseFocus = true;
                weLockedInputs = true;
            }
            if (weLockedInputs && !mouseOverWindow)
            {
                InputLockManager.RemoveControlLock("MechJeb_noclick");
                ManeuverGizmo.HasMouseFocus = false;
                weLockedInputs = false;
            }
        }