Exemple #1
0
        private void OnGUI()
        {
            if (DisplayingWindow)
            {
                if (Event.current.type == UnityEngine.EventType.KeyUp && Event.current.keyCode == _keybind.Value.MainKey)
                {
                    DisplayingWindow = false;
                    return;
                }

                if (GUI.Button(_screenRect, string.Empty, GUI.skin.box) &&
                    !WindowRect.Contains(Input.mousePosition))
                {
                    DisplayingWindow = false;
                }

                GUI.Box(WindowRect, GUIContent.none, new GUIStyle {
                    normal = new GUIStyleState {
                        background = WindowBackground
                    }
                });
                WindowRect = GUILayout.Window(-69, WindowRect, MultiplayerWindow, "Multiplayer Mod");
                EatInputInRect(WindowRect);
            }
            if (DisplayingChat)
            {
                GUI.Box(ChatRect, GUIContent.none, new GUIStyle {
                    normal = new GUIStyleState {
                        background = ChatBackground
                    }
                });
                ChatRect = GUILayout.Window(-70, ChatRect, ChatWindow, "Chat");
                EatInputInRect(ChatRect);
            }
        }
Exemple #2
0
        public void Update()
        {
            Vector2 mouse = Input.mousePosition;

            mouse.y = Screen.height - mouse.y;

            if (Input.GetMouseButton(0))
            {
                if (!WindowRect.Contains(mouse))
                {
                    Visible = false;
                    return;
                }
            }
            else
            {
                return;
            }

            mouse -= WindowRect.position;

            if (hueBarRect.Contains(mouse))
            {
                currentHSV.H = (1.0f - Mathf.Clamp01((mouse.y - hueBarRect.y) / hueBarRect.height)) * 360.0f;
                UpdateColorTexture();
            }

            if (colorPickerRect.Contains(mouse))
            {
                currentHSV.S = Mathf.Clamp01((mouse.x - colorPickerRect.x) / colorPickerRect.width);
                currentHSV.V = Mathf.Clamp01((mouse.y - colorPickerRect.y) / colorPickerRect.height);
            }
        }
Exemple #3
0
        internal override void OnGUIEvery()
        {
            if (Visible && !UIHidden)
            {
                Boolean oldMouseOver = MouseOver;
                MouseOver = (Event.current.type == EventType.repaint) && WindowRect.Contains(Event.current.mousePosition);

                if (oldMouseOver != MouseOver)
                {
                    if (MouseOver)
                    {
                        OnMouseEnter();
                    }
                    else
                    {
                        OnMouseLeave();
                    }
                }

                //Heres where all the line stuff goes - still need to hide it on F2
                Single WindowEndX = WindowRect.x + 5;
                if (LeftSide)
                {
                    WindowEndX = WindowRect.x + WindowRect.width - 5;
                }
                Single WindowEndY = Screen.height - WindowRect.y - (WindowRect.height / 2);
                Drawing.DrawLine(new Vector2((Single)PartScreenPos.x, Screen.height - (Single)PartScreenPos.y),
                                 new Vector2(WindowEndX, Screen.height - WindowEndY), colorLineCurrent, 2);
            }
            base.OnGUIEvery();
        }
        private void CheckWindowLock()
        {
            if (Display)
            {
                if (MainSystem.NetworkState < ClientState.Running || HighLogic.LoadedSceneIsFlight)
                {
                    RemoveWindowLock();
                    return;
                }

                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;

                var shouldLock = WindowRect.Contains(mousePos);
                if (shouldLock && !IsWindowLocked)
                {
                    InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "LMP_PlayerStatusLock");
                    IsWindowLocked = true;
                }
                if (!shouldLock && IsWindowLocked)
                {
                    RemoveWindowLock();
                }
            }

            if (!Display && IsWindowLocked)
            {
                RemoveWindowLock();
            }
        }
