/*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            vMainAlpha = 1;

            if (!vItemState.Item.IsEnabled || !vItemState.Item.AreParentsEnabled)
            {
                vMainAlpha *= 0.333f;
            }

            ISelectableItem selItem  = (vItemState.Item as ISelectableItem);
            float           high     = vItemState.MaxHighlightProgress;
            bool            showEdge = (vItemState.IsNearestHighlight && !vItemState.IsSelectionPrevented &&
                                        selItem != null && selItem.AllowSelection);
            float edge        = (showEdge ? high : 0);
            float select      = 1 - (float)Math.Pow(1 - vItemState.SelectionProgress, 1.5f);
            float selectAlpha = select;

            if (selItem != null && selItem.IsStickySelected)
            {
                selectAlpha = 1;
            }

            Color colBg   = vVisualSettings.BackgroundColor;
            Color colEdge = vVisualSettings.EdgeColor;
            Color colHigh = vVisualSettings.HighlightColor;
            Color colSel  = vVisualSettings.SelectionColor;

            colBg.a   *= vMainAlpha;
            colEdge.a *= edge * vMainAlpha;
            colHigh.a *= high * vMainAlpha;
            colSel.a  *= selectAlpha * vMainAlpha;

            vHoverRect.UpdateBackground(colBg);
            vHoverRect.UpdateEdge(colEdge);
            vHoverRect.UpdateHighlight(colHigh, high);
            vHoverRect.UpdateSelect(colSel, select);

            vLabel.Alpha    = vMainAlpha;
            vLabel.FontName = vVisualSettings.TextFont;
            vLabel.FontSize = vVisualSettings.TextSize;
            vLabel.Color    = vVisualSettings.TextColor;
            vLabel.Label    = vItemState.Item.Label;
        }
Esempio n. 2
0
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Update()
        {
            vMainAlpha = vPanelState.DisplayStrength * vLayoutState.DisplayStrength;

            if (!vItemState.Item.IsEnabled || !vItemState.Item.IsAncestryEnabled)
            {
                vMainAlpha *= 0.333f;
            }

            ISelectableItem selItem     = (vItemState.Item as ISelectableItem);
            float           high        = vItemState.MaxHighlightProgress;
            bool            showEdge    = DisplayUtil.IsEdgeVisible(vItemState);
            float           edge        = (showEdge ? high : 0);
            float           select      = 1 - (float)Math.Pow(1 - vItemState.SelectionProgress, 1.5f);
            float           selectAlpha = select;

            if (selItem != null && selItem.IsStickySelected)
            {
                selectAlpha = 1;
            }

            Color colBg   = vSettings.BackgroundColor;
            Color colEdge = vSettings.EdgeColor;
            Color colHigh = vSettings.HighlightColor;
            Color colSel  = vSettings.SelectionColor;

            colBg.a   *= vMainAlpha;
            colEdge.a *= edge * vMainAlpha;
            colHigh.a *= high * vMainAlpha;
            colSel.a  *= selectAlpha * vMainAlpha;

            vHoverRect.UpdateBackground(colBg);
            vHoverRect.UpdateEdge(colEdge);
            vHoverRect.UpdateHighlight(colHigh, high);
            vHoverRect.UpdateSelect(colSel, select);

            vLabel.Alpha    = vMainAlpha;
            vLabel.FontName = vSettings.TextFont;
            vLabel.FontSize = vSettings.TextSize;
            vLabel.Color    = vSettings.TextColor;
            vLabel.Label    = vItemState.Item.Label;
        }
Esempio n. 3
0
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Update()
        {
            vMainAlpha = vPanelState.DisplayStrength * vLayoutState.DisplayStrength;

            if (!vSliderItem.IsEnabled || !vSliderItem.IsAncestryEnabled)
            {
                vMainAlpha *= 0.333f;
            }

            const int easePower = 3;
            int       snaps     = vSliderItem.Snaps;
            float     easedVal  = DisplayUtil.GetEasedValue(
                snaps, vSliderItem.Value, vSliderItem.SnappedValue, easePower);
            float easedHover = easedVal;
            float hoverW     = 0;

            if (vSliderItem.HoverValue != null)
            {
                easedHover = DisplayUtil.GetEasedValue(snaps, (float)vSliderItem.HoverValue,
                                                       (float)vSliderItem.HoverSnappedValue, easePower);
            }

            Color colTrack = vSettings.SliderTrackColor;
            Color colFill  = vSettings.SliderFillColor;
            Color colTick  = vSettings.SliderTickColor;

            colTrack.a *= vMainAlpha;
            colFill.a  *= vMainAlpha;
            colTick.a  *= vMainAlpha;

            vTrack.SetColors(colTrack, colFill);

            if (vTickMeshBuilder != null)
            {
                vTickMeshBuilder.CommitColors(colTick);
            }

            ////

            vGrabHold.transform.localPosition = new Vector3(vSlideX0 + vSlideW * easedVal, 0, 0);

            if (vSliderItem.HoverValue != null)
            {
                vHoverHold.transform.localPosition = new Vector3(vSlideX0 + vSlideW * easedHover, 0, 0);

                float high   = vItemState.MaxHighlightProgress;
                float select = 1 - (float)Math.Pow(1 - vItemState.SelectionProgress, 1.5f);

                Color colBg   = vSettings.BackgroundColor;
                Color colHigh = vSettings.HighlightColor;
                Color colSel  = vSettings.SelectionColor;

                colBg.a   *= high * vMainAlpha;
                colHigh.a *= high * vMainAlpha;
                colSel.a  *= select * vMainAlpha;

                vHover.UpdateBackground(colBg);
                vHover.UpdateHighlight(colHigh, high);
                vHover.UpdateSelect(colSel, select);

                hoverW = vGrabW * high * HoverBarRelW;
            }

            UpdateMeshes(easedVal, easedHover, hoverW);
        }