//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ protected override void UpdateButtonSettings(HoverItem pHoverItem) { base.UpdateButtonSettings(pHoverItem); ButtonRectRenderer.SizeX = SizeX; ButtonRectRenderer.SizeY = SizeY; }
/*--------------------------------------------------------------------------------------------*/ private void TryRebuildWithItemType(HoverItem.HoverItemType pType) { if ( pType == HoverItem.HoverItemType.Slider ) { Controllers.Set(ButtonRendererName, this); Controllers.Unset(SliderRendererName, this); RendererUtil.DestroyRenderer(ButtonRenderer); ButtonRenderer = null; SliderRenderer = (SliderRenderer ?? FindOrBuildSlider()); IsButtonRendererType = false; } else { Controllers.Set(SliderRendererName, this); Controllers.Unset(ButtonRendererName, this); RendererUtil.DestroyRenderer(SliderRenderer); SliderRenderer = null; ButtonRenderer = (ButtonRenderer ?? FindOrBuildButton()); IsButtonRendererType = true; } }
/*--------------------------------------------------------------------------------------------*/ protected virtual void UpdateSliderSettings( HoverItem pHoverItem, HoverItemHighlightState pHighState) { HoverItemDataSlider data = (HoverItemDataSlider)pHoverItem.Data; HoverItemHighlightState.Highlight? high = pHighState.NearestHighlight; float highProg = pHighState.MaxHighlightProgress; bool isNearest = pHighState.IsNearestAcrossAllItemsForAnyCursor; SliderRenderer.HighlightProgress = highProg; SliderRenderer.ShowEdge = isNearest; if ( high == null || highProg <= 0 || !isNearest ) { data.HoverValue = null; SliderRenderer.JumpValue = -1; return; } float value = SliderRenderer.GetValueViaNearestWorldPosition(high.Value.NearestWorldPos); data.HoverValue = value; float snapValue = (float)data.SnappedHoverValue; //float easePower = (1-high.Value.Progress)*5+1; //gets "snappier" as you pull away float showValue = DisplayUtil.GetEasedValue(data.Snaps, value, snapValue, 3); SliderRenderer.JumpValue = showValue; if ( data.IsStickySelected ) { data.Value = value; SliderRenderer.HandleValue = showValue; } }
/*--------------------------------------------------------------------------------------------*/ protected virtual void UpdateSliderSettings(HoverItem pHoverItem) { ISliderItem data = (ISliderItem)pHoverItem.Data; SliderRenderer.IsEnabled = data.IsEnabled; SliderRenderer.LabelText = data.GetFormattedLabel(data); SliderRenderer.HandleValue = data.SnappedValue; SliderRenderer.FillStartingPoint = data.FillStartingPoint; SliderRenderer.ZeroValue = Mathf.InverseLerp(data.RangeMin, data.RangeMax, 0); SliderRenderer.AllowJump = data.AllowJump; SliderRenderer.TickCount = data.Ticks; SliderRenderer.SortingLayer = SortingLayer; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ protected virtual void UpdateButtonSettings(HoverItem pHoverItem) { HoverItemData data = pHoverItem.Data; ICheckboxItem checkboxData = (data as ICheckboxItem); IRadioItem radioData = (data as IRadioItem); IParentItem parentData = (data as IParentItem); IStickyItem stickyData = (data as IStickyItem); ButtonRenderer.IsEnabled = data.IsEnabled; ButtonRenderer.SortingLayer = SortingLayer; ButtonRenderer.LabelText = data.Label; if ( checkboxData != null ) { ButtonRenderer.IconOuterType = HoverIcon.IconOffset.CheckOuter; ButtonRenderer.IconInnerType = (checkboxData.Value ? HoverIcon.IconOffset.CheckInner : HoverIcon.IconOffset.None); } else if ( radioData != null ) { ButtonRenderer.IconOuterType = HoverIcon.IconOffset.RadioOuter; ButtonRenderer.IconInnerType = (radioData.Value ? HoverIcon.IconOffset.RadioInner : HoverIcon.IconOffset.None); } else if ( parentData != null ) { ButtonRenderer.IconOuterType = HoverIcon.IconOffset.Parent; ButtonRenderer.IconInnerType = HoverIcon.IconOffset.None; } else if ( stickyData != null ) { ButtonRenderer.IconOuterType = HoverIcon.IconOffset.Sticky; ButtonRenderer.IconInnerType = HoverIcon.IconOffset.None; } else { ButtonRenderer.IconOuterType = HoverIcon.IconOffset.None; ButtonRenderer.IconInnerType = HoverIcon.IconOffset.None; } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void UpdateSliderSettings(HoverItem pHoverItem) { ISliderItemData data = (ISliderItemData)pHoverItem.Data; SliderRenderer.Controllers.Set(HoverRendererSlider.HandleValueName, this); SliderRenderer.Controllers.Set(HoverRendererSlider.FillStartingPointName, this); SliderRenderer.Controllers.Set(HoverRendererSlider.ZeroValueName, this); SliderRenderer.Controllers.Set(HoverRendererSlider.AllowJumpName, this); SliderRenderer.Controllers.Set(HoverRendererSlider.TickCountName, this); SliderRenderer.HandleValue = data.SnappedValue; SliderRenderer.FillStartingPoint = data.FillStartingPoint; SliderRenderer.ZeroValue = Mathf.InverseLerp(data.RangeMin, data.RangeMax, 0); SliderRenderer.AllowJump = data.AllowJump; SliderRenderer.TickCount = data.Ticks; }
/*--------------------------------------------------------------------------------------------*/ private void UpdateRendererCanvas(HoverRenderer pRenderer, HoverItem pHoverItem) { HoverCanvasDataUpdater canvasUp = pRenderer.GetCanvasDataUpdater(); if ( canvasUp == null ) { return; } HoverItemData data = pHoverItem.Data; ICheckboxItemData checkboxData = (data as ICheckboxItemData); IRadioItemData radioData = (data as IRadioItemData); ISelectorItemData selectorData = (data as ISelectorItemData); IStickyItemData stickyData = (data as IStickyItemData); ISliderItemData sliderData = (data as ISliderItemData); 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; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void UpdateRenderer(HoverRenderer pRenderer, HoverItem pHoverItem) { pRenderer.Controllers.Set(HoverRenderer.IsEnabledName, this); pRenderer.IsEnabled = pHoverItem.Data.IsEnabled; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ protected override void UpdateButtonSettings(HoverItem pHoverItem) { base.UpdateButtonSettings(pHoverItem); ButtonArcRenderer.OuterRadius = OuterRadius; ButtonArcRenderer.InnerRadius = InnerRadius; ButtonArcRenderer.ArcAngle = ArcAngle; }
/*--------------------------------------------------------------------------------------------*/ protected override void UpdateSliderSettings(HoverItem pHoverItem) { base.UpdateSliderSettings(pHoverItem); SliderRectRenderer.SizeX = SizeX; SliderRectRenderer.SizeY = SizeY; }