Пример #1
0
    public void SoundSliderChange()
    {
        FxCollection.PlayTextOverFx();
        float volume = m_sound_slider.value;

        GlobalManager.instance.soundVolumn = volume;
    }
Пример #2
0
    public void AudioSliderChange()
    {
        FxCollection.PlayTextOverFx();
        float volume = m_audio_slider.value;

        GlobalManager.instance.audioVolumn = volume;
        musicSource.volume = volume;
    }
Пример #3
0
    private IEnumerator ShowText(string text)
    {
        text = text.Trim();
        text = text.Substring(1, text.Length - 2);
        text = "『" + text + "』";
        //i为当前显示字符长度
        int    i           = 0;
        int    strLength   = text.Length;
        string colHeadStr  = "";
        bool   isStringCol = false;

        IsPlayingText = true;
        showStr       = "";

        while (i < strLength)
        {
            //识别并不显示颜色代码
            if (text[i].ToString() == "<" && text[i + 1].ToString() != "/")
            {
                isStringCol = true;
                int j = 1;
                while (text[i + j].ToString() != ">")
                {
                    j++;
                }
                colHeadStr = text.Substring(i, j + 1);
                i         += j + 1;
            }
            else if (text[i].ToString() == "<" && text[i + 1].ToString() == "/")
            {
                i          += 8;
                isStringCol = false;
            }

            //向显示字符中添加新字符
            if (isStringCol)
            {
                showStr += colHeadStr + text[i].ToString() + "</color>";
            }
            else if (text[i] == '\\')
            {
                //忽略转行
                showStr += '\n';
                i++;
            }
            else
            {
                showStr += text[i].ToString();
            }
            //播放音效
            if (i % 2 == 0)
            {
                FxCollection.PlayTextFx();
            }
            //更新当前文字
            talkText.text = showStr;
            //识别换行
            talkText.text = talkText.text.Replace("\\n", "\n");
            i++;
            yield return(new WaitForSeconds(textSpeed));
        }
        FxCollection.PlayTextOverFx();
        rowIndex++;
        IsPlayingText = false;
        StopCoroutine("ShowText");
    }