private void Start()
    {
        myPanel            = PanelUtils.CreatePanelFor(panelContent, canvas);
        buttonImage.sprite = showPanelSprite;

        HidePanel();
    }
示例#2
0
        public void SetVisible(bool value)
        {
            bool oldValue = visible;

            visible = value;

            if (value)
            {
                PanelManager.HideAllPanels(this);
            }

            GameObject target = GetTarget();

            target.SetActive(visible);
            if (visible)
            {
                PanelProfile profile = Defaults.GetProfile(panelProfile);
                if (oldValue != value)
                {
                    ZeroNotSelectableCount();
                }
                Vector3 noYOffset = profile.offset;
                noYOffset.y = 0;
                Vector3 positionWithoutYOffset = PanelUtils.Position(profile.sceneCamera, controller, noYOffset, profile.minDistance);
                target.transform.position = PanelUtils.Position(profile.sceneCamera, controller, profile.offset, profile.minDistance);
                target.transform.rotation = PanelUtils.Rotation(profile.sceneCamera, positionWithoutYOffset);
            }
        }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        Panel panel1 = PanelUtils.CreatePanelFor(content1, canvas);

        panel1.AddTab(content2);
        panel1.DockToRoot(Direction.Left);
        canvas.ForceRebuildLayoutImmediate();
    }
示例#4
0
    /// <summary>
    /// Apre un pannello per selezionare un dataset da importare nella cartella MyDataset
    /// </summary>
    public void OpenImportPanel()
    {
        PanelUtils.OpenImportPanel();

        if (currSceneEnum == SceneEnum.Mainpage)
        {
            UpdateSelectedDatasetText();
        }
    }
示例#5
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            PanelUtils.InitializeGraphics(e.Graphics);
            PanelUtils.InitializePanel(panel1, null);
            PanelUtils.InitializeSigns(signs);

            PanelUtils.DrawNote(_firstNote, panel1, showSigns);
            PanelUtils.DrawNote(_secondNote, panel1, showSigns);
            PanelUtils.DrawNote(_thirdNote, panel1, showSigns);
        }
示例#6
0
    /// <summary>
    /// Apre il pannello per selezionare una configurazione.
    /// </summary>
    public void OpenPanel()
    {
        PanelUtils.OpenPanel();

        Debug.Log(FileUtils.selectedDataset);
        if (currSceneEnum == SceneEnum.Mainpage)
        {
            UpdateSelectedDatasetText();
            playButton.interactable = FileUtils.CheckForDefaultFiles();
        }
    }
示例#7
0
        internal void InvalidateInt(RibbonGroupsPanel ribbonGroupPanel)
        {
            if (ItemsHost != null)
            {
                PanelUtils.InvalidateAncestorsMeasure(ItemsHost, ribbonGroupPanel);
            }

            foreach (var ribbonItem in Items)
            {
                ribbonItem.InvalidateMeasureInt();
            }
        }
示例#8
0
        public void Resize()
        {
#if UNITY_EDITOR
            Undo.SetCurrentGroupName("GrowButtonByTextMesh Resize");
            int group = Undo.GetCurrentGroup();
#endif

            float rowWidth = RowWidth();

#if UNITY_EDITOR
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                Undo.RecordObject(gameObject.transform.GetChild(i), "Resize Child");
            }
#endif

            textMesh.gameObject.transform.SetParent(null, true);

#if UNITY_EDITOR
            Undo.RecordObject(transform, "Scale Main Object");
#endif

            PanelUtils.PanelResizeWidth panelResizeWidth = PanelUtils.ResizeWidth(gameObject, rowWidth, 0, true);
            transform.localScale = new Vector3(panelResizeWidth.xScale, transform.localScale.y, transform.localScale.z);
            textMesh.gameObject.transform.SetParent(gameObject.transform, true);
            if (alignment == TextAlignment.Left)
            {
                // FIXME: this can be optimized by batching all WorldDistanceToLocalDistance calls for this object
                float localTextMeshWidth        = TransformWithoutRotation.WorldDistanceToLocalDistance(TextMeshWidth(), textMesh.gameObject);
                float localParentContainerWidth = TransformWithoutRotation.WorldDistanceToLocalDistance(rowWidth, textMesh.gameObject);
                float localPadding = TransformWithoutRotation.WorldDistanceToLocalDistance(padding, textMesh.gameObject);
                float xOffset      = localTextMeshWidth / 2 + localPadding - localParentContainerWidth / 2;
                textMesh.gameObject.transform.localPosition = new Vector3(
                    xOffset * textMesh.gameObject.transform.localScale.x,
                    textMesh.gameObject.transform.localPosition.y,
                    textMesh.gameObject.transform.localPosition.z
                    );
            }
            else
            {
                textMesh.gameObject.transform.localPosition = new Vector3(0, textMesh.gameObject.transform.localPosition.y, textMesh.gameObject.transform.localPosition.z);
            }

#if UNITY_EDITOR
            Undo.CollapseUndoOperations(group);