Exemple #5
0
        protected override void DrawWindowPre(int id)
        {
            if (bigmap != null)
            {
                mapTypeTitle = SCANmapType.mapTypeNames[(int)bigmap.MType];
            }
            else
            {
                mapTypeTitle = "";
            }

            WindowCaption = string.Format("{0} Map of {1}", mapTypeTitle, bigmap.Body.theName);

            //Disable any errant drop down menus
            if (!drop_down_open)
            {
                projection_drop_down = false;
                mapType_drop_down    = false;
                resources_drop_down  = false;
                planetoid_drop_down  = false;
            }

            //Lock space center click through
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_ALL, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    removeControlLocks();
                }
            }

            //Lock tracking scene click through
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.TRACKINGSTATION_UI, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    removeControlLocks();
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// Checks to see if the mouse is over the window.
        /// Requires the window to be visible
        /// </summary>
        /// <returns>True if over the window, false otherwise.</returns>
        protected bool checkMouseOver()
        {
            if (!IsVisible)
            {
                return(false);
            }
            Vector2 mousePos = Input.mousePosition;

            mousePos.y = Screen.height - mousePos.y;
            return(WindowRect.Contains(mousePos));
        }
Exemple #7
0
        void InputLockMonitor()
        {
            MouseOverWindow = Visible && WindowRect.Contains(Event.current.mousePosition);

            //If the setting is on and the mouse is over any window then lock it
            if (MouseOverWindow && !InputLockExists)
            {
                Boolean AddLock = false;
                switch (HighLogic.LoadedScene)
                {
                case GameScenes.SPACECENTER: AddLock = !(InputLockManager.GetControlLock("KSPTipsControlLock") != ControlTypes.None); break;

                case GameScenes.EDITOR: AddLock = !(InputLockManager.GetControlLock("KSPTipsControlLock") != ControlTypes.None); break;

                case GameScenes.FLIGHT: AddLock = !(InputLockManager.GetControlLock("KSPTipsControlLock") != ControlTypes.None); break;

                case GameScenes.TRACKSTATION:
                    break;

                default:
                    break;
                }
                if (AddLock)
                {
                    LogFormatted_DebugOnly("AddingLock-{0}", "KSPTipsControlLock");

                    switch (HighLogic.LoadedScene)
                    {
                    case GameScenes.SPACECENTER: InputLockManager.SetControlLock(ControlTypes.KSC_FACILITIES, "KSPTipsControlLock"); break;

                    case GameScenes.EDITOR: InputLockManager.SetControlLock(ControlTypes.EDITOR_LOCK, "KSPTipsControlLock"); break;

                    case GameScenes.FLIGHT: InputLockManager.SetControlLock(ControlTypes.ALL_SHIP_CONTROLS, "KSPTipsControlLock"); break;

                    case GameScenes.TRACKSTATION:
                        break;

                    default:
                        break;
                    }
                    InputLockExists = true;
                }
            }
            //Otherwise make sure the lock is removed
            else if (!MouseOverWindow && InputLockExists)
            {
                RemoveInputLock();
            }
        }
Exemple #8
0
        protected override void DrawWindowPre(int id)
        {
            //Lock space center click through
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_ALL, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    removeControlLocks();
                }
            }

            //Lock tracking scene click through
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.TRACKINGSTATION_UI, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    InputLockManager.RemoveControlLock(lockID);
                    controlLock = false;
                }
            }

            if (!popup)
            {
                warningBoxOne   = false;
                warningBoxAll   = false;
                warningResource = false;
            }
        }
Exemple #9
0
        private void CheckWindowLock()
        {
            if (!MainSystem.Singleton.GameRunning)
            {
                RemoveWindowLock();
                return;
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                RemoveWindowLock();
                return;
            }

            if (SafeDisplay)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;

                var shouldLock = WindowRect.Contains(mousePos);

                if (shouldLock && !IsWindowLocked)
                {
                    InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "LMP_DebugLock");
                    IsWindowLocked = true;
                }
                if (!shouldLock && IsWindowLocked)
                {
                    RemoveWindowLock();
                }
            }

            if (!SafeDisplay && IsWindowLocked)
            {
                RemoveWindowLock();
            }
        }
