using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class TextPlus : Text { #region public bool Draw; private ImagePlus _ImagePlus; public ImagePlus ImagePlus { get { if (_ImagePlus == null) { _ImagePlus = GetComponentInChildren(); } return _ImagePlus; } set { _ImagePlus = value; } } #endregion public override void SetVerticesDirty() { base.SetVerticesDirty(); int leftIndex = text.IndexOf("<("); int rightIndex = text.IndexOf(")>"); if (leftIndex == -1) { Draw = false; } else { Draw = true; ImagePlus.SpriteName = text.Between(leftIndex + 2, rightIndex - 2); ImagePlus.StartIndex = leftIndex - 1; text = text.Replace(leftIndex, rightIndex, " "); } } protected override void OnPopulateMesh(VertexHelper toFill) { base.OnPopulateMesh(toFill); if (Draw) { Draw = false; toFill.GetUIVertexStream(ImagePlus.TextVertexList); } } }