protected IEnumerator word() { soundmuc(talkbox, Z.getmusic()); ploading(Z.getim("l"), Z.getim("m"), Z.getim("r")); n.text = Z.getname(); s.text = ""; if (Z.getsay(road).Substring(0, 1) == "(") { buttons.GetComponent <CanvasGroup>().alpha = 1; buttonText1.GetComponent <Text>().text = Z.getsay(1); buttonText2.GetComponent <Text>().text = Z.getsay(2); button1.GetComponent <Canvas>().overrideSorting = true; button2.GetComponent <Canvas>().overrideSorting = true; button1.interactable = true; button2.interactable = true; } else { bool colorlock = false; string colorcolor = ""; for (int i = 0; i < Z.getsay(road).Length; i++) { if (Z.getsay(road).Substring(i, 1) == "<" && !colorlock) { colorlock = true; colorcolor = Z.getsay(road).Substring(i + 1, 15); i = i + 17; } else if (Z.getsay(road).Substring(i, 1) == "<" && colorlock) { if (Z.getsay(road).Substring(i, 8) == "</color>") { i += 8; if (Z.getsay(road).Length == i) { break; } colorlock = false; } } if (colorlock) { s.text += "<" + colorcolor + ">" + Z.getsay(road).Substring(i, 1) + "</color>"; } else { s.text += Z.getsay(road).Substring(i, 1); } yield return(new WaitForSeconds(0.07f));//文字顯示速度 if (Input.GetKeyDown(KeyCode.Space) || Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.LeftControl)) { s.text = Z.getsay(road); break; } } } //------------------------------------------------------- while (true) { //延遲判斷 yield return(new WaitForSeconds(0.01f)); //延遲判斷速度 if (Z.getsay(road).Substring(0, 1) == "(") { if (!(button1.interactable || button2.interactable))//需縮減 { buttons.GetComponent <CanvasGroup>().alpha = 0; break; } } else { if (Input.GetKeyDown(KeyCode.Space) || Input.GetKey(KeyCode.LeftControl)) //需縮減 { break; } } } Z = Z.n(); if (Z.getsay(road) == "" || Z.getsay(road) == null) { StartCoroutine(Sumthing.notview(box, 1, 0, 0.5, 0.07f)); Resources.UnloadUnusedAssets(); Invoke("endthing", 0.2f); } else if (Z.getsay(road) == "finish") { StartCoroutine(Sumthing.notview(box, 1, 0, 0.5, 0.07f)); Resources.UnloadUnusedAssets(); Invoke("endthing", 0.2f); otherthing(); } else { StartCoroutine(word()); } yield return(null); }
void delayfuntion() { StartCoroutine(Sumthing.notview(wx, 1, 0, 0.0625, 0.03f)); }