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 VertexList; #endregion public void UpdateStatus(bool draw, VertexHelper vase, List vertexList) { Draw = draw; if (Draw) { if (Application.isPlaying) { sprite = Bundle.Atlas.LoadAsset("Atlas"); } } VertexList = vertexList; OnPopulateMesh(vase); StartCoroutine ( Auxiliary.IDelayCall ( () => { SetVerticesDirty(); }, 2 ) ); } protected override void OnPopulateMesh(VertexHelper toFill) { toFill.Clear(); if (VertexList.Valid() && Draw) { toFill.AddVert(VertexList[0]); toFill.AddVert(VertexList[1]); toFill.AddVert(VertexList[2]); toFill.AddVert(VertexList[3]); toFill.AddTriangle(0, 1, 2); toFill.AddTriangle(0, 2, 3); } } }