using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class ImagePlus : Image { #region 变量 public Text Text { get { if (Text_ == null) { Text_ = GetComponentInParent(); } return Text_; } set { Text_ = value; } } private Text Text_; public bool Draw; public List VerticesList; #endregion public void UpdateStatus(bool draw, VertexHelper empty, List vertexList) { Draw = draw; if (Draw) { if (Application.isPlaying) { sprite = Bundle.Atlas.LoadAsset("Atlas"); } } VerticesList = new List(); for (int i = 0; i < vertexList.Count; i += 4) { VerticesList.Add ( new UIVertex[] { vertexList[i + 0], vertexList[i + 1], vertexList[i + 2], vertexList[i + 3], } ); } OnPopulateMesh(empty); StartCoroutine ( Auxiliary.IDelayCall ( () => { SetVerticesDirty(); }, 2 ) ); } protected override void OnPopulateMesh(VertexHelper toFill) { toFill.Clear(); if (Draw) { if (VerticesList.Valid()) { for (int i = 0; i < VerticesList.Count; i++) { toFill.AddUIVertexQuad(VerticesList[i]); } } } } }