예제 #1
0
        public void HighlightSection(ProgressBarMarker marker)
        {
            if (marker == null)
            {
                return;
            }

            float left = 0f, right = 0f;

            if (duration > 0)
            {
                left  = marker.stroke.startTime / duration * rectTransform.rect.width;
                right = (duration - marker.stroke.endTime) / duration * rectTransform.rect.width;
            }

            var markerTransform = (RectTransform)marker.transform;

            markerTransform.offsetMin = new Vector2(left, markerTransform.offsetMin.y);
            markerTransform.offsetMax = new Vector2(-right, markerTransform.offsetMax.y);

            if (markerTransform.rect.width < 200)
            {
                marker.ActivateLiteMode(true);
            }
        }
예제 #2
0
        private ProgressBarMarker InitMarker(ProgressBarMarker marker, Stroke stroke, bool showTimeLabel)
        {
            if (stroke == null)
            {
                Debug.Log("Stroke is null");
                return(null);
            }

            marker.Init(this, stroke, showTimeLabel);
            marker.Select(showTimeLabel);
            marker.OnMarkerAutoRefreshed += MarkerRefreshed;
            return(marker);
        }
예제 #3
0
        /// <summary>
        ///     Changes the marked line to the new selected <paramref name="newStroke" />.
        ///     It will hide and destroy the <paramref name="old" />.
        /// </summary>
        /// <param name="old">Previous selected stroke</param>
        /// <param name="newStroke">New selected Stroke</param>
        private void StrokeChanged(Stroke old, Stroke newStroke)
        {
            if (!IsPlaying() && currentStrokeMarker != null)
            {
                currentStrokeMarker.HideTimeLabels();
            }
            if (newStroke == null)
            {
                return;
            }

            currentStrokeMarker = newStroke.myMarker;
            if (currentStrokeMarker != null)
            {
                currentStrokeMarker.ShowTimeLabels();
            }
        }
예제 #4
0
        public void ReDrawAllMarkers()
        {
            ProgressBarMarker selectedMarker = null;

            foreach (var stroke in paintMode.pattern.strokes)
            {
                stroke.createMarkerIfNoneAvailable(this);
                if (stroke == paintMode.currentStroke)
                {
                    selectedMarker = stroke.myMarker;
                    continue;
                }

                HighlightSection(stroke.myMarker);
            }

            HighlightSection(selectedMarker);

            moveMarkerBar(startImage, endImage);
        }