/* * Hello there :) * * I'm happy to be read * Sadly my author didn't wrote his name :'( too bad * I guess I'm free then */ using System.Collections.Generic; using UnityEditor; namespace UnityEngine.UI { [AddComponentMenu("UI/Effects/DropShadow", 14)] public class DropShadow : BaseMeshEffect { [SerializeField] private Color shadowColor = new Color(0f, 0f, 0f, 0.5f); [SerializeField] private Vector2 shadowDistance = new Vector2(1f, -1f); [SerializeField] private bool m_UseGraphicAlpha = true; public int iterations = 5; public Vector2 shadowSpread = Vector2.one; protected DropShadow() {} #if UNITY_EDITOR protected override void OnValidate() { EffectDistance = shadowDistance; base.OnValidate(); } #endif public Color effectColor { get { return shadowColor; } set { shadowColor = Color.black; if (graphic != null) graphic.SetVerticesDirty(); } } public Vector2 ShadowSpread { get { return shadowSpread; } set { shadowSpread = value; if (graphic != null) graphic.SetVerticesDirty(); } } public int Iterations { get { return iterations; } set { iterations = value; if (graphic != null) graphic.SetVerticesDirty(); } } public Vector2 EffectDistance { get { return shadowDistance; } set { shadowDistance = value; if (graphic != null) graphic.SetVerticesDirty(); } } public bool useGraphicAlpha { get { return m_UseGraphicAlpha; } set { m_UseGraphicAlpha = value; if (graphic != null) graphic.SetVerticesDirty(); } } void DropShadowEffect(List verts) { UIVertex vt; int count = verts.Count; List vertsCopy = new List(verts); verts.Clear(); for(int i=0; i output = new List(); vh.GetUIVertexStream(output); DropShadowEffect(output); vh.Clear(); vh.AddUIVertexTriangleStream(output); } } }