コード例 #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        reader = target as PhonemesToBlendShapes;
        bool isPlaying = Application.isPlaying && reader.audio != null && reader.audio.isPlaying;

        CheckRemapArraySize();

        //Playing refresh
        if (isPlaying)
        {
            time = reader.audio.time / reader.audio.clip.length;
            Repaint();
        }

        //Draw graph
        float temp = time;

        if (reader.clip != null)
        {
            Phonemes_Editor.DrawGraph(reader.clip.phonemes.refined, ref temp, Repaint, BlendShapeField);
        }
        if (temp != time)
        {
            time = temp;
            if (!Application.isPlaying)
            {
                reader.Evaluate(time);
            }
        }

        //Draw play button
        if (Application.isPlaying)
        {
            if (!isPlaying)
            {
                if (GUILayout.Button("Play"))
                {
                    reader.audio.Play();
                }
            }
            else
            {
                if (GUILayout.Button("Stop"))
                {
                    reader.audio.Stop();
                }
            }
        }
    }
コード例 #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        reader = target as PhonemeReader;
        bool isPlaying = Application.isPlaying && reader.audio != null && reader.audio.isPlaying;

        //Playing refresh
        if (isPlaying)
        {
            time = reader.audio.time / reader.audio.clip.length;
            Repaint();
        }

        //Draw graph
        if (reader.clip != null)
        {
            Phonemes_Editor.DrawGraph(reader.clip.phonemes.refined, ref time, Repaint, null);
        }

        //Draw play button
        if (Application.isPlaying)
        {
            if (!isPlaying)
            {
                if (GUILayout.Button("Play"))
                {
                    reader.audio.Play();
                }
            }
            else
            {
                if (GUILayout.Button("Stop"))
                {
                    reader.audio.Stop();
                }
            }
        }
    }