}//开关对话框 public void OpenLogs() { Logs.SetActive(true); //清除Logs的所有子物体 for (int i = 0; i < LogParent.transform.childCount; i++) { Destroy(LogParent.transform.GetChild(i).gameObject); } int LogNum = 0; int startLine = 0;//开始打印的行 int index = TreatmentController._instance.index; string[] Treatment = TreatmentController._instance.Treatment; for (int i = index; i >= 0; i--) { if (Treatment[i][0] != '@' && Treatment[i][0] != '#')//不是命令行和注释行 { LogNum++; if (LogNum == 30) { startLine = i; break; } } else { continue; } } UIController._instance.SwitchWindow("off"); for (int i = startLine; i < index; i++) { if (Treatment[i][0] == '@' || Treatment[i][0] == '#') { continue; } GameObject tempInstance = Instantiate(LogInstance, new Vector3(0, 0, 0), transform.rotation, LogParent.transform); string[] treatmentText = Treatment[i].Split('|'); string tempName = treatmentText[0]; string tempText = treatmentText[1]; tempInstance.transform.Find("LogBg").transform.Find("Text").GetComponent <Text>().text = "【" + tempName + "】\t[" + tempText + "]"; } LogScrollBar.GetComponent <Scrollbar>().value = 0.01f; }//开关文本回放面板
void Awake() { instance = this; logSB = gameObject.GetComponentInChildren <Scrollbar> (); }