示例#1
0
    public IEnumerator ShowChat(string chunkName)
    {
        //SearchNameofThetextChunk
        chunkName = chunkName.ToLower();
        for (int i = 0; i < textChunks.Length; i++)
        {
            //find the match name of the text Chunk
//			Debug.Log(chunkName);
//			Debug.Log (textChunks.Length);
//			Debug.Log (i);
            if (textChunks [i].name.ToLower() == chunkName)
            {
                //loop through each text in modular
                //Debug.Log(chunkName);
                if (chunkName == "init")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        if (j != 0)
                        {
                            typingTxt.SetActive(true);
                        }
                        yield return(new WaitForSeconds(Random.Range(3, 4)));

//						if(j==1)
//							typingTxt.SetActive (true);
                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        if (j != 0)
                        {
                            soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        }

                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end
                            dialogueO.EnableDialogueOption(1);
                            dialogueO.dialogue_text [0].text = "How can I help ?";
                        }
                    }
                }
                else if (chunkName == "emailfirst")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == 3)                           //second Sentnece
                        {
                            StartCoroutine(progressText.ShowProgress("emailfirst"));
                            pM.PanelButtonsObjs [0].SetActive(true);
                            pM.BtnInteactAll("Mail");
                            pM.btn_Email.SetActive(true);
                            pM.EnablePanel("Panel_Content_Mail");
                        }
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end

                            dialogueO.EnableDialogueOption(2);
                            dialogueO.dialogue_text [0].text = "Yes";
                            dialogueO.dialogue_text [1].text = "No";
                        }
                    }
//				} else if (chunkName == "emailsecond") {
//					for (int j = 0; j < textChunks [i].progressTextModular.Length; j++) {
//						yield return new WaitForSeconds (interval);
//						textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
//						autoScroll.ChatScroll ();
//						soundManager.GetComponent<SoundController> ().PlayArtiemisSound ();
//						if (j == textChunks [i].progressTextModular.Length - 1) {
//							//at end
//
//							//how many buttons need to be enable
//							dialogueO.EnableDialogueOption(2);
//							dialogueO.dialogue_text [0].text = "Yes";
//							dialogueO.dialogue_text [1].text = "No";
//						}
//					}
                }
                else if (chunkName == "yes")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end
                        }
                    }
                }
                else if (chunkName == "no")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end
                        }
                    }
                }
                else if (chunkName == "vance")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end

                            //how many buttons need to be enable
                            dialogueO.EnableDialogueOption(1);
                            dialogueO.dialogue_text [0].text = "Why is he friendly with the folks from Arcadia ?";
                        }
                    }
                }
                else if (chunkName == "ipcc")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end
                            //how many buttons need to be enable

                            dialogueO.EnableDialogueOption(1);
                            dialogueO.dialogue_text [0].text = "Why isn’t Arcadia responding ?";
                        }
                    }
                }
                else if (chunkName == "arcadia")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            Invoke("DelaySecondEmail", 3f);                            //sending second email after 5 sec
                        }
                    }
                }
                else if (chunkName == "folks")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            Invoke("DelayThridEmail", 3f);                            //sending second email after 5 sec
                        }
                    }
                }
                else if (chunkName == "end")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();

                        dialogueO.DisableDialogueOption();

                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //at end
                            //how many buttons need to be enable

                            StartCoroutine(progressText.ShowProgress("emailforth"));
                        }
                    }
                }
                else if (chunkName == "offline")
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        //ball animation happening
                        ballStatus.BallStatus1();                        //ball died
                        ballStatus.anim.SetBool("SecurityBreach", false);
                    }
                }
                else
                {
                    for (int j = 0; j < textChunks [i].progressTextModular.Length; j++)
                    {
                        typingTxt.SetActive(true);
                        yield return(new WaitForSeconds(Random.Range(2, 4)));

                        typingTxt.SetActive(false);
                        textPanel.text = textPanel.text + "\n" + "<color=#2ce7d8>" + textChunks [i].progressTextModular [j] + "</color>";
                        autoScroll.ChatScroll();
                        soundManager.GetComponent <SoundController> ().PlayArtiemisSound();
                        if (j == textChunks [i].progressTextModular.Length - 1)
                        {
                            //finish all the thing break the loop
                            break;
                        }
                    }
                }
            }
        }
    }