Ejemplo n.º 1
0
        private void OnDialogDestroyed(Dialog dialog)
        {
            RuntimeWindow dialogWindow = dialog.Content.GetComponentInParent <RuntimeWindow>();

            OnContentDestroyed(dialog.Content);

            if (!m_dialogManager.IsDialogOpened)
            {
                Transform pointerOverWindow = dialog.Content != null?FindPointerOverWindow(dialogWindow) : null;

                if (pointerOverWindow != null)
                {
                    RuntimeWindow window = pointerOverWindow.GetComponentInChildren <RuntimeWindow>();
                    if (window == null)
                    {
                        window = m_editor.GetWindow(RuntimeWindowType.Scene);
                    }
                    window.IsPointerOver = true;
                    m_editor.ActivateWindow(window);
                }
                else
                {
                    RuntimeWindow window = m_editor.GetWindow(RuntimeWindowType.Scene);
                    m_editor.ActivateWindow(window);
                }

                if (DeferUpdate != null)
                {
                    DeferUpdate();
                }
            }
        }
Ejemplo n.º 2
0
        private IEnumerator CoImport(IFileImporter importer, string path)
        {
            IRTE rte = IOC.Resolve <IRTE>();

            rte.IsBusy = true;

            IProjectTree projectTree = IOC.Resolve <IProjectTree>();
            string       targetPath  = Path.GetFileNameWithoutExtension(path);

            if (projectTree != null && projectTree.SelectedItem != null)
            {
                ProjectItem folder = projectTree.SelectedItem;

                targetPath = folder.RelativePath(false) + "/" + targetPath;
                targetPath = targetPath.TrimStart('/');

                IProject project = IOC.Resolve <IProject>();
                targetPath = project.GetUniquePath(targetPath, typeof(Texture2D), folder);
            }

            yield return(StartCoroutine(importer.Import(path, targetPath)));

            rte.IsBusy = false;
            m_parentDialog.Close();

            rte.ActivateWindow(RuntimeWindowType.Scene);
        }
 private void Update()
 {
     if (m_isPointerOver && m_rte.Input.IsAnyKeyDown())
     {
         m_rte.ActivateWindow(null);
     }
 }
Ejemplo n.º 4
0
        private void Update()
        {
            if (m_skipUpdate)
            {
                m_skipUpdate = false;
                return;
            }

            if (!m_editor.IsInputFieldActive)
            {
                if (m_dialogManager.IsDialogOpened)
                {
                    if (m_editor.Input.GetKeyDown(KeyCode.Escape))
                    {
                        m_dialogManager.CloseDialog();
                    }
                }
            }

            m_editor.UpdateCurrentInputField();
            EnableOrDisableRaycasts();

            bool mwheel = false;

            if (m_zAxis != Mathf.CeilToInt(Mathf.Abs(Input.GetAxis(InputAxis.Z))))
            {
                mwheel  = m_zAxis == 0;
                m_zAxis = Mathf.CeilToInt(Mathf.Abs(Input.GetAxis(InputAxis.Z)));
            }

            bool pointerDownOrUp = Input.GetPointerDown(0) ||
                                   Input.GetPointerDown(1) ||
                                   Input.GetPointerDown(2) ||
                                   Input.GetPointerUp(0);

            bool canActivate = pointerDownOrUp ||
                               mwheel ||
                               Input.IsAnyKeyDown() && (CurrentInputField == null || !CurrentInputField.isFocused);

            if (canActivate)
            {
                PointerEventData pointerEventData = new PointerEventData(m_editor.EventSystem);
                pointerEventData.position = Input.GetPointerXY(0);

                List <RaycastResult> results = new List <RaycastResult>();
                Raycaster.Raycast(pointerEventData, results);

                RectTransform activeRectTransform             = GetRegionTransform(ActiveWindow);
                bool          activeWindowContainsScreenPoint = activeRectTransform != null && RectTransformUtility.RectangleContainsScreenPoint(activeRectTransform, Input.GetPointerXY(0), Raycaster.eventCamera);


                if (!results.Any(r => r.gameObject.GetComponent <Menu>()))
                {
                    foreach (Region region in results.Select(r => r.gameObject.GetComponentInParent <Region>()).Where(r => r != null).OrderBy(r => r.transform.localPosition.z))
                    {
                        RuntimeWindow window = region.ActiveContent != null?region.ActiveContent.GetComponentInChildren <RuntimeWindow>() : region.ContentPanel.GetComponentInChildren <RuntimeWindow>();

                        if (window != null && (!activeWindowContainsScreenPoint || window.Depth >= ActiveWindow.Depth))
                        {
                            if (m_editor.Contains(window))
                            {
                                if (pointerDownOrUp || window.ActivateOnAnyKey)
                                {
                                    if (window != null && window.WindowType == RuntimeWindowType.Scene)
                                    {
                                        IEnumerable <Selectable> selectables = results.Select(r => r.gameObject.GetComponent <Selectable>()).Where(s => s != null);
                                        int count = selectables.Count();
                                        if (count >= 1)
                                        {
                                            RuntimeSelectionComponentUI selectionComponentUI = selectables.First() as RuntimeSelectionComponentUI;
                                            if (selectionComponentUI != null)
                                            {
                                                selectionComponentUI.Select();
                                            }
                                        }
                                    }

                                    if (window != ActiveWindow)
                                    {
                                        m_editor.ActivateWindow(window);
                                        region.MoveRegionToForeground();
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }