private void AddGameObjectToLine(bool bNewLine, float tempXPos, GameObject tempGo, RichTextInfoType type = RichTextInfoType.Invalid) { if (bNewLine) { RichLine newRichLine = new RichLine(); // 这里处理,第一行的特殊情况 newRichLine.maxHeight = RichLineList.Count <= 0 ? 0 : LabelHeight_; RichLineList.Add(newRichLine); } if (tempGo == null) { return; } RichLine line = RichLineList[RichLineList.Count - 1]; RichGo go = new RichGo(); go.type = type; go.Set(tempXPos, tempGo); line.goList.Add(go); //Image img = go.go.GetComponent<Image>(); /* * if( img != null ) { * if( line.maxHeight < img.height ) * line.maxHeight = img.height; * } */ }
private IEnumerator Typewriter() { for (int i = 0; i < RichLineList.Count; i++) { List <RichGo> list = RichLineList[i].goList; for (int k = 0; k < list.Count; k++) { yield return(null); RichGo iter = list[k]; iter.go.SetActive(true); // 只在纯文本时才使用打字机效果 if (iter.type != RichTextInfoType.Text) { continue; } Text label = iter.go.GetComponent <Text>(); string content = label.text; yield return(StartCoroutine(Global.TypewriterDialog(label, content))); } yield return(null); } }