#endif

            if (transform.parent)
            {
                ExecuteEvents.Execute <IChild3dWidgetResized>(transform.parent.gameObject, null, (x, y) => x.Child3dWidgetResized());
            }
        }
        private float Width()
        {
            float        width  = 0;
            List <float> widths = new List <float>();

            for (int i = 0; i < list.Count - 1; i++)
            {
                widths.Add(height);
            }

            width += PanelUtils.SumWithSpacing(widths, space);

            return(width);
        }
        public float RowWidth()
        {
            float        width  = padding * 2;
            List <float> widths = new List <float>();

            foreach (Transform child in transform)
            {
                if (!child.gameObject.activeSelf)
                {
                    continue;
                }
                widths.Add(ObjectBounds.WorldWidth(child.gameObject));
            }

            width += PanelUtils.SumWithSpacing(widths, spacing);

            return(width);
        }
        public float ColumnHeight()
        {
            float        height  = padding * 2;
            List <float> heights = new List <float>();

            foreach (Transform child in transform)
            {
                if (!child.gameObject.activeSelf)
                {
                    continue;
                }
                heights.Add(ObjectBounds.WorldHeight(child.gameObject));
            }

            height += PanelUtils.SumWithSpacing(heights, spacing);

            return(height);
        }
示例#12
0
        void Start()
        {
            Panel leftGroupPanel  = PanelUtils.CreatePanelFor(leftTab1Content, dynamicPanelsCanvas);
            Panel rightGroupPanel = PanelUtils.CreatePanelFor(rightTab1Content, dynamicPanelsCanvas);

            // Set the minimum sizes of the contents associated with the tabs
            leftGroupPanel[0].MinSize  = new Vector2(400f, 200f);
            rightGroupPanel[0].MinSize = new Vector2(400f, 200f);

            // Left Panel
            PanelTab hierarchyTab = leftGroupPanel.GetTab(leftTab1Content);

            hierarchyTab.Label = "  Hierarchy";
            hierarchyTab.Icon  = null;

            PanelTab searchTab = leftGroupPanel.AddTab(leftTab2Content);

            searchTab.Label = "  Search";
            searchTab.Icon  = null;

            // Right Panel
            PanelTab inspectorTab = rightGroupPanel.GetTab(rightTab1Content);

            inspectorTab.Label = "  Inspector";
            inspectorTab.Icon  = null;

            if (rightTab2Content != null)
            {
                PanelTab commandsTab = rightGroupPanel.AddTab(rightTab2Content);
                commandsTab.Label = "  Commands";
                commandsTab.Icon  = null;
            }

            leftGroupPanel.ActiveTab = 0;
            // leftGroupPanel.DockToRoot(Direction.Left);

            rightGroupPanel.ActiveTab = 0;
            // rightGroupPanel.DockToRoot(Direction.Right);

            dynamicPanelsCanvas.ForceRebuildLayoutImmediate();

            leftGroupPanel.ResizeTo(new Vector2(450, 800));
            rightGroupPanel.ResizeTo(new Vector2(520, 800));
        }
示例#13
0
        public void Resize()
        {
#if UNITY_EDITOR
            Undo.SetCurrentGroupName("PanelContainer Resize");
            int group = Undo.GetCurrentGroup();
#endif

            CalculateBounds();

            float maxWidth  = bounds.size.x;
            float maxHeight = bounds.size.y;

#if UNITY_EDITOR
            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                Undo.RecordObject(gameObject.transform.GetChild(i), "Resize Child");
            }
#endif

            Transform[] children = DetachReattach.DetachChildren(gameObject);

#if UNITY_EDITOR
            Undo.RecordObject(transform, "Resize Panel");
#endif

            PanelUtils.PanelResizeWidth  panelResizeWidth  = PanelUtils.ResizeWidth(gameObject, maxWidth, 0);
            PanelUtils.PanelResizeHeight panelResizeHeight = PanelUtils.ResizeHeight(gameObject, maxHeight, 0);
            if (panelResizeWidth.xScale > 0 && panelResizeHeight.yScale > 0)
            {
                transform.localScale = new Vector3(panelResizeWidth.xScale, panelResizeHeight.yScale, transform.localScale.z);
            }

            DetachReattach.ReattachChildren(children, gameObject);

            transform.position = transform.position + transform.right * panelResizeWidth.xOffset + transform.up * panelResizeHeight.yOffset;

#if UNITY_EDITOR
            Undo.CollapseUndoOperations(group);
#endif

            dirty = false;
        }
示例#14
0
        protected override Size MeasureOverride(Size availableSize)
        {
            var hasOverflowedItems = HasOverflowItems;

            HasOverflowItems = false;

            var measureOverride = base.MeasureOverride(availableSize);

            HasOverflowItems = ItemsHost?.HasOverflowChildren ?? false;

            if (HasOverflowItems == false && hasOverflowedItems == false)
            {
                return(measureOverride);
            }

            if (ItemsHost != null)
            {
                PanelUtils.InvalidateAncestorsMeasure(ItemsHost, this);
            }

            return(base.MeasureOverride(availableSize));
        }
示例#15
0
 internal static void InvalidateAncestorsArrange(this UIElement uie, UIElement untilAncestor, bool includeLast)
 {
     PanelUtils.InvalidateAncestorsArrangeIncludeLast(uie, untilAncestor);
 }
示例#16
0
 /// <summary>
 /// Apre un pannello per selezionare un dataset da esportare in una qualsiasi directory sul pc
 /// </summary>
 public void OpenExportPanel()
 {
     PanelUtils.OpenExportPanel();
 }
示例#17
0
 public static void SetZIndex(this UIElement element, int zindex)
 {
   PanelUtils.SetZIndex(element, zindex);
 }
示例#18
0
 internal static void InvalidateAncestorsArrange(this UIElement uie)
 {
     PanelUtils.InvalidateAncestorsArrange(uie);
 }
示例#19
0
 internal static void InvalidateAncestorsMeasure(this UIElement uie, UIElement untilAncestor)
 {
     PanelUtils.InvalidateAncestorsMeasure(uie, untilAncestor);
 }