コード例 #1
0
        private void Open()
        {
            // fade menu in if already open
            if (m_ToolbarMenu != null && m_ToolbarMenu.IsFadingOut)
            {
                m_ToolbarMenu.fadeIn();
                return;
            }

            if (m_MenuPrefab == null || m_MenuObject != null)
            {
                return;
            }

            m_MenuObject = Instantiate(m_MenuPrefab, GetAnchor(), Quaternion.identity) as GameObject;
            if (m_MenuObject == null)
            {
                return;
            }

            m_MenuObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform);
            m_ToolbarMenu = m_MenuObject.GetComponent <ToolbarMenu> ();
            if (m_ToolbarMenu != null)
            {
                m_ToolbarMenu.SetMenuControl(this);
                if (!NodeTools.patchedConicsUnlocked)
                {
                    m_ToolbarMenu.DisableMainWindow();
                }
            }
            GUIComponentManager.processStyle(m_MenuObject);
            GUIComponentManager.processLocalization(m_MenuObject);
            GUIComponentManager.replaceLabelsWithTMPro(m_MenuObject);
        }
コード例 #2
0
        private void openMainWindow()
        {
            // fade in if already open
            if (m_MainWindow != null)
            {
                m_MainWindow.MoveToBackground(config.isInBackground);
                if (m_MainWindow.IsFadingOut)
                {
                    m_MainWindow.fadeIn();
                }
                if (config.modulesChanged)
                {
                    mainWindow.updateMainWindow(m_MainWindow);
                }
                return;
            }

            if (m_WindowPrefab == null || m_MainWindowObject != null)
            {
                return;
            }

            // create object
            Vector3 pos = new Vector3(config.mainWindowPos.x, config.mainWindowPos.y, MainCanvasUtil.MainCanvasRect.position.z);

            m_MainWindowObject = Instantiate(m_WindowPrefab, pos, Quaternion.identity) as GameObject;
            if (m_MainWindowObject == null)
            {
                return;
            }

            m_MainWindow = m_MainWindowObject.GetComponent <DraggableWindow> ();
            if (m_MainWindow != null)
            {
                m_MainWindow.SetTitle(Localizer.Format("precisemaneuver_caption"));
                m_MainWindow.setMainCanvasTransform(MainCanvasUtil.MainCanvasRect);
                mainWindow.clearMainWindow();
                mainWindow.updateMainWindow(m_MainWindow);
                m_MainWindow.MoveToBackground(config.isInBackground);
                m_MainWindow.OnWindowPointerEnter = setWindow1InputLock;
                m_MainWindow.OnWindowPointerExit  = resetWindow1InputLock;
            }
            scaleMainWindow();
            config.listenToScaleChange(scaleMainWindow);

            GUIComponentManager.processStyle(m_MainWindowObject);
            GUIComponentManager.replaceLabelsWithTMPro(m_MainWindowObject);

            // set object as a child of the main canvas
            m_MainWindowObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform);
        }
コード例 #3
0
        private void openKeybindingsWindow()
        {
            // fade in if already open
            if (m_KeybindingsWindow != null)
            {
                if (m_KeybindingsWindow.IsFadingOut)
                {
                    m_KeybindingsWindow.fadeIn();
                }
                return;
            }

            if (m_WindowPrefab == null || m_KeybindingsWindowObject != null)
            {
                return;
            }

            // create window object
            Vector3 pos = new Vector3(config.keymapperWindowPos.x, config.keymapperWindowPos.y, MainCanvasUtil.MainCanvasRect.position.z);

            m_KeybindingsWindowObject = Instantiate(m_WindowPrefab, pos, Quaternion.identity) as GameObject;
            if (m_KeybindingsWindowObject == null)
            {
                return;
            }

            // populate window
            m_KeybindingsWindow = m_KeybindingsWindowObject.GetComponent <DraggableWindow>();
            if (m_KeybindingsWindow != null)
            {
                m_KeybindingsWindow.SetTitle(Localizer.Format("precisemaneuver_keybindings_caption"));
                m_KeybindingsWindow.setMainCanvasTransform(MainCanvasUtil.MainCanvasRect);
                hotkeys.fillKeymapperWindow(m_KeybindingsWindow);
                m_KeybindingsWindow.OnWindowPointerEnter = setWindow2InputLock;
                m_KeybindingsWindow.OnWindowPointerExit  = resetWindow2InputLock;
            }

            GUIComponentManager.processStyle(m_KeybindingsWindowObject);
            GUIComponentManager.processLocalization(m_KeybindingsWindowObject);
            GUIComponentManager.replaceLabelsWithTMPro(m_KeybindingsWindowObject);

            // set object as a child of the main canvas
            m_KeybindingsWindowObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform);
        }