Esempio n. 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateMeshes()
        {
            HoverFillButton fillButton = gameObject.GetComponent <HoverFillButton>();
            HoverShapeArc   shapeArc   = gameObject.GetComponent <HoverShapeArc>();

            bool  isOuterEdge      = (EdgePosition == EdgePositionType.Outer);
            float inset            = EdgeThickness * Mathf.Sign(shapeArc.OuterRadius - shapeArc.InnerRadius);
            float insetOuterRadius = shapeArc.OuterRadius - (isOuterEdge ? inset : 0);
            float insetInnerRadius = shapeArc.InnerRadius + (isOuterEdge ? 0 : inset);
            float edgeOuterRadius  = (isOuterEdge ? shapeArc.OuterRadius : insetInnerRadius);
            float edgeInnerRadius  = (isOuterEdge ? insetOuterRadius : shapeArc.InnerRadius);

            if (fillButton.Background != null)
            {
                UpdateMeshShape(fillButton.Background, insetOuterRadius, insetInnerRadius);
            }

            if (fillButton.Highlight != null)
            {
                UpdateMeshShape(fillButton.Highlight, insetOuterRadius, insetInnerRadius);
            }

            if (fillButton.Selection != null)
            {
                UpdateMeshShape(fillButton.Selection, insetOuterRadius, insetInnerRadius);
            }

            if (fillButton.Edge != null)
            {
                UpdateMeshShape(fillButton.Edge,
                                edgeOuterRadius, edgeInnerRadius, fillButton.ShowEdge);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateMeshes()
        {
            HoverFillButton fillButton = gameObject.GetComponent <HoverFillButton>();
            HoverShapeRect  shapeRect  = gameObject.GetComponent <HoverShapeRect>();

            float totalEdgeThick = EdgeThickness * 2;
            float insetSizeX     = Mathf.Max(0, shapeRect.SizeX - totalEdgeThick);
            float insetSizeY     = Mathf.Max(0, shapeRect.SizeY - totalEdgeThick);

            if (fillButton.Background != null)
            {
                UpdateMeshShape(fillButton.Background, insetSizeX, insetSizeY);
            }

            if (fillButton.Highlight != null)
            {
                UpdateMeshShape(fillButton.Highlight, insetSizeX, insetSizeY);
            }

            if (fillButton.Selection != null)
            {
                UpdateMeshShape(fillButton.Selection, insetSizeX, insetSizeY);
            }

            if (fillButton.Edge != null)
            {
                HoverIndicator meshInd = fillButton.Edge.GetComponent <HoverIndicator>();
                float          minSize = Mathf.Min(shapeRect.SizeX, shapeRect.SizeY);

                meshInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
                meshInd.HighlightProgress = 1 - totalEdgeThick / minSize;             //TODO:  hack/workaround

                UpdateMeshShape(fillButton.Edge,
                                shapeRect.SizeX, shapeRect.SizeY, fillButton.ShowEdge);
            }
        }
Esempio n. 3
0
        /*--------------------------------------------------------------------------------------------*/
        public void TreeUpdate()
        {
            bool isSelected = (
                !UseItemSelectionState ||
                CanvasUpdater.IconType == HoverCanvasDataUpdater.IconPairType.RadioOn ||
                CanvasUpdater.IconType == HoverCanvasDataUpdater.IconPairType.CheckboxOn
                );

            HoverMesh.DisplayModeType dispMode = (isSelected ?
                                                  HoverMesh.DisplayModeType.SliderFill : HoverMesh.DisplayModeType.Standard);

            ////

            HoverShapeRect shapeRect  = GetComponent <HoverShapeRect>();
            float          minOutward = -Mathf.Min(shapeRect.SizeX, shapeRect.SizeY) / 2;

            TabOutward   = Mathf.Max(TabOutward, minOutward);
            TabThickness = Mathf.Max(TabThickness, 0);

            ////

            HoverFillButton hoverFill = GetComponent <HoverFillButton>();
            int             meshCount = hoverFill.GetChildMeshCount();

            for (int i = 0; i < meshCount; i++)
            {
                UpdateChildMesh((HoverMeshRectHollowTab)hoverFill.GetChildMesh(i), dispMode);
            }

            if (isSelected)
            {
                hoverFill.Controllers.Set(HoverFillButton.ShowEdgeName, this);
                hoverFill.ShowEdge = true;
                RendererUtil.SetActiveWithUpdate(hoverFill.Edge, true);
            }
        }