1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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<Text>();
- }
- return _Text;
- }
- set { _Text = value; }
- }
- private Text _Text;
- public bool Draw;
- public List<UIVertex> VertexList;
- #endregion
- public void UpdateStatus(bool draw, VertexHelper vase, List<UIVertex> vertexList)
- {
- Draw = draw;
- if (Draw)
- {
- if (Application.isPlaying)
- {
- sprite = Bundle.Atlas.LoadAsset<Sprite>("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);
- }
- }
- }
|