Beispiel #1
0
        internal static void Update()
        {
            if (EditorLogic.fetch.editorScreen != EditorScreen.Parts || !QSettings.Instance.EnableWheelScroll || !EditorPanels.Instance.IsMouseOver())
            {
                return;
            }
            if (EditorPartList.Instance != null)
            {
                if (EditorPartList.Instance.partListScrollRect.vertical && EditorPartList.Instance.partListScrollRect.verticalScrollbar.IsInteractable())
                {
                    if (string.IsNullOrEmpty(PartCategorizer.Instance.searchField.text) && !PartCategorizer.Instance.searchField.isFocused)
                    {
                        if (indexParts > 0)
                        {
                            int _partsPages = partsPages;
                            if (EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps != _partsPages)
                            {
                                EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps = _partsPages;
                                EditorPartList.Instance.partListScrollRect.scrollSensitivity = _partsPages * 150f;
                                QuickScroll.Log("Set pages: " + _partsPages, "QScroll");
                                QuickScroll.Log("\tscrollSensitivity " + _partsPages * 150f, "QScroll");
                            }
                        }
                    }
                    if (PartCategorizer.Instance.searchField.isFocused)
                    {
                        if (EditorPartList.Instance.partListScrollRect.scrollSensitivity != 27f || EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps != 0)
                        {
                            EditorPartList.Instance.partListScrollRect.verticalScrollbar.numberOfSteps = 0;
                            EditorPartList.Instance.partListScrollRect.scrollSensitivity = 27f;
                            QuickScroll.Log("Reset scrollSensitivity and numberOfSteps", "QScroll");
                        }
                    }
                }
            }
            float _scroll = Input.GetAxis("Mouse ScrollWheel");

            if (_scroll == 0)
            {
                return;
            }
            if (isOverArrow)
            {
                if (isSimple)
                {
                    PartCategorizer.Instance.SetAdvancedMode();
                }
                else
                {
                    PartCategorizer.Instance.SetSimpleMode();
                }
                return;
            }
            bool _ModKeyFilterWheel   = false;
            bool _ModKeyCategoryWheel = false;

            if (QSettings.Instance.EnableWheelShortCut)
            {
                _ModKeyFilterWheel   = Input.GetKey(QSettings.Instance.ModKeyFilterWheel);
                _ModKeyCategoryWheel = Input.GetKey(QSettings.Instance.ModKeyCategoryWheel);
            }
            bool _ModKeyWheel = _ModKeyFilterWheel || _ModKeyCategoryWheel;

            if (isOverFilters || (_ModKeyWheel && isOverCategories) || (_ModKeyFilterWheel && isOverParts))
            {
                if (isSimple)
                {
                    PartCategorizer.Instance.SetAdvancedMode();
                }
                QCategory.SelectPartFilter(_scroll > 0);
            }
            else if (isOverCategories || (_ModKeyCategoryWheel && isOverParts))
            {
                QCategory.SelectPartCategory(_scroll > 0);
            }

            /*else if (isOverParts && indexParts > 0) {
             *      QCategory.PartListTooltipsTWEAK (false);
             * }*/
        }
Beispiel #2
0
        internal static void Update()
        {
            if (SetKey != Key.None)
            {
                if (Event.current.isKey)
                {
                    KeyCode _key = Event.current.keyCode;
                    if (_key != KeyCode.None)
                    {
                        SetCurrentKey(SetKey, _key);
                        QSettings.Instance.Save();
                        SetKey = Key.None;
                        QGUI.WindowSettings = true;
                    }
                }
                return;
            }
            if (EditorLogic.fetch.editorScreen != EditorScreen.Parts)
            {
                return;
            }
            if (!QSettings.Instance.EnableKeyShortCut)
            {
                return;
            }
            bool _ModKey = (QSettings.Instance.ModKeyShortCut == KeyCode.None ? true : Input.GetKey(QSettings.Instance.ModKeyShortCut));

            if (!_ModKey)
            {
                return;
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyFilterPrevious))
            {
                PartCategorizer.Instance.SetAdvancedMode();
                QCategory.SelectPartFilter(true);
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyFilterNext))
            {
                PartCategorizer.Instance.SetAdvancedMode();
                QCategory.SelectPartFilter(false);
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyCategoryPrevious))
            {
                QCategory.SelectPartCategory(true);
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyCategoryNext))
            {
                QCategory.SelectPartCategory(false);
            }

            /*if (Input.GetKeyDown (QSettings.Instance.KeyPagePrevious)) {
             *      QCategory.SelectPartPage (true);
             * }
             * if (Input.GetKeyDown (QSettings.Instance.KeyPageNext)) {
             *      QCategory.SelectPartPage (false);
             * }*/
            if (Input.GetKeyDown(QSettings.Instance.KeyPods))
            {
                PartCategorizer.SetPanel_FunctionPods();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyFuelTanks))
            {
                PartCategorizer.SetPanel_FunctionFuelTank();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyEngines))
            {
                PartCategorizer.SetPanel_FunctionEngine();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyCommandNControl))
            {
                PartCategorizer.SetPanel_FunctionControl();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyStructural))
            {
                PartCategorizer.SetPanel_FunctionStructural();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyAerodynamics))
            {
                PartCategorizer.SetPanel_FunctionAero();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeyUtility))
            {
                PartCategorizer.SetPanel_FunctionUtility();
            }
            if (Input.GetKeyDown(QSettings.Instance.KeySciences))
            {
                PartCategorizer.SetPanel_FunctionScience();
            }
        }