Exemple #10
0
        internal static void OnGUIEvery()
        {
            if (Disabled)
            {
                return;                 //If the Drag and Drop is Disabled then just go back
            }
            //disable resource dragging if we mouseup outside the window
            if (Event.current.type == EventType.mouseUp &&
                Event.current.button == 0 &&
                !WindowRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
            {
                draggingItem  = false;
                GroupDragging = null;
                ServoDragging = null;
            }

            //If we are dragging, show what we are dragging
            if (draggingItem && (ServoDragging != null || GroupDragging != null))
            {
                //set the Style
                //set and draw the text like a tooltip
                String Message = "Moving ";
                if (GroupDragging != null)
                {
                    Message += " group: " + GroupDragging.Name;
                }
                if (ServoDragging != null)
                {
                    Message += " servo: " + ServoDragging.Name;
                }
                Rect LabelPos = new Rect(Input.mousePosition.x - 5, Screen.height - Input.mousePosition.y - 9, 200, 22);
                GUI.Label(LabelPos, Message, styleDragTooltip);

                //On top of everything
                GUI.depth = 0;
            }
        }
        private void CheckWindowLock()
        {
            if (!SystemsContainer.Get <MainSystem>().GameRunning)
            {
                RemoveWindowLock();
                return;
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                RemoveWindowLock();
                return;
            }

            if (Display)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;

                var shouldLock = Minmized ? MinWindowRect.Contains(mousePos) : WindowRect.Contains(mousePos);

                if (shouldLock && !IsWindowLocked)
                {
                    InputLockManager.SetControlLock(ControlTypes.ALLBUTCAMERAS, "LMP_PlayerStatusLock");
                    IsWindowLocked = true;
                }
                if (!shouldLock && IsWindowLocked)
                {
                    RemoveWindowLock();
                }
            }

            if (!Display && IsWindowLocked)
            {
                RemoveWindowLock();
            }
        }
 protected override void Update()
 {
     if (Visible)
     {
         if (_buttonOpened)
         {
             var openedRect = new Rect(WindowRect.xMin, WindowRect.yMin,
                                       WindowRect.width, WindowRect.height + 29);
             StartCoroutine(
                 openedRect.Contains(new Vector2(Input.mousePosition.x,
                                                 Screen.height - Input.mousePosition.y))
                     ? ShowBottomButton()
                     : HideBottomButton());
         }
         else
         {
             StartCoroutine(
                 WindowRect.Contains(new Vector2(Input.mousePosition.x,
                                                 Screen.height - Input.mousePosition.y))
                     ? ShowBottomButton()
                     : HideBottomButton());
         }
     }
 }
        protected override void DrawWindowPre(int id)
        {
            WindowCaption = SCANuiUtil.toDMS(spotmap.CenteredLat, spotmap.CenteredLong);

            if (IsResizing && !inRepaint())
            {
                if (Input.GetMouseButtonUp(0))
                {
                    double scale = spotmap.MapScale;
                    IsResizing = false;
                    if (resizeW < WindowSize_Min.x)
                    {
                        resizeW = WindowSize_Min.x;
                    }
                    else if (resizeW > WindowSize_Max.x)
                    {
                        resizeW = WindowSize_Max.x;
                    }
                    if (resizeH < WindowSize_Min.y)
                    {
                        resizeH = WindowSize_Min.y;
                    }
                    else if (resizeH > WindowSize_Max.y)
                    {
                        resizeH = WindowSize_Max.y;
                    }

                    spotmap.setSize((int)resizeW, (int)resizeH);
                    spotmap.MapScale = scale;
                    spotmap.centerAround(spotmap.CenteredLong, spotmap.CenteredLat);
                    spotmap.resetMap(spotmap.MType, false);
                }
                else
                {
                    float yy = Input.mousePosition.y;
                    float xx = Input.mousePosition.x;
                    if (Input.mousePosition.y < 0)
                    {
                        yy = 0;
                    }
                    if (Input.mousePosition.x < 0)
                    {
                        xx = 0;
                    }

                    resizeH    += dragStart.y - yy;
                    dragStart.y = yy;
                    resizeW    += xx - dragStart.x;
                    dragStart.x = xx;
                }
                if (Event.current.isMouse)
                {
                    Event.current.Use();
                }
            }

            //Lock space center click through
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_ALL, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    InputLockManager.RemoveControlLock(lockID);
                    controlLock = false;
                }
            }

            //Lock tracking scene click through
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.TRACKINGSTATION_UI, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    InputLockManager.RemoveControlLock(lockID);
                    controlLock = false;
                }
            }
        }
