예제 #1
0
파일: CopyOutput.cs 프로젝트: bodhid/Vplus
 void Update()
 {
     //Debug.Log(decoder.getDecoderState());
     if ((int)decoder.getDecoderState() < 2)
     {
         Notification.instance.Show("Press H for Help");
     }
     ReScale();
     if ((int)decoder.getDecoderState() == 3 && FrameInterpolation.enableMotionInterpolation)
     {
         FrameInterpolation.instance.source = decoder.output;
         target.texture = FrameInterpolation.instance.output;
     }
     else
     {
         target.texture = decoder.output;
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        Vector3 posGoto = (HideTimer < 0) ? new Vector3(0, -64, 0) : Vector3.zero;

        Cursor.visible       = (HideTimer > 0 || ((int)decoder.getDecoderState() < 2));
        t.anchoredPosition3D = Vector3.Lerp(t.anchoredPosition3D, posGoto, Time.deltaTime * 8f);
        Vector3 newMouse = Input.mousePosition;

        if (Input.GetAxis("Mouse X") != 0 && Input.GetAxis("Mouse Y") != 0 || newMouse.y < seekTop.position.y)
        {
            if (newMouse.x > 0 && newMouse.y > 0 && newMouse.x < Screen.width && newMouse.y < Screen.height)
            {
                if ((int)decoder.getDecoderState() > 1)
                {
                    HideTimer = 3f;
                }
            }
        }
        if (HideTimer > 0)
        {
            totalTime.UpdateTimer();             // only update when visible since it generates garbage
        }
        HideTimer -= Time.deltaTime;
    }
예제 #3
0
    private void Update()
    {
        Vector2 size = ((RectTransform)transform).sizeDelta;

        size.y = ((RectTransform)videoOutput.transform).sizeDelta.y / 4f;
        ((RectTransform)transform).sizeDelta = size;
        if ((int)decoder.getDecoderState() < 2)
        {
            return;
        }
        int    currentTimeInMS = (int)(decoder.getVideoCurrentTime() * 1000);
        int    block           = GetCurrentBlock(currentTimeInMS);
        string text            = "";

        if (block != -1)
        {
            text = subs[block].text;
        }
        for (int i = 0; i < textObjects.Length; ++i)
        {
            textObjects[i].text     = text;
            textObjects[i].fontSize = (int)(size.y * 0.3f);
        }
    }
예제 #4
0
    void Update()
    {
        float  videoTime       = 0;
        string currentTimeText = "";

        if ((int)decoder.getDecoderState() > 1)
        {
            videoTime = decoder.getVideoCurrentTime() / decoder.audioTotalTime;
            if (float.IsInfinity(videoTime))
            {
                videoTime = 0;
            }
            fill.localScale           = new Vector3(videoTime, 1f, 1f);
            handle.anchoredPosition3D = new Vector3(videoTime * canvas.sizeDelta.x, 32, 0);
        }
        else
        {
            Cursor.visible = true;
            time.SetActive(false);
            return;
        }
        Vector3 mousePos = Input.mousePosition;
        bool    onSlider = false;

        onSlider = (mousePos.y > sliderBottom.position.y && mousePos.y < sliderTop.position.y);
        if (mousePos.x < 0 || mousePos.x > Screen.width || mousePos.y < 0)
        {
            onSlider = false;
        }
        time.SetActive(onSlider);
        if (onSlider)
        {
            Vector3 temp = ((RectTransform)time.transform).position;
            temp.x = mousePos.x;
            if (temp.x < (((RectTransform)time.transform).sizeDelta.x * 0.5f))
            {
                temp.x = (((RectTransform)time.transform).sizeDelta.x * 0.5f);
            }
            if (temp.x > Screen.width - (((RectTransform)time.transform).sizeDelta.x * 0.5f))
            {
                temp.x = Screen.width - (((RectTransform)time.transform).sizeDelta.x * 0.5f);
            }
            ((RectTransform)time.transform).position = temp;
            int hoverTime = Mathf.RoundToInt(decoder.audioTotalTime * ((mousePos.x * 1f) / Screen.width));
            if (Input.GetKey(KeyCode.Mouse0))
            {
                if (hoverTime != lastSeekTime)
                {
                    decoder.setSeekTime(hoverTime);
                }
                lastSeekTime = hoverTime;
            }
            if (Input.GetKeyUp(KeyCode.Mouse0))
            {
                lastSeekTime = -1;
            }
            System.TimeSpan timespan = new System.TimeSpan(0, 0, 0, hoverTime, 0);
            if (decoder.audioTotalTime > 3600)
            {
                currentTimeText += timespan.Hours.ToString("D2") + ":";
            }
            if (decoder.audioTotalTime > 60)
            {
                currentTimeText += timespan.Minutes.ToString("D2") + ":";
            }
            currentTimeText += timespan.Seconds.ToString("D2");
            timeText.text    = currentTimeText;
        }
    }