Example #1
0
//--> Prepare a voice over
    private IEnumerator I_setupNewVoice(bool alreadyInDiary)
    {
        currentVoiceOverInfo = new List <slot> ();
        currentVoiceOverInfo.Add(new slot());

        //Debug.Log ("Setup new Voice : " + ingameGlobalManager.instance.currentLanguage);

        currentVoiceOverInfo [0].diaryTitle[0] = currentTextList.r_Title(ingameGlobalManager.instance.currentLanguage, currentID);


        //--> Add Page + Audio Clip if needed
        currentVoiceOverInfo [0].diaryText.Clear();
        currentVoiceOverInfo [0].diaryAudioClip.Clear();
        for (var i = 0; i < currentTextList.diaryList[ingameGlobalManager.instance.currentLanguage]._languageSlot[currentID].diaryText.Count; i++)
        {
            currentVoiceOverInfo [0].diaryText.Add(currentTextList.r_Page(ingameGlobalManager.instance.currentLanguage, currentID, i));


            currentVoiceOverInfo [0].diaryAudioClip.Add(findAudioCLip(i));
        }


        //--> Know the number of Page + the number of subtitles for each page for a specific ID
        currentVoiceOverInfo [0].diarySub = new List <sub>();

        //--> Prepare list use to display subtitle and play audio
        for (var i = 0; i < currentTextList.diaryList [ingameGlobalManager.instance.currentLanguage]._languageSlot [currentID].diaryText.Count; i++)
        {
            currentVoiceOverInfo [0].diarySub.Add(new sub());
        }


        int numberOfPage = currentTextList.voiceOverDescription(ingameGlobalManager.instance.currentLanguage, currentID) [0];

        //Debug.Log (numberOfPage);
        for (var i = 0; i < numberOfPage; i++)                          // i = 1 because 0 represent the number of page. The next values represent the number subtitles for each page

        {
            int numberOfSubForSelectedPage = currentTextList.voiceOverDescription(ingameGlobalManager.instance.currentLanguage, currentID) [i + 1];
            //Debug.Log (numberOfSubForSelectedPage);
            for (var j = 0; j < numberOfSubForSelectedPage; j++)
            {
                //Debug.Log (numberOfPage);
                currentVoiceOverInfo [0].diarySub [i].textSub.Add(currentTextList.diaryList [ingameGlobalManager.instance.currentLanguage]._languageSlot [currentID].diarySub[i].textSub[j]);
                currentVoiceOverInfo [0].diarySub [i].startPointsClip.Add(currentTextList.diaryList [0]._languageSlot [currentID].diarySub[i].startPointsClip[j]);
            }
        }

        StartCoroutine(launchVoiceOver(alreadyInDiary));

        yield return(null);
    }