//textを表示する処理 private void DisplayText() { if (nextText == NextText.print && time >= tmpTime && charCount != sData[tIndex].oringText.Length) { if (charCount == 0) { if (sData[tIndex].characterName != "") { nameText.text = sData[tIndex].characterName; } //表示スペースの調整 uiText.text += " "; } uiText.text += texts[charCount]; charCount++; tmpTime = time + DisplayTextIntarval; } else if (charCount == sData[tIndex].oringText.Length) { uiText.text += "\n"; tIndex++; charCount = 0; nextText = NextText.next; } }
//textsに文章を一文字ずつに分けて格納 private void StoreText() { if (nextText == NextText.next) { texts = new string[sData[tIndex].oringText.Length]; if (sData[tIndex].oringText.Substring(0, 1) != "{") { for (int i = 0; i < texts.Length; i++) { texts[i] = sData[tIndex].oringText.Substring(i, 1); } nextText = NextText.print; tmpTime = time + DisplayTextIntarval; } else { string command = sData[tIndex].oringText.Substring(sData[tIndex].oringText.IndexOf('{') + 1, sData[tIndex].oringText.IndexOf('}') - 1); switch (command) { case "next": nextText = NextText.standby; if (auto) { autoOnlyTime = time; } break; case "end": nextText = NextText.end; break; } } } }
/// <summary> /// 自動でテキスト送りを行う /// </summary> private void AutoTextPrint() { if (auto) { if (nextText == NextText.standby && time >= autoOnlyTime + 2) { uiText.text = ""; tIndex++; nextText = NextText.next; page++; } } }
private void TextSkip() { if (nextText == NextText.end) { return; } if (nextText == NextText.standby) { uiText.text = ""; tIndex++; nextText = NextText.next; page++; } else { PageSet(); } }
private void PageSet() { charCount = 0; nextText = NextText.standby; //最後のページかどうか if (page > lineCount.Count - 1) { tIndex = tDataIndex - 1; nextText = NextText.end; } else { tIndex = lineCount[page]; } if (sData.Length - 1 >= 0) { //テキストの削除 uiText.text = ""; if (page != 0) { for (int i = lineCount[page - 1] + 1; i < tIndex; i++) { uiText.text += " " + sData[i].oringText + "\n"; } } else { for (int i = 0; i < tIndex; i++) { uiText.text += " " + sData[i].oringText + "\n"; } } } }