protected override void OnEnable() { base.OnEnable(); _lastText = ""; _inputGUIContent = new GUIContent("Input Text"); _outputGUIContent = new GUIContent("Output Text"); _text = serializedObject.FindProperty("_text"); m_Text = serializedObject.FindProperty("m_Text"); m_FontData = serializedObject.FindProperty("m_FontData"); _inlineText = target as InlineText; }
//更新Text文本信息 public void UpdateTextInfo(InlineText key, int id, List <SpriteTagInfo> value, bool visable) { Dictionary <InlineText, MeshInfo> textMeshInfo; if (value == null) { if (_graphicMeshInfo.TryGetValue(id, out textMeshInfo) && textMeshInfo.ContainsKey(key)) { textMeshInfo[key].Release(); textMeshInfo.Remove(key); } } else { SpriteGraphic spriteGraphic = _spriteGraphics.Find(x => x.m_spriteAsset != null && x.m_spriteAsset.Id == id); if (spriteGraphic != null) { if (!_graphicMeshInfo.TryGetValue(id, out textMeshInfo)) { textMeshInfo = new Dictionary <InlineText, MeshInfo>(); _graphicMeshInfo.Add(id, textMeshInfo); } MeshInfo meshInfo; if (!textMeshInfo.TryGetValue(key, out meshInfo)) { meshInfo = Pool <MeshInfo> .Get(); textMeshInfo.Add(key, meshInfo); } meshInfo.Reset(); meshInfo.visable = visable; for (int i = 0; i < value.Count; i++) { for (int j = 0; j < value[i].Pos.Length; j++) { //世界转本地坐标->避免位置变换的错位 meshInfo.Vertices.Add(Utility.TransformWorld2Point(spriteGraphic.transform, value[i].Pos[j])); } meshInfo.UVs.AddRange(value[i].UVs); } } } //添加到渲染列表里面 -- 等待下一帧渲染 if (!_renderIndexs.Contains(id)) { _renderIndexs.Add(id); } }
void Awake() { _text = GetComponent <InlineText>(); }