public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        TMP_Text text = playerData as TMP_Text;

        string currentText  = "";
        float  currentAlpha = 0f;

        if (!text)
        {
            return;
        }

        int inputCount = playable.GetInputCount();

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);

            if (inputWeight > 0f)
            {
                ScriptPlayable <SubtitleBehaviour> inputPlayable = (ScriptPlayable <SubtitleBehaviour>)playable.GetInput(i);

                SubtitleBehaviour input = inputPlayable.GetBehaviour();
                currentText  = input.SubtitleText;
                currentAlpha = inputWeight;
            }
        }

        text.text  = currentText;
        text.color = new Color(1, 1, 1, currentAlpha);
    }
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        TextMeshProUGUI subtitleTextObject = playerData as TextMeshProUGUI;

        if (!subtitleTextObject)
        {
            return;
        }

        string currentText  = "";
        float  currentAlpha = 0.0f;

        int numberOfClips = playable.GetInputCount();

        for (int i = 0; i < numberOfClips; i++)
        {
            float clipWeight = playable.GetInputWeight(i);

            if (clipWeight > 0f)
            {
                ScriptPlayable <SubtitleBehaviour> clipPlayable = (ScriptPlayable <SubtitleBehaviour>)playable.GetInput(i);

                SubtitleBehaviour clipBehaviour = clipPlayable.GetBehaviour();
                currentText  = clipBehaviour.subtitleText;
                currentAlpha = clipWeight;
            }
        }

        subtitleTextObject.text  = currentText;
        subtitleTextObject.color = new Color(1, 1, 1, currentAlpha);
    }
예제 #3
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        GameObject subsObject   = playerData as GameObject;
        string     currentText  = "";
        float      currentAlpha = 0f;

        if (!subsObject)
        {
            return;
        }

        int inputCount = playable.GetInputCount();

        for (int i = 0; i < inputCount; i++)
        {
            float inputWeight = playable.GetInputWeight(i);
            if (inputWeight > 0f)
            {
                ScriptPlayable <SubtitleBehaviour> inputPlayable;
                inputPlayable = (ScriptPlayable <SubtitleBehaviour>)playable.GetInput(i);
                SubtitleBehaviour input = inputPlayable.GetBehaviour();

                currentText  = input.subtitleText;
                currentAlpha = inputWeight;
            }
        }
        UpdateText(subsObject, currentText, currentAlpha);
    }
예제 #4
0
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        var playable = ScriptPlayable <SubtitleBehaviour> .Create(graph);

        SubtitleBehaviour subtitleBehaviour = playable.GetBehaviour();

        subtitleBehaviour.subtitleText = subtitleText;

        return(playable);
    }
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        m_TrackBinding = playerData as Text;
        if (m_TrackBinding == null)
        {
            return;
        }

        int inputCount = playable.GetInputCount();

        float greatestWeight = 0f;
        int   currentInputs  = 0;

        for (int i = 0; i < inputCount; i++)
        {
            ScriptPlayable <SubtitleBehaviour> inputPlayable = (ScriptPlayable <SubtitleBehaviour>)playable.GetInput(i);
            SubtitleBehaviour input = inputPlayable.GetBehaviour();

            float inputWeight = playable.GetInputWeight(i);
            if (inputWeight > greatestWeight)
            {
                m_TrackBinding.text = input.Text;
                greatestWeight      = inputWeight;

                if (!Mathf.Approximately(inputWeight, 0f))
                {
                    currentInputs++;
                }
            }
        }

        if (currentInputs == 0)
        {
            m_TrackBinding.text = string.Empty;
        }
    }