using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
public class HorizontalReversalImage : Image
|
{
|
|
protected override void OnPopulateMesh(VertexHelper vh)
|
{
|
base.OnPopulateMesh(vh);
|
|
if (!IsActive() || vh.currentVertCount == 0)
|
{
|
return;
|
}
|
|
var vertexs = new List<UIVertex>();
|
vh.GetUIVertexStream(vertexs);
|
|
var uv05 = vertexs[4].uv0;
|
var uv1 = vertexs[2].uv0;
|
var uv23 = vertexs[1].uv0;
|
var uv4 = vertexs[0].uv0;
|
|
var reveralVertexs = new List<UIVertex>();
|
reveralVertexs.Add(AmendUV0(vertexs[0], uv05));
|
reveralVertexs.Add(AmendUV0(vertexs[1], uv1));
|
reveralVertexs.Add(AmendUV0(vertexs[2], uv23));
|
reveralVertexs.Add(AmendUV0(vertexs[3], uv23));
|
reveralVertexs.Add(AmendUV0(vertexs[4], uv4));
|
reveralVertexs.Add(AmendUV0(vertexs[5], uv05));
|
|
vh.Clear();
|
vh.AddUIVertexTriangleStream(reveralVertexs);
|
}
|
|
public UIVertex AmendUV0(UIVertex _vertex, Vector2 _uv0)
|
{
|
_vertex.uv0 = _uv0;
|
return _vertex;
|
}
|
|
public enum Align
|
{
|
Left,
|
Right,
|
Bottom,
|
Top,
|
Orthogon,
|
}
|
}
|