//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public virtual void UpdateSegments(DisplayUtil.TrackSegment[] pSegments, DisplayUtil.TrackSegment[] pCuts, float pHeight) { DisplayUtil.TrackSegment[] slices = DisplayUtil.SplitTrackSegments(pSegments, pCuts); foreach ( UiHoverMeshRectBg bg in vAllBgs ) { bg.Show(false); } int trackI = 0; int fillI = 0; foreach ( DisplayUtil.TrackSegment slice in slices ) { UiHoverMeshRectBg bg; if ( slice.IsFill ) { bg = vFills[fillI++]; } else { bg = vTracks[trackI++]; } float width = slice.EndValue-slice.StartValue; float zeroShiftW = 0; float zeroShiftX = 0; if ( slice.IsZeroAtStart == true ) { zeroShiftW = UiHoverMeshRect.SizeInset*2; zeroShiftX = -zeroShiftW; } else if ( slice.IsZeroAtStart == false ) { zeroShiftW = UiHoverMeshRect.SizeInset*2; } width += zeroShiftW; bg.Show(true); bg.UpdateSize(width, pHeight); bg.Background.transform.localPosition = Vector3.right*(slice.StartValue+width/2+zeroShiftX); } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public virtual void UpdateSegments(DisplayUtil.TrackSegment[] pSegments, DisplayUtil.TrackSegment[] pCuts, float pRadiusInner, float pRadiusOuter) { DisplayUtil.TrackSegment[] slices = DisplayUtil.SplitTrackSegments(pSegments, pCuts); foreach ( UiHoverMeshSlice bg in vAllBgs ) { bg.Show(false); } int trackI = 0; int fillI = 0; foreach ( DisplayUtil.TrackSegment slice in slices ) { UiHoverMeshSlice bg; if ( slice.IsFill ) { bg = vFills[fillI++]; } else { bg = vTracks[trackI++]; } float angle0 = slice.StartValue; float angle1 = slice.EndValue; if ( slice.IsZeroAtStart == true ) { angle0 -= UiHoverMeshSlice.AngleInset*2; } else if ( slice.IsZeroAtStart == false ) { angle1 += UiHoverMeshSlice.AngleInset*2; } bg.Show(true); bg.UpdateSize(pRadiusInner, pRadiusOuter, angle0, angle1); } }