////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
                                  float pArcAngle, IItemVisualSettings pSettings)
        {
            vMenuState = pMenuState;
            vItemState = pItemState;
            vSettings  = (ItemVisualSettingsStandard)pSettings;

            ////

            vHoverSlice = new UiHoverMeshSlice(gameObject, true);
            vHoverSlice.UpdateSize(UiItemSelectRenderer.InnerRadius,
                                   UiItemSelectRenderer.OuterRadius, pArcAngle);

            ////

            var labelObj = new GameObject("Label");

            labelObj.transform.SetParent(gameObject.transform, false);
            labelObj.transform.localPosition = new Vector3(0, 0, 1);
            labelObj.transform.localRotation = Quaternion.FromToRotation(Vector3.back, Vector3.right);
            labelObj.transform.localScale    = new Vector3((vMenuState.IsOnLeftSide ? 1 : -1), 1, 1);

            vLabel           = labelObj.AddComponent <UiLabel>();
            vLabel.AlignLeft = vMenuState.IsOnLeftSide;
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
                                  float pArcAngle, IItemVisualSettings pSettings)
        {
            vMenuState = pMenuState;
            vItemState = pItemState;
            vSelItem   = (vItemState.Item as ISelectableItem);
            vSettings  = (ItemVisualSettingsStandard)pSettings;

            ////

            vHoverSlice = new UiHoverMeshSlice(gameObject);
            vHoverSlice.DrawOuterEdge = true;
            vHoverSlice.UpdateSize(InnerRadius, OuterRadius, pArcAngle);

            ////

            vIcon = new GameObject("Icon");
            vIcon.transform.SetParent(gameObject.transform, false);
            vIcon.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, Vector3.up) *
                                            Quaternion.FromToRotation(Vector3.right, Vector3.up);
            vIcon.AddComponent <MeshRenderer>();

            MeshFilter iconFilt = vIcon.AddComponent <MeshFilter>();

            vIconMeshBuilder = new MeshBuilder();
            MeshUtil.BuildQuadMesh(vIconMeshBuilder);
            Materials.SetMeshIconCoords(vIconMeshBuilder, Materials.IconOffset.Parent);
            vIconMeshBuilder.Commit();
            vIconMeshBuilder.CommitColors(Color.clear);
            iconFilt.sharedMesh = vIconMeshBuilder.Mesh;
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
													float pArcAngle, IItemVisualSettings pSettings) {
			vMenuState = pMenuState;
			vItemState = pItemState;
			vSelItem = (vItemState.Item as ISelectableItem);
			vSettings = (ItemVisualSettingsStandard)pSettings;

			////

			vHoverSlice = new UiHoverMeshSlice(gameObject);
			vHoverSlice.DrawOuterEdge = true;
			vHoverSlice.UpdateSize(InnerRadius, OuterRadius, pArcAngle);

			////
			
			vIcon = new GameObject("Icon");
			vIcon.transform.SetParent(gameObject.transform, false);
			vIcon.transform.localRotation = Quaternion.FromToRotation(Vector3.forward, Vector3.up)*
				Quaternion.FromToRotation(Vector3.right, Vector3.up);
			vIcon.AddComponent<MeshRenderer>();

			MeshFilter iconFilt = vIcon.AddComponent<MeshFilter>();
			vIconMeshBuilder = new MeshBuilder();
			MeshUtil.BuildQuadMesh(vIconMeshBuilder);
			Materials.SetMeshIconCoords(vIconMeshBuilder, Materials.IconOffset.Parent);
			vIconMeshBuilder.Commit();
			vIconMeshBuilder.CommitColors(Color.clear);
			iconFilt.sharedMesh = vIconMeshBuilder.Mesh;
		}
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public UiItemSliderTrackRenderer(GameObject pParent) {
			vTracks = new UiHoverMeshSlice[4];
			vFills = new UiHoverMeshSlice[2];

			for ( int i = 0 ; i < vTracks.Length ; i++ ) {
				vTracks[i] = new UiHoverMeshSlice(pParent, true, "Track"+i);
			}

			for ( int i = 0 ; i < vFills.Length ; i++ ) {
				vFills[i] = new UiHoverMeshSlice(pParent, true, "Fill"+i);
			}

			vAllBgs = vTracks.Concat(vFills).ToArray();
			vSlices = new List<DisplayUtil.TrackSegment>();
		}
Exemplo n.º 5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public UiItemSliderTrackRenderer(GameObject pParent)
        {
            vTracks = new UiHoverMeshSlice[4];
            vFills  = new UiHoverMeshSlice[2];

            for (int i = 0; i < vTracks.Length; i++)
            {
                vTracks[i] = new UiHoverMeshSlice(pParent, true, "Track" + i);
            }

            for (int i = 0; i < vFills.Length; i++)
            {
                vFills[i] = new UiHoverMeshSlice(pParent, true, "Fill" + i);
            }

            vAllBgs = vTracks.Concat(vFills).ToArray();
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
													float pArcAngle, IItemVisualSettings pSettings) {
			vMenuState = pMenuState;
			vItemState = pItemState;
			vSettings = (ItemVisualSettingsStandard)pSettings;

			////

			vHoverSlice = new UiHoverMeshSlice(gameObject);
			vHoverSlice.UpdateSize(InnerRadius, OuterRadius, pArcAngle);

			////

			var labelObj = new GameObject("Label");
			labelObj.transform.SetParent(gameObject.transform, false);
			labelObj.transform.localPosition = new Vector3(0, 0, 1);
			labelObj.transform.localRotation = Quaternion.FromToRotation(Vector3.back, Vector3.right);
			labelObj.transform.localScale = new Vector3((vMenuState.IsOnLeftSide ? 1 : -1), 1, 1);
			
			vLabel = labelObj.AddComponent<UiLabel>();
			vLabel.AlignLeft = vMenuState.IsOnLeftSide;
		}
Exemplo n.º 7
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
                                  float pArcAngle, IItemVisualSettings pSettings)
        {
            vMenuState  = pMenuState;
            vItemState  = pItemState;
            vAngle0     = -pArcAngle / 2f;
            vAngle1     = pArcAngle / 2f;
            vSettings   = (ItemVisualSettingsStandard)pSettings;
            vSliderItem = (ISliderItem)vItemState.Item;
            vTicks      = new GameObject[vSliderItem.Ticks];

            const float pi = (float)Math.PI;

            vGrabArc      = pi / 40f;
            vSlideDegree0 = (vAngle0 + vGrabArc / 2) / pi * 180;
            vSlideDegrees = (vAngle1 - vAngle0 - vGrabArc) / pi * 180;
            vZeroValue    = (0 - vSliderItem.RangeMin) / (vSliderItem.RangeMax - vSliderItem.RangeMin);

            ////

            vHiddenSlice = new UiHoverMeshSlice(gameObject, true);
            vHiddenSlice.UpdateSize(1, 1.5f, pArcAngle);
            vHiddenSlice.UpdateBackground(Color.clear);

            var trackObj = new GameObject("Track");

            trackObj.transform.SetParent(gameObject.transform, false);
            trackObj.transform.localRotation = Quaternion.AngleAxis(vAngle0 / pi * 180, Vector3.up);

            vTrack         = new UiItemSliderTrackRenderer(trackObj);
            vTrackSegments = new ReadList <DisplayUtil.TrackSegment>();
            vTrackCuts     = new ReadList <DisplayUtil.TrackSegment>();

            ////

            if (vSliderItem.Ticks > 1)
            {
                Vector3 quadScale   = new Vector3(UiHoverMeshSlice.AngleInset * 2, 0.36f, 0.1f);
                float   percPerTick = 1 / (float)(vSliderItem.Ticks - 1);

                vTickMeshBuilder = new MeshBuilder();
                MeshUtil.BuildQuadMesh(vTickMeshBuilder);
                vTickMeshBuilder.Commit();
                vTickMeshBuilder.CommitColors(Color.clear);

                for (int i = 0; i < vSliderItem.Ticks; ++i)
                {
                    var tickObj = new GameObject("Tick" + i);
                    tickObj.transform.SetParent(gameObject.transform, false);
                    tickObj.transform.localRotation = Quaternion.AngleAxis(
                        vSlideDegree0 + vSlideDegrees * i * percPerTick, Vector3.up);
                    vTicks[i] = tickObj;

                    var quadObj = new GameObject("Quad");
                    quadObj.transform.SetParent(tickObj.transform, false);
                    quadObj.transform.localPosition = new Vector3(0, 0, 1.25f);
                    quadObj.transform.localRotation = TickQuatRot;
                    quadObj.transform.localScale    = quadScale;
                    quadObj.AddComponent <MeshRenderer>();

                    MeshFilter quadFilt = quadObj.AddComponent <MeshFilter>();
                    quadFilt.sharedMesh = vTickMeshBuilder.Mesh;
                }
            }

            ////

            vGrabHold = new GameObject("GrabHold");
            vGrabHold.transform.SetParent(gameObject.transform, false);

            var grabObj = new GameObject("Grab");

            grabObj.transform.SetParent(vGrabHold.transform, false);

            vGrab = grabObj.AddComponent <UiItemSliderGrabRenderer>();
            vGrab.Build(vMenuState, vItemState, vGrabArc, pSettings);

            ////

            vHoverHold = new GameObject("HoverHold");
            vHoverHold.transform.SetParent(gameObject.transform, false);

            var hoverObj = new GameObject("Hover");

            hoverObj.transform.SetParent(vHoverHold.transform, false);

            vHover = new UiHoverMeshSlice(hoverObj, false, "Hover");
        }
Exemplo n.º 8
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public virtual void Build(MenuState pMenuState, IBaseItemState pItemState,
                                  float pArcAngle, IItemVisualSettings pSettings)
        {
            vMenuState  = pMenuState;
            vItemState  = pItemState;
            vAngle0     = -pArcAngle / 2f + UiHoverMeshSlice.AngleInset;
            vAngle1     = pArcAngle / 2f - UiHoverMeshSlice.AngleInset;
            vSettings   = (ItemVisualSettingsStandard)pSettings;
            vSliderItem = (ISliderItem)vItemState.Item;

            const float pi = (float)Math.PI;

            vGrabArcHalf  = pi / 80f;
            vSlideDegree0 = (vAngle0 + vGrabArcHalf) / pi * 180;
            vSlideDegrees = (vAngle1 - vAngle0 - vGrabArcHalf * 2) / pi * 180;

            ////

            vHiddenSlice = new UiHoverMeshSlice(gameObject, true);
            vHiddenSlice.Resize(1, 1.5f, pArcAngle);
            vHiddenSlice.UpdateBackground(Color.clear);

            vTrackA = new UiHoverMeshSlice(gameObject, true, "TrackA");
            vTrackB = new UiHoverMeshSlice(gameObject, true, "TrackB");
            vFillA  = new UiHoverMeshSlice(gameObject, true, "FillA");
            vFillB  = new UiHoverMeshSlice(gameObject, true, "FillB");

            ////

            vTickMat              = new Material(Shader.Find("Unlit/AlphaSelfIllum"));
            vTickMat.renderQueue -= 400;
            vTickMat.color        = Color.clear;

            if (vSliderItem.Ticks > 1)
            {
                Vector3 quadScale   = new Vector3(UiHoverMeshSlice.AngleInset * 2, 0.36f, 0.1f);
                float   percPerTick = 1 / (float)(vSliderItem.Ticks - 1);

                vTicks = new GameObject[vSliderItem.Ticks];

                for (int i = 0; i < vSliderItem.Ticks; ++i)
                {
                    var tick = new GameObject("Tick" + i);
                    tick.transform.SetParent(gameObject.transform, false);
                    tick.transform.localRotation = Quaternion.AngleAxis(
                        vSlideDegree0 + vSlideDegrees * i * percPerTick, Vector3.up);
                    vTicks[i] = tick;

                    var quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
                    quad.renderer.sharedMaterial = vTickMat;
                    quad.transform.SetParent(tick.transform, false);
                    quad.transform.localPosition = new Vector3(0, 0, 1.25f);
                    quad.transform.localRotation =
                        Quaternion.FromToRotation(Vector3.back, Vector3.down);
                    quad.transform.localScale = quadScale;
                }
            }

            ////

            vGrabHold = new GameObject("GrabHold");
            vGrabHold.transform.SetParent(gameObject.transform, false);

            var grabObj = new GameObject("Grab");

            grabObj.transform.SetParent(vGrabHold.transform, false);

            vGrab = grabObj.AddComponent <UiItemSliderGrabRenderer>();
            vGrab.Build(vMenuState, vItemState, vGrabArcHalf * 2, pSettings);

            ////

            vHoverHold = new GameObject("HoverHold");
            vHoverHold.transform.SetParent(gameObject.transform, false);

            var hoverObj = new GameObject("Hover");

            hoverObj.transform.SetParent(vHoverHold.transform, false);

            vHover = new UiHoverMeshSlice(hoverObj, false, "Hover");
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public virtual void Build(IHovercastMenuState pMenuState, IBaseItemState pItemState,
													float pArcAngle, IItemVisualSettings pSettings) {
			vMenuState = pMenuState;
			vItemState = pItemState;
			vAngle0 = -pArcAngle/2f;
			vAngle1 = pArcAngle/2f;
			vSettings = (ItemVisualSettingsStandard)pSettings;
			vSliderItem = (ISliderItem)vItemState.Item;
			vTicks = new GameObject[vSliderItem.Ticks];

			const float pi = (float)Math.PI;

			vGrabArc = pi/40f;
			vSlideDegree0 = (vAngle0+vGrabArc/2)/pi*180;
			vSlideDegrees = (vAngle1-vAngle0-vGrabArc)/pi*180;
			vZeroValue = (0-vSliderItem.RangeMin)/(vSliderItem.RangeMax-vSliderItem.RangeMin);

			////

			vHiddenSlice = new UiHoverMeshSlice(gameObject, true);
			vHiddenSlice.UpdateSize(1, 1.5f, pArcAngle);
			vHiddenSlice.UpdateBackground(Color.clear);

			var trackObj = new GameObject("Track");
			trackObj.transform.SetParent(gameObject.transform, false);
			trackObj.transform.localRotation = Quaternion.AngleAxis(vAngle0/pi*180, Vector3.up);

			vTrack = new UiItemSliderTrackRenderer(trackObj);
			vTrackSegments = new ReadList<DisplayUtil.TrackSegment>();
			vTrackCuts = new ReadList<DisplayUtil.TrackSegment>();

			////

			if ( vSliderItem.Ticks > 1 ) {
				Vector3 quadScale = new Vector3(UiHoverMeshSlice.AngleInset*2, 0.36f, 0.1f);
				float percPerTick = 1/(float)(vSliderItem.Ticks-1);

				vTickMeshBuilder = new MeshBuilder();
				MeshUtil.BuildQuadMesh(vTickMeshBuilder);
				vTickMeshBuilder.Commit();
				vTickMeshBuilder.CommitColors(Color.clear);

				for ( int i = 0 ; i < vSliderItem.Ticks ; ++i ) {
					var tickObj = new GameObject("Tick"+i);
					tickObj.transform.SetParent(gameObject.transform, false);
					tickObj.transform.localRotation = Quaternion.AngleAxis(
						vSlideDegree0+vSlideDegrees*i*percPerTick, Vector3.up);
					vTicks[i] = tickObj;

					var quadObj = new GameObject("Quad");
					quadObj.transform.SetParent(tickObj.transform, false);
					quadObj.transform.localPosition = new Vector3(0, 0, 1.25f);
					quadObj.transform.localRotation = TickQuatRot;
					quadObj.transform.localScale = quadScale;
					quadObj.AddComponent<MeshRenderer>();

					MeshFilter quadFilt = quadObj.AddComponent<MeshFilter>();
					quadFilt.sharedMesh = vTickMeshBuilder.Mesh;
				}
			}

			////

			vGrabHold = new GameObject("GrabHold");
			vGrabHold.transform.SetParent(gameObject.transform, false);

			var grabObj = new GameObject("Grab");
			grabObj.transform.SetParent(vGrabHold.transform, false);

			vGrab = grabObj.AddComponent<UiItemSliderGrabRenderer>();
			vGrab.Build(vMenuState, vItemState, vGrabArc, pSettings);

			////

			vHoverHold = new GameObject("HoverHold");
			vHoverHold.transform.SetParent(gameObject.transform, false);

			var hoverObj = new GameObject("Hover");
			hoverObj.transform.SetParent(vHoverHold.transform, false);

			vHover = new UiHoverMeshSlice(hoverObj, false, "Hover");
		}