예제 #1
0
        /*--------------------------------------------------------------------------------------------*/
        public virtual void TreeUpdate()
        {
            HoverItem hoverItem = GetComponent <HoverItem>();

            DestroyRenderersIfNecessary();
            TryRebuildWithItemType(hoverItem.ItemType);

            ////

            HoverItemHighlightState highState      = GetComponent <HoverItemHighlightState>();
            HoverItemSelectionState selState       = GetComponent <HoverItemSelectionState>();
            HoverRenderer           activeRenderer = ((HoverRenderer)ButtonRenderer ?? SliderRenderer);

            UpdateRenderer(activeRenderer, hoverItem);
            UpdateRendererCanvas(activeRenderer, hoverItem);
            UpdateRendererIndicator(activeRenderer, highState, selState);

            if (ButtonRenderer != null)
            {
                UpdateButtonSettings(highState);
            }

            if (SliderRenderer != null)
            {
                UpdateSliderSettings(hoverItem);
                UpdateSliderSettings(hoverItem, highState);
            }

            Controllers.TryExpireControllers();
        }
예제 #2
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRendererCanvas(HoverRenderer pRenderer, HoverItem pHoverItem)
        {
            HoverCanvasDataUpdater canvasUp = pRenderer.GetCanvasDataUpdater();

            if (canvasUp == null)
            {
                return;
            }

            IItemData         data         = pHoverItem.Data;
            IItemDataCheckbox checkboxData = (data as IItemDataCheckbox);
            IItemDataRadio    radioData    = (data as IItemDataRadio);
            IItemDataSelector selectorData = (data as IItemDataSelector);
            IItemDataSticky   stickyData   = (data as IItemDataSticky);
            IItemDataSlider   sliderData   = (data as IItemDataSlider);
            var icon = HoverCanvasDataUpdater.IconPairType.Unspecified;

            if (checkboxData != null)
            {
                icon = (checkboxData.Value ?
                        HoverCanvasDataUpdater.IconPairType.CheckboxOn :
                        HoverCanvasDataUpdater.IconPairType.CheckboxOff);
            }
            else if (radioData != null)
            {
                icon = (radioData.Value ?
                        HoverCanvasDataUpdater.IconPairType.RadioOn :
                        HoverCanvasDataUpdater.IconPairType.RadioOff);
            }
            else if (selectorData != null)
            {
                if (selectorData.Action == SelectorActionType.NavigateIn)
                {
                    icon = HoverCanvasDataUpdater.IconPairType.NavigateIn;
                }
                else if (selectorData.Action == SelectorActionType.NavigateOut)
                {
                    icon = HoverCanvasDataUpdater.IconPairType.NavigateOut;
                }
            }
            else if (stickyData != null)
            {
                icon = HoverCanvasDataUpdater.IconPairType.Sticky;
            }
            else if (sliderData != null)
            {
                icon = HoverCanvasDataUpdater.IconPairType.Slider;
            }

            canvasUp.Controllers.Set(HoverCanvasDataUpdater.LabelTextName, this);
            canvasUp.Controllers.Set(HoverCanvasDataUpdater.IconTypeName, this);

            canvasUp.LabelText = (sliderData == null ? data.Label :
                                  sliderData.GetFormattedLabel(sliderData));
            canvasUp.IconType = icon;
        }
예제 #3
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateRendererIndicator(HoverRenderer pRenderer,
                                             HoverItemHighlightState pHighState, HoverItemSelectionState pSelState)
        {
            HoverIndicator rendInd = pRenderer.GetIndicator();

            rendInd.Controllers.Set(HoverIndicator.HighlightProgressName, this);
            rendInd.Controllers.Set(HoverIndicator.SelectionProgressName, this);

            rendInd.HighlightProgress = pHighState.MaxHighlightProgress;
            rendInd.SelectionProgress = pSelState.SelectionProgress;

            if (pSelState.WasSelectedThisFrame)
            {
                rendInd.LatestSelectionTime = DateTime.UtcNow;
            }
        }
예제 #4
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 private void UpdateRenderer(HoverRenderer pRenderer, HoverItem pHoverItem)
 {
     pRenderer.Controllers.Set(HoverRenderer.IsEnabledName, this);
     pRenderer.IsEnabled = pHoverItem.Data.IsEnabled;
 }