예제 #1
0
 public void StopAnchorPreviewPanelTo(AnchorZoneBase anchorZone)
 {
     if (hoveredAnchorZone == anchorZone)
     {
         hoveredAnchorZone = null;
     }
 }
예제 #2
0
        public void OnEndPanelTabTranslate(PanelTab panelTab, PointerEventData draggingPointer)
        {
            if (draggedPanel == panelTab.Panel)
            {
                AnchorZoneBase targetAnchor = hoveredAnchorZone;
                if (hoveredAnchorZone != null)
                {
                    hoveredAnchorZone.OnPointerExit(draggingPointer);
                }

                AnchorZonesSetActive(false);

                if (targetAnchor == null || !targetAnchor.Execute(panelTab, draggingPointer))
                {
                    Panel detachedPanel = DetachPanelTab(draggedPanel, draggedPanel.GetTabIndex(panelTab.Content));
                    if (detachedPanel.Canvas != previewPanelCanvas)
                    {
                        previewPanelCanvas.UnanchoredPanelGroup.AddElement(detachedPanel);
                        detachedPanel.RectTransform.SetAsLastSibling();
                    }

                    detachedPanel.MoveTo(draggingPointer.position);
                }

                draggedPanel      = null;
                hoveredAnchorZone = null;
                previewPanel.gameObject.SetActive(false);
            }
        }
예제 #3
0
        public void CancelDraggingPanel()
        {
            if (draggedPanel != null)
            {
                if (draggedPanel.RectTransform.parent != draggedPanel.Canvas.RectTransform)
                {
                    draggedPanel.RectTransform.SetParent(draggedPanel.Canvas.RectTransform, false);
                    draggedPanel.RectTransform.SetAsLastSibling();
                }

                AnchorZonesSetActive(false);

                UnanchoredPanelGroup unanchoredGroup = draggedPanel.Group as UnanchoredPanelGroup;
                if (unanchoredGroup != null)
                {
                    unanchoredGroup.RestrictPanelToBounds(draggedPanel);
                }

                draggedPanel.Internal.Stop();
                draggedPanel = null;
            }

            hoveredAnchorZone = null;

            if (previewPanel.gameObject.activeSelf)
            {
                previewPanel.gameObject.SetActive(false);
            }
        }
예제 #4
0
        public bool AnchorPreviewPanelTo(AnchorZoneBase anchorZone)
        {
            if (hoveredAnchorZone != null || draggedPanel == null)
            {
                return(false);
            }

            hoveredAnchorZone = anchorZone;
            return(true);
        }