Exemple #14
0
        internal override void DrawWindowPre(int id)
        {
            //Prevent click through from activating part options
            if (HighLogic.LoadedSceneIsFlight)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && GUIUtility.hotControl == 0 && Input.GetMouseButton(0))
                {
                    foreach (var window in GameObject.FindObjectsOfType(typeof(UIPartActionWindow)).OfType <UIPartActionWindow>().Where(p => p.Display == UIPartActionWindow.DisplayType.Selected))
                    {
                        window.enabled      = false;
                        window.displayDirty = true;
                    }
                }
            }

            //Lock space center click through
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !spacecenterLocked)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_FACILITIES | ControlTypes.KSC_UI, lockID);
                    spacecenterLocked = true;
                }
                else if (!WindowRect.Contains(mousePos) && spacecenterLocked)
                {
                    InputLockManager.RemoveControlLock(lockID);
                    spacecenterLocked = false;
                }
            }

            //Lock tracking scene click through
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !trackingLocked)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.TRACKINGSTATION_ALL, lockID);
                    trackingLocked = true;
                }
                else if (!WindowRect.Contains(mousePos) && trackingLocked)
                {
                    InputLockManager.RemoveControlLock(lockID);
                    trackingLocked = false;
                }
            }

            //Lock editor click through
            if (HighLogic.LoadedSceneIsEditor)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !editorLocked)
                {
                    EditorLogic.fetch.Lock(true, true, true, lockID);
                    editorLocked = true;
                }
                else if (!WindowRect.Contains(mousePos) && editorLocked)
                {
                    EditorLogic.fetch.Unlock(lockID);
                    editorLocked = false;
                }
            }

            if (!dropDown)
            {
                cDropDown   = false;
                pDropDown   = false;
                rCPopup     = false;
                rPPopup     = false;
                zPopup      = false;
                wPopup      = false;
                stockPopup  = false;
                activePopup = false;
            }
        }
        protected override void DrawWindowPre(int id)
        {
            //Prevent click through from activating part options
            if (HighLogic.LoadedSceneIsFlight)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && GUIUtility.hotControl == 0 && Input.GetMouseButton(0))
                {
                    foreach (var window in GameObject.FindObjectsOfType(typeof(UIPartActionWindow)).OfType <UIPartActionWindow>().Where(p => p.Display == UIPartActionWindow.DisplayType.Selected))
                    {
                        window.enabled      = false;
                        window.displayDirty = true;
                    }
                }
                else if (WindowRect.Contains(mousePos) && dropdown && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS, lockID);
                    controlLock = true;
                }
                else if ((!WindowRect.Contains(mousePos) || !dropdown) && controlLock)
                {
                    unlockControls();
                }
            }

            //Lock space center click through
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_FACILITIES | ControlTypes.KSC_UI, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    unlockControls();
                }
            }

            //Lock tracking scene click through
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.TRACKINGSTATION_ALL, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    unlockControls();
                }
            }

            //Lock editor click through
            if (HighLogic.LoadedSceneIsEditor)
            {
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    EditorLogic.fetch.Lock(true, true, true, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    unlockControls();
                }
            }

            if (!dropdown)
            {
                dup      = false;
                ddown    = false;
                dleft    = false;
                dright   = false;
                daccept  = false;
                ddecline = false;
                dmulti   = false;
            }
        }
