Exemplo n.º 1
0
    private void SetPosition()
    {
        RectTransform rt  = GetComponent <RectTransform>();
        var           pos = ClipInfo.SecToPixel(Time);

        rt.anchorMin        = new Vector2(pos, 0.0f);
        rt.anchorMax        = new Vector2(pos, 1.0f);
        rt.anchoredPosition = new Vector2(0, 0);
        rt.offsetMin        = new Vector2(0, 0);
        rt.offsetMax        = new Vector2(30, 0);
        rt.localScale       = Vector3.one;
    }
Exemplo n.º 2
0
    public void SetCursorPosition()
    {
        //TextCurrentTime.text = string.Format("{0:000.00}", CursorPosition);

        var newTime = ClipInfo.SecToPixel(_cursorTime);

        _cursor.anchorMin        = new Vector2(newTime, 0);
        _cursor.anchorMax        = new Vector2(newTime, 1);
        _cursor.anchoredPosition = Vector2.zero;

        _videoManager.SetTime(_cursorTime);
        _audioManager.UpdatePlayTime(_cursorTime);
    }
    public void ChangeGridOffset(float offset)
    {
        float clipTimeSizeInMinutes = ClipInfo.ClipTimeSize / 60;

        _offset = offset;
        float width = BarsParent.GetComponent <RectTransform> ().rect.width;

        for (int i = 0; i < _gridLines.Count; i++)
        {
            float time = ClipInfo.ClipTimeSize / _gridLines.Count * i + offset;
            time = (float)Math.Round(time, 2);
            float pos = ClipInfo.SecToPixel(time);

            _gridLines[i].name = time.ToString("F2");
            SetPosition(_gridLines[i], pos);
        }
    }
    private void CreateGridObjects()
    {
        float clipTimeSizeInMinutes = ClipInfo.ClipTimeSize / 60;
        int   numberOfLines         = (int)clipTimeSizeInMinutes * _bpm;

        for (int i = 0; i <= numberOfLines; i++)
        {
            float time = ClipInfo.ClipTimeSize / numberOfLines * i + _offset;
            time = (float)Math.Round(time, 2);
            float pos = ClipInfo.SecToPixel(time);

            GameObject timeGridLine = CreateGridBarObject(time.ToString("F2"));

            RectTransform rectTransform = timeGridLine.GetComponent <RectTransform> ();

            SetPosition(rectTransform, pos);
            rectTransform.gameObject.SetActive(_showGridLines);
            _gridLines.Add(rectTransform);
        }
    }
Exemplo n.º 5
0
    private void Update()
    {
        //Update cursor in screen.
        if (_audioManager.IsPlaying())
        {
            float playTime = _audioManager.GetCurrentClipTime();

            if (_waveTimeRange.y < playTime || _waveTimeRange.x > playTime)
            {
                UpdateClipRenderTimes();
                StartCoroutine(BarToPosition(_audioManager.GetCurrentClipTime()));
            }

            float position = ClipInfo.SecToPixel(playTime);
            _cursor.anchorMin        = new Vector2(position, 0);
            _cursor.anchorMax        = new Vector2(position, 1);
            _cursor.anchoredPosition = Vector2.zero;

            _propertiesManager.UpdateClipTime(playTime.ToString("F2"));
        }

        Inputs();
    }