Пример #1
0
 protected override void Update()
 {
     base.Update();
     if (video != null && videoStarted && video.isPlaying && subtitles != null)
     {
         float audiosourceTime = this.audiosourceTime;
         if (currentLine != null)
         {
             if (!currentLine.ShouldShow(audiosourceTime))
             {
                 subtitleText.text = null;
             }
             currentLine = null;
         }
         if (currentLine == null)
         {
             currentLine = subtitles.GetLineToDisplay(audiosourceTime);
             if (currentLine != null && Options.audioSubtitles > 0)
             {
                 subtitleText.text = ScriptLocalization.Get("SUBTITLES/" + currentLine.key);
             }
         }
     }
     if (video != null && videoStarted && !video.isPlaying)
     {
         VideoLogButton item = selectedItem;
         selectedItem = null;
         SelectItem(item);
     }
 }
Пример #2
0
 internal void RemoveSubtitles()
 {
     if (currentLine != null || lockedVOAndSubtitles)
     {
         SubtitleManager.instance.ClearSubtitle();
     }
     currentLine          = null;
     lockedVOAndSubtitles = false;
 }
Пример #3
0
 internal void Show()
 {
     if (playingScreen != null || isVisible || inTransition)
     {
         pendingPlay = 1f;
         return;
     }
     pendingPlay     = -1f;
     isVisible       = true;
     playingScreen   = this;
     inTransition    = true;
     transitionSpeed = 0.8f;
     MusicManager.instance.Pause();
     onSound.PlayOneShot();
     lockedVOAndSubtitles = true;
     currentLine          = null;
     SubtitleManager.instance.ClearSubtitle();
 }
Пример #4
0
    private void Update()
    {
        if (pendingPlay > 0f)
        {
            float num = pendingPlay - Time.deltaTime;
            Show();
            pendingPlay = num;
        }
        if (!videoLoaded)
        {
            return;
        }
        if (endTimer > 0f)
        {
            endTimer -= Time.deltaTime;
            if (endTimer <= 0f)
            {
                StopMovie();
            }
        }
        if (movie != null && movieMaterialInstance == null)
        {
            if (movie.texture != null)
            {
                movieMaterialInstance = Object.Instantiate(HFFResources.instance.PCLinearMovieFixGame);
            }
            reinitMaterial = true;
        }
        if (reinitMaterial && movie != null && movieMaterialInstance != null)
        {
            reinitMaterial = false;
            if (movieMaterialInstance != null)
            {
                movieMaterialInstance.mainTexture = movie.texture;
                movieMaterialInstance.SetTexture("_EmissionMap", movie.texture);
            }
            renderer.sharedMaterial = movieMaterialInstance;
        }
        if (movie != null && subtitles != null && transitionPhase != 0f && transitionSpeed > 0f && inTransition)
        {
            time = audiosourceTime;
            if (currentLine != null && !currentLine.ShouldShow(time))
            {
                if (lockedVOAndSubtitles)
                {
                    SubtitleManager.instance.ClearSubtitle();
                }
                currentLine = null;
            }
            if (currentLine == null)
            {
                currentLine = subtitles.GetLineToDisplay(time);
                if (currentLine != null && lockedVOAndSubtitles)
                {
                    SubtitleManager.instance.SetSubtitle(ScriptLocalization.Get("SUBTITLES/" + currentLine.key));
                }
            }
        }
        if (!inTransition)
        {
            return;
        }
        if (transitionPhase == 0f && transitionSpeed > 0f && movie != null)
        {
            renderer.sharedMaterial = movieMaterialInstance;
            audiosourceStart        = Time.unscaledTime;
            lockedVOAndSubtitles    = true;
            movie.Play();
        }
        transitionPhase = Mathf.Clamp01(transitionPhase + Time.deltaTime * transitionSpeed);
        float num2 = Ease.easeInOutQuad(0f, 1f, transitionPhase);
        float num3 = width / 16f * 9f;

        Create2SidedMesh((0f - width) / 2f * num2, (0f - num3) / 2f, width / 2f * num2, num3 / 2f, 0.5f - num2 / 2f, 0f, 0.5f + num2 / 2f, 1f);
        mesh.vertices = meshVerts;
        mesh.uv       = uvs;
        mesh.RecalculateNormals();
        mesh.RecalculateBounds();
        filter.sharedMesh = mesh;
        collider.size     = ((num2 != 0f) ? new Vector3(width * num2, num3, 0.1f) : Vector3.zero);
        if (transitionPhase == 0f && transitionSpeed < 0f)
        {
            if (playingScreen == this)
            {
                playingScreen = null;
            }
            inTransition = false;
            StopMovie();
            RemoveSubtitles();
            renderer.sharedMaterial = blankMaterial;
            GrabManager.Release(base.gameObject);
        }
    }