Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private string GetLightPosLabel(IItemDataSlider pSliderData)
        {
            int    snapIndex = (int)Math.Round(pSliderData.SnappedValue * (pSliderData.Snaps - 1));
            string snapName  = "";

            switch (snapIndex)
            {
            case 0:
                snapName = "Lowest";
                break;

            case 1:
                snapName = "Low";
                break;

            case 2:
                snapName = "High";
                break;

            case 3:
                snapName = "Highest";
                break;

            default:
                snapName = "UNHANDLED";
                break;
            }

            return(pSliderData.Label + ": " + snapName);
        }
        /*--------------------------------------------------------------------------------------------*/
        private void DrawHiddenItems()
        {
            HoverItemDataSelectable selectableData = (vData as HoverItemDataSelectable);

            EditorGUILayout.IntField("Auto ID", vData.AutoId);

            if (selectableData == null)
            {
                return;
            }

            EditorGUILayout.Toggle("Is Sticky-Selected", selectableData.IsStickySelected);
            EditorGUILayout.Toggle("Ignore Selection", selectableData.IgnoreSelection);

            IItemDataRadio  radioData  = (vData as IItemDataRadio);
            IItemDataSlider sliderData = (vData as IItemDataSlider);

            if (radioData != null)
            {
                EditorGUILayout.TextField("Radio Default Group ID", radioData.DefaultGroupId);
            }

            if (sliderData != null)
            {
                EditorGUILayout.TextField("Slider Formatted Label",
                                          sliderData.GetFormattedLabel(sliderData));
                EditorGUILayout.Slider("Slider Value", sliderData.Value, 0, 1);
                EditorGUILayout.Slider("Slider Snapped Value", sliderData.SnappedValue, 0, 1);
                EditorGUILayout.Slider("Slider Snapped Range Value", sliderData.SnappedRangeValue,
                                       sliderData.RangeMin, sliderData.RangeMax);
                EditorGUILayout.TextField("Slider Hover Value", sliderData.HoverValue + "");
                EditorGUILayout.TextField("Slider Snapped Hover Value", sliderData.SnappedHoverValue + "");
            }
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateSliderSettings(HoverItem pHoverItem)
        {
            IItemDataSlider data = (IItemDataSlider)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;
        }