Exemple #16
0
        protected override void DrawWindowPre(int id)
        {
            //Some clumsy logic is used here to ensure that the color selection fields always remain in sync with the current map in each scene
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (data == null)
                {
                    data = SCANUtil.getData(FlightGlobals.currentMainBody);
                    if (data == null)
                    {
                        data = new SCANdata(FlightGlobals.currentMainBody);
                        SCANcontroller.controller.addToBodyData(FlightGlobals.currentMainBody, data);
                    }
                }

                if (bigMapObj.Visible && SCANBigMap.BigMap != null)
                {
                    data   = bigMapObj.Data;
                    bigMap = SCANBigMap.BigMap;
                }
                else if (data.Body != FlightGlobals.currentMainBody)
                {
                    data = SCANUtil.getData(FlightGlobals.currentMainBody);
                    if (data == null)
                    {
                        data = new SCANdata(FlightGlobals.currentMainBody);
                        SCANcontroller.controller.addToBodyData(FlightGlobals.currentMainBody, data);
                    }
                }

                if (bigMap == null)
                {
                    if (SCANBigMap.BigMap != null)
                    {
                        bigMap = SCANBigMap.BigMap;
                    }
                }
            }

            //Lock space center click through - Sync SCANdata
            else if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                if (data == null)
                {
                    data = SCANUtil.getData(Planetarium.fetch.Home);
                    if (data == null)
                    {
                        data = new SCANdata(Planetarium.fetch.Home);
                        SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data);
                    }
                }
                if (kscMapObj.Visible)
                {
                    data   = kscMapObj.Data;
                    bigMap = SCANkscMap.BigMap;
                }
                else if (data.Body != Planetarium.fetch.Home)
                {
                    data = SCANUtil.getData(Planetarium.fetch.Home);
                    if (data == null)
                    {
                        data = new SCANdata(Planetarium.fetch.Home);
                        SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data);
                    }
                }
                if (bigMap == null)
                {
                    if (SCANkscMap.BigMap != null)
                    {
                        bigMap = SCANkscMap.BigMap;
                    }
                }
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_ALL, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    removeControlLocks();
                }
            }

            //Lock tracking scene click through - Sync SCANdata
            else if (HighLogic.LoadedScene == GameScenes.TRACKSTATION)
            {
                if (data == null)
                {
                    data = SCANUtil.getData(Planetarium.fetch.Home);
                    if (data == null)
                    {
                        data = new SCANdata(Planetarium.fetch.Home);
                        SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data);
                    }
                }
                if (kscMapObj.Visible)
                {
                    data   = kscMapObj.Data;
                    bigMap = SCANkscMap.BigMap;
                }
                else if (data.Body != Planetarium.fetch.Home)
                {
                    data = SCANUtil.getData(Planetarium.fetch.Home);
                    if (data == null)
                    {
                        data = new SCANdata(Planetarium.fetch.Home);
                        SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data);
                    }
                }
                if (bigMap == null)
                {
                    if (SCANkscMap.BigMap != null)
                    {
                        bigMap = SCANkscMap.BigMap;
                    }
                }
                Vector2 mousePos = Input.mousePosition;
                mousePos.y = Screen.height - mousePos.y;
                if (WindowRect.Contains(mousePos) && !controlLock)
                {
                    InputLockManager.SetControlLock(ControlTypes.TRACKINGSTATION_UI, lockID);
                    controlLock = true;
                }
                else if (!WindowRect.Contains(mousePos) && controlLock)
                {
                    removeControlLocks();
                }
            }

            //This updates all of the fields whenever the palette selection is changed
            if (windowMode == 0 && (currentLegend == null || bodyIndex != data.Body.flightGlobalsIndex))
            {
                currentTerrain = new SCANterrainConfig(data.TerrainConfig);

                SCANUtil.SCANdebugLog("Trigger Body Change");
                bodyIndex = data.Body.flightGlobalsIndex;

                currentTerrain = new SCANterrainConfig(data.TerrainConfig);

                updateUI();
            }

            if (windowMode == 0 && previewLegend == null)
            {
                drawPreviewLegend();
            }

            if (!dropDown)
            {
                paletteBox  = false;
                resourceBox = false;
                saveWarning = false;
            }
        }
Exemple #17
0
 public bool Contains(Vector2 posAbs)
 {
     return(WindowRect.Contains(posAbs));
 }
Exemple #18
0
        private void HandlePanning()
        {
            if (Event.current.type == EventType.MouseDown && Event.current.button == PanButton && WindowRect.Contains(MousePosition) && !IsHoveringMiniMap)
            {
                isPanning    = true;
                panDragStart = MousePosition;
            }

            if (Event.current.rawType == EventType.MouseUp)
            {
                isPanning = false;
            }

            if (!isPanning && !isPanningMiniMap && Event.current.type == EventType.ScrollWheel && WindowRect.Contains(MousePosition))
            {
                WindowOffset -= Vector2.up * Event.current.delta.y * ScrollSpeed;
            }

            if (isPanning)
            {
                WindowOffset += MousePosition - panDragStart;
                panDragStart  = MousePosition;
            }
            else if (isPanningMiniMap)
            {
                WindowOffset = -((Event.current.mousePosition - WindowRect.position - WindowPadding * MiniMapScaleFactor) - MiniMapWindowRect.position) / MiniMapScaleFactor + WindowRect.size * .5f;
                KeepWindowOffsetWithinBoundaries(false);
            }
            else
            {
                KeepWindowOffsetWithinBoundaries(true);
            }
        }